1// Copyright 2019 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package cloudidentity provides access to the Cloud Identity API. 8// 9// For product documentation, see: https://cloud.google.com/identity/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/cloudidentity/v1beta1" 16// ... 17// ctx := context.Background() 18// cloudidentityService, err := cloudidentity.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27// 28// cloudidentityService, err := cloudidentity.NewService(ctx, option.WithScopes(cloudidentity.CloudPlatformScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// cloudidentityService, err := cloudidentity.NewService(ctx, option.WithAPIKey("AIza...")) 33// 34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35// 36// config := &oauth2.Config{...} 37// // ... 38// token, err := config.Exchange(ctx, ...) 39// cloudidentityService, err := cloudidentity.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package cloudidentity // import "google.golang.org/api/cloudidentity/v1beta1" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 htransport "google.golang.org/api/transport/http" 60) 61 62// Always reference these packages, just in case the auto-generated code 63// below doesn't. 64var _ = bytes.NewBuffer 65var _ = strconv.Itoa 66var _ = fmt.Sprintf 67var _ = json.NewDecoder 68var _ = io.Copy 69var _ = url.Parse 70var _ = gensupport.MarshalJSON 71var _ = googleapi.Version 72var _ = errors.New 73var _ = strings.Replace 74var _ = context.Canceled 75 76const apiId = "cloudidentity:v1beta1" 77const apiName = "cloudidentity" 78const apiVersion = "v1beta1" 79const basePath = "https://cloudidentity.googleapis.com/" 80 81// OAuth2 scopes used by this API. 82const ( 83 // See, change, create, and delete any of the Cloud Identity Groups that 84 // you can access, including the members of each group 85 CloudIdentityGroupsScope = "https://www.googleapis.com/auth/cloud-identity.groups" 86 87 // See any Cloud Identity Groups that you can access, including group 88 // members and their emails 89 CloudIdentityGroupsReadonlyScope = "https://www.googleapis.com/auth/cloud-identity.groups.readonly" 90 91 // View and manage your data across Google Cloud Platform services 92 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 93) 94 95// NewService creates a new Service. 96func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 97 scopesOption := option.WithScopes( 98 "https://www.googleapis.com/auth/cloud-identity.groups", 99 "https://www.googleapis.com/auth/cloud-identity.groups.readonly", 100 "https://www.googleapis.com/auth/cloud-platform", 101 ) 102 // NOTE: prepend, so we don't override user-specified scopes. 103 opts = append([]option.ClientOption{scopesOption}, opts...) 104 client, endpoint, err := htransport.NewClient(ctx, opts...) 105 if err != nil { 106 return nil, err 107 } 108 s, err := New(client) 109 if err != nil { 110 return nil, err 111 } 112 if endpoint != "" { 113 s.BasePath = endpoint 114 } 115 return s, nil 116} 117 118// New creates a new Service. It uses the provided http.Client for requests. 119// 120// Deprecated: please use NewService instead. 121// To provide a custom HTTP client, use option.WithHTTPClient. 122// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 123func New(client *http.Client) (*Service, error) { 124 if client == nil { 125 return nil, errors.New("client is nil") 126 } 127 s := &Service{client: client, BasePath: basePath} 128 s.Groups = NewGroupsService(s) 129 return s, nil 130} 131 132type Service struct { 133 client *http.Client 134 BasePath string // API endpoint base URL 135 UserAgent string // optional additional User-Agent fragment 136 137 Groups *GroupsService 138} 139 140func (s *Service) userAgent() string { 141 if s.UserAgent == "" { 142 return googleapi.UserAgent 143 } 144 return googleapi.UserAgent + " " + s.UserAgent 145} 146 147func NewGroupsService(s *Service) *GroupsService { 148 rs := &GroupsService{s: s} 149 rs.Memberships = NewGroupsMembershipsService(s) 150 return rs 151} 152 153type GroupsService struct { 154 s *Service 155 156 Memberships *GroupsMembershipsService 157} 158 159func NewGroupsMembershipsService(s *Service) *GroupsMembershipsService { 160 rs := &GroupsMembershipsService{s: s} 161 return rs 162} 163 164type GroupsMembershipsService struct { 165 s *Service 166} 167 168// EntityKey: An EntityKey uniquely identifies an Entity. Namespaces are 169// used to provide 170// isolation for ids. A single Id can be reused across namespaces but 171// the 172// combination of a namespace and an id must be unique. 173type EntityKey struct { 174 // Id: The id of the entity within the given namespace. The id must be 175 // unique 176 // within its namespace. 177 Id string `json:"id,omitempty"` 178 179 // Namespace: Namespaces provide isolation for ids, i.e an id only needs 180 // to be unique 181 // within its namespace. 182 // 183 // Namespaces are currently only created as part of IdentitySource 184 // creation 185 // from Admin Console. A namespace 186 // "identitysources/{identity_source_id}" is 187 // created corresponding to every Identity Source `identity_source_id`. 188 Namespace string `json:"namespace,omitempty"` 189 190 // ForceSendFields is a list of field names (e.g. "Id") to 191 // unconditionally include in API requests. By default, fields with 192 // empty values are omitted from API requests. However, any non-pointer, 193 // non-interface field appearing in ForceSendFields will be sent to the 194 // server regardless of whether the field is empty or not. This may be 195 // used to include empty fields in Patch requests. 196 ForceSendFields []string `json:"-"` 197 198 // NullFields is a list of field names (e.g. "Id") to include in API 199 // requests with the JSON null value. By default, fields with empty 200 // values are omitted from API requests. However, any field with an 201 // empty value appearing in NullFields will be sent to the server as 202 // null. It is an error if a field in this list has a non-empty value. 203 // This may be used to include null fields in Patch requests. 204 NullFields []string `json:"-"` 205} 206 207func (s *EntityKey) MarshalJSON() ([]byte, error) { 208 type NoMethod EntityKey 209 raw := NoMethod(*s) 210 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 211} 212 213// Group: Resource representing a Group 214type Group struct { 215 // AdditionalGroupKeys: Optional. Additional entity key aliases for a 216 // Group 217 AdditionalGroupKeys []*EntityKey `json:"additionalGroupKeys,omitempty"` 218 219 // CreateTime: The time when the Group was created. 220 // Output only 221 CreateTime string `json:"createTime,omitempty"` 222 223 // Description: An extended description to help users determine the 224 // purpose of a Group. For 225 // example, you can include information about who should join the Group, 226 // the 227 // types of messages to send to the Group, links to FAQs about the 228 // Group, or 229 // related Groups. Maximum length is 4,096 characters. 230 Description string `json:"description,omitempty"` 231 232 // DisplayName: The Group's display name. 233 DisplayName string `json:"displayName,omitempty"` 234 235 // GroupKey: EntityKey of the Group. 236 // 237 // Must be set when creating a Group, read-only afterwards. 238 GroupKey *EntityKey `json:"groupKey,omitempty"` 239 240 // Labels: Labels for Group resource. 241 // Required. 242 // For creating Groups under a namespace, set label key 243 // to 244 // 'labels/system/groups/external' and label value as empty. 245 Labels map[string]string `json:"labels,omitempty"` 246 247 // Name: [Resource 248 // name](https://cloud.google.com/apis/design/resource_names) of 249 // the 250 // Group in the format: `groups/{group_id}`, where group_id is the 251 // unique id 252 // assigned to the Group. 253 // 254 // Must be left blank while creating a Group 255 Name string `json:"name,omitempty"` 256 257 // Parent: The entity under which this Group resides in Cloud Identity 258 // resource 259 // hierarchy. Must be set when creating a Group, read-only 260 // afterwards. 261 // 262 // Currently allowed types: 'identitysources'. 263 Parent string `json:"parent,omitempty"` 264 265 // UpdateTime: The time when the Group was last updated. 266 // Output only 267 UpdateTime string `json:"updateTime,omitempty"` 268 269 // ServerResponse contains the HTTP response code and headers from the 270 // server. 271 googleapi.ServerResponse `json:"-"` 272 273 // ForceSendFields is a list of field names (e.g. "AdditionalGroupKeys") 274 // to unconditionally include in API requests. By default, fields with 275 // empty values are omitted from API requests. However, any non-pointer, 276 // non-interface field appearing in ForceSendFields will be sent to the 277 // server regardless of whether the field is empty or not. This may be 278 // used to include empty fields in Patch requests. 279 ForceSendFields []string `json:"-"` 280 281 // NullFields is a list of field names (e.g. "AdditionalGroupKeys") to 282 // include in API requests with the JSON null value. By default, fields 283 // with empty values are omitted from API requests. However, any field 284 // with an empty value appearing in NullFields will be sent to the 285 // server as null. It is an error if a field in this list has a 286 // non-empty value. This may be used to include null fields in Patch 287 // requests. 288 NullFields []string `json:"-"` 289} 290 291func (s *Group) MarshalJSON() ([]byte, error) { 292 type NoMethod Group 293 raw := NoMethod(*s) 294 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 295} 296 297type ListMembershipsResponse struct { 298 // Memberships: List of Memberships 299 Memberships []*Membership `json:"memberships,omitempty"` 300 301 // NextPageToken: Token to retrieve the next page of results, or empty 302 // if there are no 303 // more results available for listing. 304 NextPageToken string `json:"nextPageToken,omitempty"` 305 306 // ServerResponse contains the HTTP response code and headers from the 307 // server. 308 googleapi.ServerResponse `json:"-"` 309 310 // ForceSendFields is a list of field names (e.g. "Memberships") to 311 // unconditionally include in API requests. By default, fields with 312 // empty values are omitted from API requests. However, any non-pointer, 313 // non-interface field appearing in ForceSendFields will be sent to the 314 // server regardless of whether the field is empty or not. This may be 315 // used to include empty fields in Patch requests. 316 ForceSendFields []string `json:"-"` 317 318 // NullFields is a list of field names (e.g. "Memberships") to include 319 // in API requests with the JSON null value. By default, fields with 320 // empty values are omitted from API requests. However, any field with 321 // an empty value appearing in NullFields will be sent to the server as 322 // null. It is an error if a field in this list has a non-empty value. 323 // This may be used to include null fields in Patch requests. 324 NullFields []string `json:"-"` 325} 326 327func (s *ListMembershipsResponse) MarshalJSON() ([]byte, error) { 328 type NoMethod ListMembershipsResponse 329 raw := NoMethod(*s) 330 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 331} 332 333type LookupGroupNameResponse struct { 334 // Name: [Resource 335 // name](https://cloud.google.com/apis/design/resource_names) of 336 // the 337 // Group in the format: `groups/{group_id}`, where `group_id` is the 338 // unique id 339 // assigned to the Group. 340 Name string `json:"name,omitempty"` 341 342 // ServerResponse contains the HTTP response code and headers from the 343 // server. 344 googleapi.ServerResponse `json:"-"` 345 346 // ForceSendFields is a list of field names (e.g. "Name") to 347 // unconditionally include in API requests. By default, fields with 348 // empty values are omitted from API requests. However, any non-pointer, 349 // non-interface field appearing in ForceSendFields will be sent to the 350 // server regardless of whether the field is empty or not. This may be 351 // used to include empty fields in Patch requests. 352 ForceSendFields []string `json:"-"` 353 354 // NullFields is a list of field names (e.g. "Name") to include in API 355 // requests with the JSON null value. By default, fields with empty 356 // values are omitted from API requests. However, any field with an 357 // empty value appearing in NullFields will be sent to the server as 358 // null. It is an error if a field in this list has a non-empty value. 359 // This may be used to include null fields in Patch requests. 360 NullFields []string `json:"-"` 361} 362 363func (s *LookupGroupNameResponse) MarshalJSON() ([]byte, error) { 364 type NoMethod LookupGroupNameResponse 365 raw := NoMethod(*s) 366 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 367} 368 369type LookupMembershipNameResponse struct { 370 // Name: [Resource 371 // name](https://cloud.google.com/apis/design/resource_names) of 372 // the 373 // Membership being looked up. 374 // 375 // Format: `groups/{group_id}/memberships/{member_id}`, where `group_id` 376 // is 377 // the unique id assigned to the Group to which Membership belongs to, 378 // and 379 // `member_id` is the unique id assigned to the member. 380 Name string `json:"name,omitempty"` 381 382 // ServerResponse contains the HTTP response code and headers from the 383 // server. 384 googleapi.ServerResponse `json:"-"` 385 386 // ForceSendFields is a list of field names (e.g. "Name") to 387 // unconditionally include in API requests. By default, fields with 388 // empty values are omitted from API requests. However, any non-pointer, 389 // non-interface field appearing in ForceSendFields will be sent to the 390 // server regardless of whether the field is empty or not. This may be 391 // used to include empty fields in Patch requests. 392 ForceSendFields []string `json:"-"` 393 394 // NullFields is a list of field names (e.g. "Name") to include in API 395 // requests with the JSON null value. By default, fields with empty 396 // values are omitted from API requests. However, any field with an 397 // empty value appearing in NullFields will be sent to the server as 398 // null. It is an error if a field in this list has a non-empty value. 399 // This may be used to include null fields in Patch requests. 400 NullFields []string `json:"-"` 401} 402 403func (s *LookupMembershipNameResponse) MarshalJSON() ([]byte, error) { 404 type NoMethod LookupMembershipNameResponse 405 raw := NoMethod(*s) 406 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 407} 408 409// Membership: Resource representing a Membership within a Group 410type Membership struct { 411 // CreateTime: Creation timestamp of the Membership. 412 CreateTime string `json:"createTime,omitempty"` 413 414 // MemberKey: EntityKey of the entity to be added as the member. Must be 415 // set while 416 // creating a Membership, read-only afterwards. 417 // 418 // Currently allowed entity types: `Users`, `Groups`. 419 MemberKey *EntityKey `json:"memberKey,omitempty"` 420 421 // Name: [Resource 422 // name](https://cloud.google.com/apis/design/resource_names) of 423 // the 424 // Membership in the format: 425 // `groups/{group_id}/memberships/{member_id}`, 426 // where group_id is the unique id assigned to the Group to which 427 // Membership 428 // belongs to, and member_id is the unique id assigned to the 429 // member 430 // 431 // Must be left blank while creating a Membership. 432 Name string `json:"name,omitempty"` 433 434 // Roles: Roles for a member within the Group. 435 // 436 // Currently supported MembershipRoles: "MEMBER". 437 Roles []*MembershipRole `json:"roles,omitempty"` 438 439 // UpdateTime: Last updated timestamp of the Membership. 440 UpdateTime string `json:"updateTime,omitempty"` 441 442 // ServerResponse contains the HTTP response code and headers from the 443 // server. 444 googleapi.ServerResponse `json:"-"` 445 446 // ForceSendFields is a list of field names (e.g. "CreateTime") to 447 // unconditionally include in API requests. By default, fields with 448 // empty values are omitted from API requests. However, any non-pointer, 449 // non-interface field appearing in ForceSendFields will be sent to the 450 // server regardless of whether the field is empty or not. This may be 451 // used to include empty fields in Patch requests. 452 ForceSendFields []string `json:"-"` 453 454 // NullFields is a list of field names (e.g. "CreateTime") to include in 455 // API requests with the JSON null value. By default, fields with empty 456 // values are omitted from API requests. However, any field with an 457 // empty value appearing in NullFields will be sent to the server as 458 // null. It is an error if a field in this list has a non-empty value. 459 // This may be used to include null fields in Patch requests. 460 NullFields []string `json:"-"` 461} 462 463func (s *Membership) MarshalJSON() ([]byte, error) { 464 type NoMethod Membership 465 raw := NoMethod(*s) 466 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 467} 468 469// MembershipRole: Resource representing a role within a Membership. 470type MembershipRole struct { 471 // Name: MembershipRole in string format. 472 // 473 // Currently supported MembershipRoles: "MEMBER". 474 Name string `json:"name,omitempty"` 475 476 // ForceSendFields is a list of field names (e.g. "Name") to 477 // unconditionally include in API requests. By default, fields with 478 // empty values are omitted from API requests. However, any non-pointer, 479 // non-interface field appearing in ForceSendFields will be sent to the 480 // server regardless of whether the field is empty or not. This may be 481 // used to include empty fields in Patch requests. 482 ForceSendFields []string `json:"-"` 483 484 // NullFields is a list of field names (e.g. "Name") to include in API 485 // requests with the JSON null value. By default, fields with empty 486 // values are omitted from API requests. However, any field with an 487 // empty value appearing in NullFields will be sent to the server as 488 // null. It is an error if a field in this list has a non-empty value. 489 // This may be used to include null fields in Patch requests. 490 NullFields []string `json:"-"` 491} 492 493func (s *MembershipRole) MarshalJSON() ([]byte, error) { 494 type NoMethod MembershipRole 495 raw := NoMethod(*s) 496 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 497} 498 499// Operation: This resource represents a long-running operation that is 500// the result of a 501// network API call. 502type Operation struct { 503 // Done: If the value is `false`, it means the operation is still in 504 // progress. 505 // If `true`, the operation is completed, and either `error` or 506 // `response` is 507 // available. 508 Done bool `json:"done,omitempty"` 509 510 // Error: The error result of the operation in case of failure or 511 // cancellation. 512 Error *Status `json:"error,omitempty"` 513 514 // Metadata: Service-specific metadata associated with the operation. 515 // It typically 516 // contains progress information and common metadata such as create 517 // time. 518 // Some services might not provide such metadata. Any method that 519 // returns a 520 // long-running operation should document the metadata type, if any. 521 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 522 523 // Name: The server-assigned name, which is only unique within the same 524 // service that 525 // originally returns it. If you use the default HTTP mapping, 526 // the 527 // `name` should be a resource name ending with 528 // `operations/{unique_id}`. 529 Name string `json:"name,omitempty"` 530 531 // Response: The normal response of the operation in case of success. 532 // If the original 533 // method returns no data on success, such as `Delete`, the response 534 // is 535 // `google.protobuf.Empty`. If the original method is 536 // standard 537 // `Get`/`Create`/`Update`, the response should be the resource. For 538 // other 539 // methods, the response should have the type `XxxResponse`, where 540 // `Xxx` 541 // is the original method name. For example, if the original method 542 // name 543 // is `TakeSnapshot()`, the inferred response type 544 // is 545 // `TakeSnapshotResponse`. 546 Response googleapi.RawMessage `json:"response,omitempty"` 547 548 // ServerResponse contains the HTTP response code and headers from the 549 // server. 550 googleapi.ServerResponse `json:"-"` 551 552 // ForceSendFields is a list of field names (e.g. "Done") to 553 // unconditionally include in API requests. By default, fields with 554 // empty values are omitted from API requests. However, any non-pointer, 555 // non-interface field appearing in ForceSendFields will be sent to the 556 // server regardless of whether the field is empty or not. This may be 557 // used to include empty fields in Patch requests. 558 ForceSendFields []string `json:"-"` 559 560 // NullFields is a list of field names (e.g. "Done") to include in API 561 // requests with the JSON null value. By default, fields with empty 562 // values are omitted from API requests. However, any field with an 563 // empty value appearing in NullFields will be sent to the server as 564 // null. It is an error if a field in this list has a non-empty value. 565 // This may be used to include null fields in Patch requests. 566 NullFields []string `json:"-"` 567} 568 569func (s *Operation) MarshalJSON() ([]byte, error) { 570 type NoMethod Operation 571 raw := NoMethod(*s) 572 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 573} 574 575type SearchGroupsResponse struct { 576 // Groups: List of Groups satisfying the search query. 577 Groups []*Group `json:"groups,omitempty"` 578 579 // NextPageToken: Token to retrieve the next page of results, or empty 580 // if there are no 581 // more results available for specified query. 582 NextPageToken string `json:"nextPageToken,omitempty"` 583 584 // ServerResponse contains the HTTP response code and headers from the 585 // server. 586 googleapi.ServerResponse `json:"-"` 587 588 // ForceSendFields is a list of field names (e.g. "Groups") to 589 // unconditionally include in API requests. By default, fields with 590 // empty values are omitted from API requests. However, any non-pointer, 591 // non-interface field appearing in ForceSendFields will be sent to the 592 // server regardless of whether the field is empty or not. This may be 593 // used to include empty fields in Patch requests. 594 ForceSendFields []string `json:"-"` 595 596 // NullFields is a list of field names (e.g. "Groups") to include in API 597 // requests with the JSON null value. By default, fields with empty 598 // values are omitted from API requests. However, any field with an 599 // empty value appearing in NullFields will be sent to the server as 600 // null. It is an error if a field in this list has a non-empty value. 601 // This may be used to include null fields in Patch requests. 602 NullFields []string `json:"-"` 603} 604 605func (s *SearchGroupsResponse) MarshalJSON() ([]byte, error) { 606 type NoMethod SearchGroupsResponse 607 raw := NoMethod(*s) 608 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 609} 610 611// Status: The `Status` type defines a logical error model that is 612// suitable for 613// different programming environments, including REST APIs and RPC APIs. 614// It is 615// used by [gRPC](https://github.com/grpc). Each `Status` message 616// contains 617// three pieces of data: error code, error message, and error 618// details. 619// 620// You can find out more about this error model and how to work with it 621// in the 622// [API Design Guide](https://cloud.google.com/apis/design/errors). 623type Status struct { 624 // Code: The status code, which should be an enum value of 625 // google.rpc.Code. 626 Code int64 `json:"code,omitempty"` 627 628 // Details: A list of messages that carry the error details. There is a 629 // common set of 630 // message types for APIs to use. 631 Details []googleapi.RawMessage `json:"details,omitempty"` 632 633 // Message: A developer-facing error message, which should be in 634 // English. Any 635 // user-facing error message should be localized and sent in 636 // the 637 // google.rpc.Status.details field, or localized by the client. 638 Message string `json:"message,omitempty"` 639 640 // ForceSendFields is a list of field names (e.g. "Code") to 641 // unconditionally include in API requests. By default, fields with 642 // empty values are omitted from API requests. However, any non-pointer, 643 // non-interface field appearing in ForceSendFields will be sent to the 644 // server regardless of whether the field is empty or not. This may be 645 // used to include empty fields in Patch requests. 646 ForceSendFields []string `json:"-"` 647 648 // NullFields is a list of field names (e.g. "Code") to include in API 649 // requests with the JSON null value. By default, fields with empty 650 // values are omitted from API requests. However, any field with an 651 // empty value appearing in NullFields will be sent to the server as 652 // null. It is an error if a field in this list has a non-empty value. 653 // This may be used to include null fields in Patch requests. 654 NullFields []string `json:"-"` 655} 656 657func (s *Status) MarshalJSON() ([]byte, error) { 658 type NoMethod Status 659 raw := NoMethod(*s) 660 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 661} 662 663// method id "cloudidentity.groups.create": 664 665type GroupsCreateCall struct { 666 s *Service 667 group *Group 668 urlParams_ gensupport.URLParams 669 ctx_ context.Context 670 header_ http.Header 671} 672 673// Create: Creates a Group. 674func (r *GroupsService) Create(group *Group) *GroupsCreateCall { 675 c := &GroupsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 676 c.group = group 677 return c 678} 679 680// Fields allows partial responses to be retrieved. See 681// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 682// for more information. 683func (c *GroupsCreateCall) Fields(s ...googleapi.Field) *GroupsCreateCall { 684 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 685 return c 686} 687 688// Context sets the context to be used in this call's Do method. Any 689// pending HTTP request will be aborted if the provided context is 690// canceled. 691func (c *GroupsCreateCall) Context(ctx context.Context) *GroupsCreateCall { 692 c.ctx_ = ctx 693 return c 694} 695 696// Header returns an http.Header that can be modified by the caller to 697// add HTTP headers to the request. 698func (c *GroupsCreateCall) Header() http.Header { 699 if c.header_ == nil { 700 c.header_ = make(http.Header) 701 } 702 return c.header_ 703} 704 705func (c *GroupsCreateCall) doRequest(alt string) (*http.Response, error) { 706 reqHeaders := make(http.Header) 707 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 708 for k, v := range c.header_ { 709 reqHeaders[k] = v 710 } 711 reqHeaders.Set("User-Agent", c.s.userAgent()) 712 var body io.Reader = nil 713 body, err := googleapi.WithoutDataWrapper.JSONReader(c.group) 714 if err != nil { 715 return nil, err 716 } 717 reqHeaders.Set("Content-Type", "application/json") 718 c.urlParams_.Set("alt", alt) 719 c.urlParams_.Set("prettyPrint", "false") 720 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/groups") 721 urls += "?" + c.urlParams_.Encode() 722 req, err := http.NewRequest("POST", urls, body) 723 if err != nil { 724 return nil, err 725 } 726 req.Header = reqHeaders 727 return gensupport.SendRequest(c.ctx_, c.s.client, req) 728} 729 730// Do executes the "cloudidentity.groups.create" call. 731// Exactly one of *Operation or error will be non-nil. Any non-2xx 732// status code is an error. Response headers are in either 733// *Operation.ServerResponse.Header or (if a response was returned at 734// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 735// to check whether the returned error was because 736// http.StatusNotModified was returned. 737func (c *GroupsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 738 gensupport.SetOptions(c.urlParams_, opts...) 739 res, err := c.doRequest("json") 740 if res != nil && res.StatusCode == http.StatusNotModified { 741 if res.Body != nil { 742 res.Body.Close() 743 } 744 return nil, &googleapi.Error{ 745 Code: res.StatusCode, 746 Header: res.Header, 747 } 748 } 749 if err != nil { 750 return nil, err 751 } 752 defer googleapi.CloseBody(res) 753 if err := googleapi.CheckResponse(res); err != nil { 754 return nil, err 755 } 756 ret := &Operation{ 757 ServerResponse: googleapi.ServerResponse{ 758 Header: res.Header, 759 HTTPStatusCode: res.StatusCode, 760 }, 761 } 762 target := &ret 763 if err := gensupport.DecodeResponse(target, res); err != nil { 764 return nil, err 765 } 766 return ret, nil 767 // { 768 // "description": "Creates a Group.", 769 // "flatPath": "v1beta1/groups", 770 // "httpMethod": "POST", 771 // "id": "cloudidentity.groups.create", 772 // "parameterOrder": [], 773 // "parameters": {}, 774 // "path": "v1beta1/groups", 775 // "request": { 776 // "$ref": "Group" 777 // }, 778 // "response": { 779 // "$ref": "Operation" 780 // }, 781 // "scopes": [ 782 // "https://www.googleapis.com/auth/cloud-identity.groups", 783 // "https://www.googleapis.com/auth/cloud-platform" 784 // ] 785 // } 786 787} 788 789// method id "cloudidentity.groups.delete": 790 791type GroupsDeleteCall struct { 792 s *Service 793 name string 794 urlParams_ gensupport.URLParams 795 ctx_ context.Context 796 header_ http.Header 797} 798 799// Delete: Deletes a Group. 800func (r *GroupsService) Delete(name string) *GroupsDeleteCall { 801 c := &GroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 802 c.name = name 803 return c 804} 805 806// Fields allows partial responses to be retrieved. See 807// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 808// for more information. 809func (c *GroupsDeleteCall) Fields(s ...googleapi.Field) *GroupsDeleteCall { 810 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 811 return c 812} 813 814// Context sets the context to be used in this call's Do method. Any 815// pending HTTP request will be aborted if the provided context is 816// canceled. 817func (c *GroupsDeleteCall) Context(ctx context.Context) *GroupsDeleteCall { 818 c.ctx_ = ctx 819 return c 820} 821 822// Header returns an http.Header that can be modified by the caller to 823// add HTTP headers to the request. 824func (c *GroupsDeleteCall) Header() http.Header { 825 if c.header_ == nil { 826 c.header_ = make(http.Header) 827 } 828 return c.header_ 829} 830 831func (c *GroupsDeleteCall) doRequest(alt string) (*http.Response, error) { 832 reqHeaders := make(http.Header) 833 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 834 for k, v := range c.header_ { 835 reqHeaders[k] = v 836 } 837 reqHeaders.Set("User-Agent", c.s.userAgent()) 838 var body io.Reader = nil 839 c.urlParams_.Set("alt", alt) 840 c.urlParams_.Set("prettyPrint", "false") 841 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 842 urls += "?" + c.urlParams_.Encode() 843 req, err := http.NewRequest("DELETE", urls, body) 844 if err != nil { 845 return nil, err 846 } 847 req.Header = reqHeaders 848 googleapi.Expand(req.URL, map[string]string{ 849 "name": c.name, 850 }) 851 return gensupport.SendRequest(c.ctx_, c.s.client, req) 852} 853 854// Do executes the "cloudidentity.groups.delete" call. 855// Exactly one of *Operation or error will be non-nil. Any non-2xx 856// status code is an error. Response headers are in either 857// *Operation.ServerResponse.Header or (if a response was returned at 858// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 859// to check whether the returned error was because 860// http.StatusNotModified was returned. 861func (c *GroupsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 862 gensupport.SetOptions(c.urlParams_, opts...) 863 res, err := c.doRequest("json") 864 if res != nil && res.StatusCode == http.StatusNotModified { 865 if res.Body != nil { 866 res.Body.Close() 867 } 868 return nil, &googleapi.Error{ 869 Code: res.StatusCode, 870 Header: res.Header, 871 } 872 } 873 if err != nil { 874 return nil, err 875 } 876 defer googleapi.CloseBody(res) 877 if err := googleapi.CheckResponse(res); err != nil { 878 return nil, err 879 } 880 ret := &Operation{ 881 ServerResponse: googleapi.ServerResponse{ 882 Header: res.Header, 883 HTTPStatusCode: res.StatusCode, 884 }, 885 } 886 target := &ret 887 if err := gensupport.DecodeResponse(target, res); err != nil { 888 return nil, err 889 } 890 return ret, nil 891 // { 892 // "description": "Deletes a Group.", 893 // "flatPath": "v1beta1/groups/{groupsId}", 894 // "httpMethod": "DELETE", 895 // "id": "cloudidentity.groups.delete", 896 // "parameterOrder": [ 897 // "name" 898 // ], 899 // "parameters": { 900 // "name": { 901 // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup in the format: `groups/{group_id}`, where `group_id` is the unique id\nassigned to the Group.", 902 // "location": "path", 903 // "pattern": "^groups/[^/]+$", 904 // "required": true, 905 // "type": "string" 906 // } 907 // }, 908 // "path": "v1beta1/{+name}", 909 // "response": { 910 // "$ref": "Operation" 911 // }, 912 // "scopes": [ 913 // "https://www.googleapis.com/auth/cloud-identity.groups", 914 // "https://www.googleapis.com/auth/cloud-platform" 915 // ] 916 // } 917 918} 919 920// method id "cloudidentity.groups.get": 921 922type GroupsGetCall struct { 923 s *Service 924 name string 925 urlParams_ gensupport.URLParams 926 ifNoneMatch_ string 927 ctx_ context.Context 928 header_ http.Header 929} 930 931// Get: Retrieves a Group. 932func (r *GroupsService) Get(name string) *GroupsGetCall { 933 c := &GroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 934 c.name = name 935 return c 936} 937 938// Fields allows partial responses to be retrieved. See 939// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 940// for more information. 941func (c *GroupsGetCall) Fields(s ...googleapi.Field) *GroupsGetCall { 942 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 943 return c 944} 945 946// IfNoneMatch sets the optional parameter which makes the operation 947// fail if the object's ETag matches the given value. This is useful for 948// getting updates only after the object has changed since the last 949// request. Use googleapi.IsNotModified to check whether the response 950// error from Do is the result of In-None-Match. 951func (c *GroupsGetCall) IfNoneMatch(entityTag string) *GroupsGetCall { 952 c.ifNoneMatch_ = entityTag 953 return c 954} 955 956// Context sets the context to be used in this call's Do method. Any 957// pending HTTP request will be aborted if the provided context is 958// canceled. 959func (c *GroupsGetCall) Context(ctx context.Context) *GroupsGetCall { 960 c.ctx_ = ctx 961 return c 962} 963 964// Header returns an http.Header that can be modified by the caller to 965// add HTTP headers to the request. 966func (c *GroupsGetCall) Header() http.Header { 967 if c.header_ == nil { 968 c.header_ = make(http.Header) 969 } 970 return c.header_ 971} 972 973func (c *GroupsGetCall) doRequest(alt string) (*http.Response, error) { 974 reqHeaders := make(http.Header) 975 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 976 for k, v := range c.header_ { 977 reqHeaders[k] = v 978 } 979 reqHeaders.Set("User-Agent", c.s.userAgent()) 980 if c.ifNoneMatch_ != "" { 981 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 982 } 983 var body io.Reader = nil 984 c.urlParams_.Set("alt", alt) 985 c.urlParams_.Set("prettyPrint", "false") 986 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 987 urls += "?" + c.urlParams_.Encode() 988 req, err := http.NewRequest("GET", urls, body) 989 if err != nil { 990 return nil, err 991 } 992 req.Header = reqHeaders 993 googleapi.Expand(req.URL, map[string]string{ 994 "name": c.name, 995 }) 996 return gensupport.SendRequest(c.ctx_, c.s.client, req) 997} 998 999// Do executes the "cloudidentity.groups.get" call. 1000// Exactly one of *Group or error will be non-nil. Any non-2xx status 1001// code is an error. Response headers are in either 1002// *Group.ServerResponse.Header or (if a response was returned at all) 1003// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1004// check whether the returned error was because http.StatusNotModified 1005// was returned. 1006func (c *GroupsGetCall) Do(opts ...googleapi.CallOption) (*Group, error) { 1007 gensupport.SetOptions(c.urlParams_, opts...) 1008 res, err := c.doRequest("json") 1009 if res != nil && res.StatusCode == http.StatusNotModified { 1010 if res.Body != nil { 1011 res.Body.Close() 1012 } 1013 return nil, &googleapi.Error{ 1014 Code: res.StatusCode, 1015 Header: res.Header, 1016 } 1017 } 1018 if err != nil { 1019 return nil, err 1020 } 1021 defer googleapi.CloseBody(res) 1022 if err := googleapi.CheckResponse(res); err != nil { 1023 return nil, err 1024 } 1025 ret := &Group{ 1026 ServerResponse: googleapi.ServerResponse{ 1027 Header: res.Header, 1028 HTTPStatusCode: res.StatusCode, 1029 }, 1030 } 1031 target := &ret 1032 if err := gensupport.DecodeResponse(target, res); err != nil { 1033 return nil, err 1034 } 1035 return ret, nil 1036 // { 1037 // "description": "Retrieves a Group.", 1038 // "flatPath": "v1beta1/groups/{groupsId}", 1039 // "httpMethod": "GET", 1040 // "id": "cloudidentity.groups.get", 1041 // "parameterOrder": [ 1042 // "name" 1043 // ], 1044 // "parameters": { 1045 // "name": { 1046 // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup in the format: `groups/{group_id}`, where `group_id` is the unique id\nassigned to the Group.", 1047 // "location": "path", 1048 // "pattern": "^groups/[^/]+$", 1049 // "required": true, 1050 // "type": "string" 1051 // } 1052 // }, 1053 // "path": "v1beta1/{+name}", 1054 // "response": { 1055 // "$ref": "Group" 1056 // }, 1057 // "scopes": [ 1058 // "https://www.googleapis.com/auth/cloud-identity.groups", 1059 // "https://www.googleapis.com/auth/cloud-identity.groups.readonly", 1060 // "https://www.googleapis.com/auth/cloud-platform" 1061 // ] 1062 // } 1063 1064} 1065 1066// method id "cloudidentity.groups.lookup": 1067 1068type GroupsLookupCall struct { 1069 s *Service 1070 urlParams_ gensupport.URLParams 1071 ifNoneMatch_ string 1072 ctx_ context.Context 1073 header_ http.Header 1074} 1075 1076// Lookup: Looks up 1077// [resource 1078// name](https://cloud.google.com/apis/design/resource_names) of a Group 1079// by 1080// its EntityKey. 1081func (r *GroupsService) Lookup() *GroupsLookupCall { 1082 c := &GroupsLookupCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1083 return c 1084} 1085 1086// GroupKeyId sets the optional parameter "groupKey.id": The id of the 1087// entity within the given namespace. The id must be unique 1088// within its namespace. 1089func (c *GroupsLookupCall) GroupKeyId(groupKeyId string) *GroupsLookupCall { 1090 c.urlParams_.Set("groupKey.id", groupKeyId) 1091 return c 1092} 1093 1094// GroupKeyNamespace sets the optional parameter "groupKey.namespace": 1095// Namespaces provide isolation for ids, i.e an id only needs to be 1096// unique 1097// within its namespace. 1098// 1099// Namespaces are currently only created as part of IdentitySource 1100// creation 1101// from Admin Console. A namespace 1102// "identitysources/{identity_source_id}" is 1103// created corresponding to every Identity Source `identity_source_id`. 1104func (c *GroupsLookupCall) GroupKeyNamespace(groupKeyNamespace string) *GroupsLookupCall { 1105 c.urlParams_.Set("groupKey.namespace", groupKeyNamespace) 1106 return c 1107} 1108 1109// Fields allows partial responses to be retrieved. See 1110// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1111// for more information. 1112func (c *GroupsLookupCall) Fields(s ...googleapi.Field) *GroupsLookupCall { 1113 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1114 return c 1115} 1116 1117// IfNoneMatch sets the optional parameter which makes the operation 1118// fail if the object's ETag matches the given value. This is useful for 1119// getting updates only after the object has changed since the last 1120// request. Use googleapi.IsNotModified to check whether the response 1121// error from Do is the result of In-None-Match. 1122func (c *GroupsLookupCall) IfNoneMatch(entityTag string) *GroupsLookupCall { 1123 c.ifNoneMatch_ = entityTag 1124 return c 1125} 1126 1127// Context sets the context to be used in this call's Do method. Any 1128// pending HTTP request will be aborted if the provided context is 1129// canceled. 1130func (c *GroupsLookupCall) Context(ctx context.Context) *GroupsLookupCall { 1131 c.ctx_ = ctx 1132 return c 1133} 1134 1135// Header returns an http.Header that can be modified by the caller to 1136// add HTTP headers to the request. 1137func (c *GroupsLookupCall) Header() http.Header { 1138 if c.header_ == nil { 1139 c.header_ = make(http.Header) 1140 } 1141 return c.header_ 1142} 1143 1144func (c *GroupsLookupCall) doRequest(alt string) (*http.Response, error) { 1145 reqHeaders := make(http.Header) 1146 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 1147 for k, v := range c.header_ { 1148 reqHeaders[k] = v 1149 } 1150 reqHeaders.Set("User-Agent", c.s.userAgent()) 1151 if c.ifNoneMatch_ != "" { 1152 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1153 } 1154 var body io.Reader = nil 1155 c.urlParams_.Set("alt", alt) 1156 c.urlParams_.Set("prettyPrint", "false") 1157 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/groups:lookup") 1158 urls += "?" + c.urlParams_.Encode() 1159 req, err := http.NewRequest("GET", urls, body) 1160 if err != nil { 1161 return nil, err 1162 } 1163 req.Header = reqHeaders 1164 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1165} 1166 1167// Do executes the "cloudidentity.groups.lookup" call. 1168// Exactly one of *LookupGroupNameResponse or error will be non-nil. Any 1169// non-2xx status code is an error. Response headers are in either 1170// *LookupGroupNameResponse.ServerResponse.Header or (if a response was 1171// returned at all) in error.(*googleapi.Error).Header. Use 1172// googleapi.IsNotModified to check whether the returned error was 1173// because http.StatusNotModified was returned. 1174func (c *GroupsLookupCall) Do(opts ...googleapi.CallOption) (*LookupGroupNameResponse, error) { 1175 gensupport.SetOptions(c.urlParams_, opts...) 1176 res, err := c.doRequest("json") 1177 if res != nil && res.StatusCode == http.StatusNotModified { 1178 if res.Body != nil { 1179 res.Body.Close() 1180 } 1181 return nil, &googleapi.Error{ 1182 Code: res.StatusCode, 1183 Header: res.Header, 1184 } 1185 } 1186 if err != nil { 1187 return nil, err 1188 } 1189 defer googleapi.CloseBody(res) 1190 if err := googleapi.CheckResponse(res); err != nil { 1191 return nil, err 1192 } 1193 ret := &LookupGroupNameResponse{ 1194 ServerResponse: googleapi.ServerResponse{ 1195 Header: res.Header, 1196 HTTPStatusCode: res.StatusCode, 1197 }, 1198 } 1199 target := &ret 1200 if err := gensupport.DecodeResponse(target, res); err != nil { 1201 return nil, err 1202 } 1203 return ret, nil 1204 // { 1205 // "description": "Looks up [resource\nname](https://cloud.google.com/apis/design/resource_names) of a Group by\nits EntityKey.", 1206 // "flatPath": "v1beta1/groups:lookup", 1207 // "httpMethod": "GET", 1208 // "id": "cloudidentity.groups.lookup", 1209 // "parameterOrder": [], 1210 // "parameters": { 1211 // "groupKey.id": { 1212 // "description": "The id of the entity within the given namespace. The id must be unique\nwithin its namespace.", 1213 // "location": "query", 1214 // "type": "string" 1215 // }, 1216 // "groupKey.namespace": { 1217 // "description": "Namespaces provide isolation for ids, i.e an id only needs to be unique\nwithin its namespace.\n\nNamespaces are currently only created as part of IdentitySource creation\nfrom Admin Console. A namespace `\"identitysources/{identity_source_id}\"` is\ncreated corresponding to every Identity Source `identity_source_id`.", 1218 // "location": "query", 1219 // "type": "string" 1220 // } 1221 // }, 1222 // "path": "v1beta1/groups:lookup", 1223 // "response": { 1224 // "$ref": "LookupGroupNameResponse" 1225 // }, 1226 // "scopes": [ 1227 // "https://www.googleapis.com/auth/cloud-identity.groups", 1228 // "https://www.googleapis.com/auth/cloud-identity.groups.readonly", 1229 // "https://www.googleapis.com/auth/cloud-platform" 1230 // ] 1231 // } 1232 1233} 1234 1235// method id "cloudidentity.groups.patch": 1236 1237type GroupsPatchCall struct { 1238 s *Service 1239 name string 1240 group *Group 1241 urlParams_ gensupport.URLParams 1242 ctx_ context.Context 1243 header_ http.Header 1244} 1245 1246// Patch: Updates a Group. 1247func (r *GroupsService) Patch(name string, group *Group) *GroupsPatchCall { 1248 c := &GroupsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1249 c.name = name 1250 c.group = group 1251 return c 1252} 1253 1254// UpdateMask sets the optional parameter "updateMask": Editable fields: 1255// `display_name`, `description` 1256func (c *GroupsPatchCall) UpdateMask(updateMask string) *GroupsPatchCall { 1257 c.urlParams_.Set("updateMask", updateMask) 1258 return c 1259} 1260 1261// Fields allows partial responses to be retrieved. See 1262// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1263// for more information. 1264func (c *GroupsPatchCall) Fields(s ...googleapi.Field) *GroupsPatchCall { 1265 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1266 return c 1267} 1268 1269// Context sets the context to be used in this call's Do method. Any 1270// pending HTTP request will be aborted if the provided context is 1271// canceled. 1272func (c *GroupsPatchCall) Context(ctx context.Context) *GroupsPatchCall { 1273 c.ctx_ = ctx 1274 return c 1275} 1276 1277// Header returns an http.Header that can be modified by the caller to 1278// add HTTP headers to the request. 1279func (c *GroupsPatchCall) Header() http.Header { 1280 if c.header_ == nil { 1281 c.header_ = make(http.Header) 1282 } 1283 return c.header_ 1284} 1285 1286func (c *GroupsPatchCall) doRequest(alt string) (*http.Response, error) { 1287 reqHeaders := make(http.Header) 1288 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 1289 for k, v := range c.header_ { 1290 reqHeaders[k] = v 1291 } 1292 reqHeaders.Set("User-Agent", c.s.userAgent()) 1293 var body io.Reader = nil 1294 body, err := googleapi.WithoutDataWrapper.JSONReader(c.group) 1295 if err != nil { 1296 return nil, err 1297 } 1298 reqHeaders.Set("Content-Type", "application/json") 1299 c.urlParams_.Set("alt", alt) 1300 c.urlParams_.Set("prettyPrint", "false") 1301 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1302 urls += "?" + c.urlParams_.Encode() 1303 req, err := http.NewRequest("PATCH", urls, body) 1304 if err != nil { 1305 return nil, err 1306 } 1307 req.Header = reqHeaders 1308 googleapi.Expand(req.URL, map[string]string{ 1309 "name": c.name, 1310 }) 1311 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1312} 1313 1314// Do executes the "cloudidentity.groups.patch" call. 1315// Exactly one of *Operation or error will be non-nil. Any non-2xx 1316// status code is an error. Response headers are in either 1317// *Operation.ServerResponse.Header or (if a response was returned at 1318// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1319// to check whether the returned error was because 1320// http.StatusNotModified was returned. 1321func (c *GroupsPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1322 gensupport.SetOptions(c.urlParams_, opts...) 1323 res, err := c.doRequest("json") 1324 if res != nil && res.StatusCode == http.StatusNotModified { 1325 if res.Body != nil { 1326 res.Body.Close() 1327 } 1328 return nil, &googleapi.Error{ 1329 Code: res.StatusCode, 1330 Header: res.Header, 1331 } 1332 } 1333 if err != nil { 1334 return nil, err 1335 } 1336 defer googleapi.CloseBody(res) 1337 if err := googleapi.CheckResponse(res); err != nil { 1338 return nil, err 1339 } 1340 ret := &Operation{ 1341 ServerResponse: googleapi.ServerResponse{ 1342 Header: res.Header, 1343 HTTPStatusCode: res.StatusCode, 1344 }, 1345 } 1346 target := &ret 1347 if err := gensupport.DecodeResponse(target, res); err != nil { 1348 return nil, err 1349 } 1350 return ret, nil 1351 // { 1352 // "description": "Updates a Group.", 1353 // "flatPath": "v1beta1/groups/{groupsId}", 1354 // "httpMethod": "PATCH", 1355 // "id": "cloudidentity.groups.patch", 1356 // "parameterOrder": [ 1357 // "name" 1358 // ], 1359 // "parameters": { 1360 // "name": { 1361 // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup in the format: `groups/{group_id}`, where group_id is the unique id\nassigned to the Group.\n\nMust be left blank while creating a Group", 1362 // "location": "path", 1363 // "pattern": "^groups/[^/]+$", 1364 // "required": true, 1365 // "type": "string" 1366 // }, 1367 // "updateMask": { 1368 // "description": "Editable fields: `display_name`, `description`", 1369 // "format": "google-fieldmask", 1370 // "location": "query", 1371 // "type": "string" 1372 // } 1373 // }, 1374 // "path": "v1beta1/{+name}", 1375 // "request": { 1376 // "$ref": "Group" 1377 // }, 1378 // "response": { 1379 // "$ref": "Operation" 1380 // }, 1381 // "scopes": [ 1382 // "https://www.googleapis.com/auth/cloud-identity.groups", 1383 // "https://www.googleapis.com/auth/cloud-platform" 1384 // ] 1385 // } 1386 1387} 1388 1389// method id "cloudidentity.groups.search": 1390 1391type GroupsSearchCall struct { 1392 s *Service 1393 urlParams_ gensupport.URLParams 1394 ifNoneMatch_ string 1395 ctx_ context.Context 1396 header_ http.Header 1397} 1398 1399// Search: Searches for Groups. 1400func (r *GroupsService) Search() *GroupsSearchCall { 1401 c := &GroupsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1402 return c 1403} 1404 1405// PageSize sets the optional parameter "pageSize": The default page 1406// size is 200 (max 1000) for the BASIC view, and 50 1407// (max 500) for the FULL view. 1408func (c *GroupsSearchCall) PageSize(pageSize int64) *GroupsSearchCall { 1409 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1410 return c 1411} 1412 1413// PageToken sets the optional parameter "pageToken": The 1414// next_page_token value returned from a previous search request, if 1415// any. 1416func (c *GroupsSearchCall) PageToken(pageToken string) *GroupsSearchCall { 1417 c.urlParams_.Set("pageToken", pageToken) 1418 return c 1419} 1420 1421// Query sets the optional parameter "query": Query string for 1422// performing search on groups. 1423// Users can search on namespace and label attributes of groups. 1424// EXACT match ('=') is supported on namespace, and CONTAINS match (':') 1425// is 1426// supported on labels. This is a `required` field. 1427// Multiple queries can be combined using `AND` operator. The operator 1428// is case 1429// sensitive. 1430// An example query would be: 1431// "namespace=<namespace_value> AND labels:<labels_value>". 1432func (c *GroupsSearchCall) Query(query string) *GroupsSearchCall { 1433 c.urlParams_.Set("query", query) 1434 return c 1435} 1436 1437// View sets the optional parameter "view": Group resource view to be 1438// returned. Defaults to [GroupView.BASIC](). 1439// 1440// Possible values: 1441// "BASIC" 1442// "FULL" 1443func (c *GroupsSearchCall) View(view string) *GroupsSearchCall { 1444 c.urlParams_.Set("view", view) 1445 return c 1446} 1447 1448// Fields allows partial responses to be retrieved. See 1449// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1450// for more information. 1451func (c *GroupsSearchCall) Fields(s ...googleapi.Field) *GroupsSearchCall { 1452 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1453 return c 1454} 1455 1456// IfNoneMatch sets the optional parameter which makes the operation 1457// fail if the object's ETag matches the given value. This is useful for 1458// getting updates only after the object has changed since the last 1459// request. Use googleapi.IsNotModified to check whether the response 1460// error from Do is the result of In-None-Match. 1461func (c *GroupsSearchCall) IfNoneMatch(entityTag string) *GroupsSearchCall { 1462 c.ifNoneMatch_ = entityTag 1463 return c 1464} 1465 1466// Context sets the context to be used in this call's Do method. Any 1467// pending HTTP request will be aborted if the provided context is 1468// canceled. 1469func (c *GroupsSearchCall) Context(ctx context.Context) *GroupsSearchCall { 1470 c.ctx_ = ctx 1471 return c 1472} 1473 1474// Header returns an http.Header that can be modified by the caller to 1475// add HTTP headers to the request. 1476func (c *GroupsSearchCall) Header() http.Header { 1477 if c.header_ == nil { 1478 c.header_ = make(http.Header) 1479 } 1480 return c.header_ 1481} 1482 1483func (c *GroupsSearchCall) doRequest(alt string) (*http.Response, error) { 1484 reqHeaders := make(http.Header) 1485 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 1486 for k, v := range c.header_ { 1487 reqHeaders[k] = v 1488 } 1489 reqHeaders.Set("User-Agent", c.s.userAgent()) 1490 if c.ifNoneMatch_ != "" { 1491 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1492 } 1493 var body io.Reader = nil 1494 c.urlParams_.Set("alt", alt) 1495 c.urlParams_.Set("prettyPrint", "false") 1496 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/groups:search") 1497 urls += "?" + c.urlParams_.Encode() 1498 req, err := http.NewRequest("GET", urls, body) 1499 if err != nil { 1500 return nil, err 1501 } 1502 req.Header = reqHeaders 1503 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1504} 1505 1506// Do executes the "cloudidentity.groups.search" call. 1507// Exactly one of *SearchGroupsResponse or error will be non-nil. Any 1508// non-2xx status code is an error. Response headers are in either 1509// *SearchGroupsResponse.ServerResponse.Header or (if a response was 1510// returned at all) in error.(*googleapi.Error).Header. Use 1511// googleapi.IsNotModified to check whether the returned error was 1512// because http.StatusNotModified was returned. 1513func (c *GroupsSearchCall) Do(opts ...googleapi.CallOption) (*SearchGroupsResponse, error) { 1514 gensupport.SetOptions(c.urlParams_, opts...) 1515 res, err := c.doRequest("json") 1516 if res != nil && res.StatusCode == http.StatusNotModified { 1517 if res.Body != nil { 1518 res.Body.Close() 1519 } 1520 return nil, &googleapi.Error{ 1521 Code: res.StatusCode, 1522 Header: res.Header, 1523 } 1524 } 1525 if err != nil { 1526 return nil, err 1527 } 1528 defer googleapi.CloseBody(res) 1529 if err := googleapi.CheckResponse(res); err != nil { 1530 return nil, err 1531 } 1532 ret := &SearchGroupsResponse{ 1533 ServerResponse: googleapi.ServerResponse{ 1534 Header: res.Header, 1535 HTTPStatusCode: res.StatusCode, 1536 }, 1537 } 1538 target := &ret 1539 if err := gensupport.DecodeResponse(target, res); err != nil { 1540 return nil, err 1541 } 1542 return ret, nil 1543 // { 1544 // "description": "Searches for Groups.", 1545 // "flatPath": "v1beta1/groups:search", 1546 // "httpMethod": "GET", 1547 // "id": "cloudidentity.groups.search", 1548 // "parameterOrder": [], 1549 // "parameters": { 1550 // "pageSize": { 1551 // "description": "The default page size is 200 (max 1000) for the BASIC view, and 50\n(max 500) for the FULL view.", 1552 // "format": "int32", 1553 // "location": "query", 1554 // "type": "integer" 1555 // }, 1556 // "pageToken": { 1557 // "description": "The next_page_token value returned from a previous search request, if any.", 1558 // "location": "query", 1559 // "type": "string" 1560 // }, 1561 // "query": { 1562 // "description": "Query string for performing search on groups.\nUsers can search on namespace and label attributes of groups.\nEXACT match ('=') is supported on namespace, and CONTAINS match (':') is\nsupported on labels. This is a `required` field.\nMultiple queries can be combined using `AND` operator. The operator is case\nsensitive.\nAn example query would be:\n\"namespace=\u003cnamespace_value\u003e AND labels:\u003clabels_value\u003e\".", 1563 // "location": "query", 1564 // "type": "string" 1565 // }, 1566 // "view": { 1567 // "description": "Group resource view to be returned. Defaults to [GroupView.BASIC]().", 1568 // "enum": [ 1569 // "BASIC", 1570 // "FULL" 1571 // ], 1572 // "location": "query", 1573 // "type": "string" 1574 // } 1575 // }, 1576 // "path": "v1beta1/groups:search", 1577 // "response": { 1578 // "$ref": "SearchGroupsResponse" 1579 // }, 1580 // "scopes": [ 1581 // "https://www.googleapis.com/auth/cloud-identity.groups", 1582 // "https://www.googleapis.com/auth/cloud-identity.groups.readonly", 1583 // "https://www.googleapis.com/auth/cloud-platform" 1584 // ] 1585 // } 1586 1587} 1588 1589// Pages invokes f for each page of results. 1590// A non-nil error returned from f will halt the iteration. 1591// The provided context supersedes any context provided to the Context method. 1592func (c *GroupsSearchCall) Pages(ctx context.Context, f func(*SearchGroupsResponse) error) error { 1593 c.ctx_ = ctx 1594 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1595 for { 1596 x, err := c.Do() 1597 if err != nil { 1598 return err 1599 } 1600 if err := f(x); err != nil { 1601 return err 1602 } 1603 if x.NextPageToken == "" { 1604 return nil 1605 } 1606 c.PageToken(x.NextPageToken) 1607 } 1608} 1609 1610// method id "cloudidentity.groups.memberships.create": 1611 1612type GroupsMembershipsCreateCall struct { 1613 s *Service 1614 parent string 1615 membership *Membership 1616 urlParams_ gensupport.URLParams 1617 ctx_ context.Context 1618 header_ http.Header 1619} 1620 1621// Create: Creates a Membership. 1622func (r *GroupsMembershipsService) Create(parent string, membership *Membership) *GroupsMembershipsCreateCall { 1623 c := &GroupsMembershipsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1624 c.parent = parent 1625 c.membership = membership 1626 return c 1627} 1628 1629// Fields allows partial responses to be retrieved. See 1630// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1631// for more information. 1632func (c *GroupsMembershipsCreateCall) Fields(s ...googleapi.Field) *GroupsMembershipsCreateCall { 1633 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1634 return c 1635} 1636 1637// Context sets the context to be used in this call's Do method. Any 1638// pending HTTP request will be aborted if the provided context is 1639// canceled. 1640func (c *GroupsMembershipsCreateCall) Context(ctx context.Context) *GroupsMembershipsCreateCall { 1641 c.ctx_ = ctx 1642 return c 1643} 1644 1645// Header returns an http.Header that can be modified by the caller to 1646// add HTTP headers to the request. 1647func (c *GroupsMembershipsCreateCall) Header() http.Header { 1648 if c.header_ == nil { 1649 c.header_ = make(http.Header) 1650 } 1651 return c.header_ 1652} 1653 1654func (c *GroupsMembershipsCreateCall) doRequest(alt string) (*http.Response, error) { 1655 reqHeaders := make(http.Header) 1656 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 1657 for k, v := range c.header_ { 1658 reqHeaders[k] = v 1659 } 1660 reqHeaders.Set("User-Agent", c.s.userAgent()) 1661 var body io.Reader = nil 1662 body, err := googleapi.WithoutDataWrapper.JSONReader(c.membership) 1663 if err != nil { 1664 return nil, err 1665 } 1666 reqHeaders.Set("Content-Type", "application/json") 1667 c.urlParams_.Set("alt", alt) 1668 c.urlParams_.Set("prettyPrint", "false") 1669 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/memberships") 1670 urls += "?" + c.urlParams_.Encode() 1671 req, err := http.NewRequest("POST", urls, body) 1672 if err != nil { 1673 return nil, err 1674 } 1675 req.Header = reqHeaders 1676 googleapi.Expand(req.URL, map[string]string{ 1677 "parent": c.parent, 1678 }) 1679 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1680} 1681 1682// Do executes the "cloudidentity.groups.memberships.create" call. 1683// Exactly one of *Operation or error will be non-nil. Any non-2xx 1684// status code is an error. Response headers are in either 1685// *Operation.ServerResponse.Header or (if a response was returned at 1686// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1687// to check whether the returned error was because 1688// http.StatusNotModified was returned. 1689func (c *GroupsMembershipsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1690 gensupport.SetOptions(c.urlParams_, opts...) 1691 res, err := c.doRequest("json") 1692 if res != nil && res.StatusCode == http.StatusNotModified { 1693 if res.Body != nil { 1694 res.Body.Close() 1695 } 1696 return nil, &googleapi.Error{ 1697 Code: res.StatusCode, 1698 Header: res.Header, 1699 } 1700 } 1701 if err != nil { 1702 return nil, err 1703 } 1704 defer googleapi.CloseBody(res) 1705 if err := googleapi.CheckResponse(res); err != nil { 1706 return nil, err 1707 } 1708 ret := &Operation{ 1709 ServerResponse: googleapi.ServerResponse{ 1710 Header: res.Header, 1711 HTTPStatusCode: res.StatusCode, 1712 }, 1713 } 1714 target := &ret 1715 if err := gensupport.DecodeResponse(target, res); err != nil { 1716 return nil, err 1717 } 1718 return ret, nil 1719 // { 1720 // "description": "Creates a Membership.", 1721 // "flatPath": "v1beta1/groups/{groupsId}/memberships", 1722 // "httpMethod": "POST", 1723 // "id": "cloudidentity.groups.memberships.create", 1724 // "parameterOrder": [ 1725 // "parent" 1726 // ], 1727 // "parameters": { 1728 // "parent": { 1729 // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup to create Membership within. Format: `groups/{group_id}`, where\n`group_id` is the unique id assigned to the Group.", 1730 // "location": "path", 1731 // "pattern": "^groups/[^/]+$", 1732 // "required": true, 1733 // "type": "string" 1734 // } 1735 // }, 1736 // "path": "v1beta1/{+parent}/memberships", 1737 // "request": { 1738 // "$ref": "Membership" 1739 // }, 1740 // "response": { 1741 // "$ref": "Operation" 1742 // }, 1743 // "scopes": [ 1744 // "https://www.googleapis.com/auth/cloud-identity.groups", 1745 // "https://www.googleapis.com/auth/cloud-platform" 1746 // ] 1747 // } 1748 1749} 1750 1751// method id "cloudidentity.groups.memberships.delete": 1752 1753type GroupsMembershipsDeleteCall struct { 1754 s *Service 1755 name string 1756 urlParams_ gensupport.URLParams 1757 ctx_ context.Context 1758 header_ http.Header 1759} 1760 1761// Delete: Deletes a Membership. 1762func (r *GroupsMembershipsService) Delete(name string) *GroupsMembershipsDeleteCall { 1763 c := &GroupsMembershipsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1764 c.name = name 1765 return c 1766} 1767 1768// Fields allows partial responses to be retrieved. See 1769// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1770// for more information. 1771func (c *GroupsMembershipsDeleteCall) Fields(s ...googleapi.Field) *GroupsMembershipsDeleteCall { 1772 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1773 return c 1774} 1775 1776// Context sets the context to be used in this call's Do method. Any 1777// pending HTTP request will be aborted if the provided context is 1778// canceled. 1779func (c *GroupsMembershipsDeleteCall) Context(ctx context.Context) *GroupsMembershipsDeleteCall { 1780 c.ctx_ = ctx 1781 return c 1782} 1783 1784// Header returns an http.Header that can be modified by the caller to 1785// add HTTP headers to the request. 1786func (c *GroupsMembershipsDeleteCall) Header() http.Header { 1787 if c.header_ == nil { 1788 c.header_ = make(http.Header) 1789 } 1790 return c.header_ 1791} 1792 1793func (c *GroupsMembershipsDeleteCall) doRequest(alt string) (*http.Response, error) { 1794 reqHeaders := make(http.Header) 1795 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 1796 for k, v := range c.header_ { 1797 reqHeaders[k] = v 1798 } 1799 reqHeaders.Set("User-Agent", c.s.userAgent()) 1800 var body io.Reader = nil 1801 c.urlParams_.Set("alt", alt) 1802 c.urlParams_.Set("prettyPrint", "false") 1803 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1804 urls += "?" + c.urlParams_.Encode() 1805 req, err := http.NewRequest("DELETE", urls, body) 1806 if err != nil { 1807 return nil, err 1808 } 1809 req.Header = reqHeaders 1810 googleapi.Expand(req.URL, map[string]string{ 1811 "name": c.name, 1812 }) 1813 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1814} 1815 1816// Do executes the "cloudidentity.groups.memberships.delete" call. 1817// Exactly one of *Operation or error will be non-nil. Any non-2xx 1818// status code is an error. Response headers are in either 1819// *Operation.ServerResponse.Header or (if a response was returned at 1820// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1821// to check whether the returned error was because 1822// http.StatusNotModified was returned. 1823func (c *GroupsMembershipsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1824 gensupport.SetOptions(c.urlParams_, opts...) 1825 res, err := c.doRequest("json") 1826 if res != nil && res.StatusCode == http.StatusNotModified { 1827 if res.Body != nil { 1828 res.Body.Close() 1829 } 1830 return nil, &googleapi.Error{ 1831 Code: res.StatusCode, 1832 Header: res.Header, 1833 } 1834 } 1835 if err != nil { 1836 return nil, err 1837 } 1838 defer googleapi.CloseBody(res) 1839 if err := googleapi.CheckResponse(res); err != nil { 1840 return nil, err 1841 } 1842 ret := &Operation{ 1843 ServerResponse: googleapi.ServerResponse{ 1844 Header: res.Header, 1845 HTTPStatusCode: res.StatusCode, 1846 }, 1847 } 1848 target := &ret 1849 if err := gensupport.DecodeResponse(target, res); err != nil { 1850 return nil, err 1851 } 1852 return ret, nil 1853 // { 1854 // "description": "Deletes a Membership.", 1855 // "flatPath": "v1beta1/groups/{groupsId}/memberships/{membershipsId}", 1856 // "httpMethod": "DELETE", 1857 // "id": "cloudidentity.groups.memberships.delete", 1858 // "parameterOrder": [ 1859 // "name" 1860 // ], 1861 // "parameters": { 1862 // "name": { 1863 // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nMembership to be deleted.\n\nFormat: `groups/{group_id}/memberships/{member_id}`, where `group_id` is\nthe unique id assigned to the Group to which Membership belongs to, and\nmember_id is the unique id assigned to the member.", 1864 // "location": "path", 1865 // "pattern": "^groups/[^/]+/memberships/[^/]+$", 1866 // "required": true, 1867 // "type": "string" 1868 // } 1869 // }, 1870 // "path": "v1beta1/{+name}", 1871 // "response": { 1872 // "$ref": "Operation" 1873 // }, 1874 // "scopes": [ 1875 // "https://www.googleapis.com/auth/cloud-identity.groups", 1876 // "https://www.googleapis.com/auth/cloud-platform" 1877 // ] 1878 // } 1879 1880} 1881 1882// method id "cloudidentity.groups.memberships.get": 1883 1884type GroupsMembershipsGetCall struct { 1885 s *Service 1886 name string 1887 urlParams_ gensupport.URLParams 1888 ifNoneMatch_ string 1889 ctx_ context.Context 1890 header_ http.Header 1891} 1892 1893// Get: Retrieves a Membership. 1894func (r *GroupsMembershipsService) Get(name string) *GroupsMembershipsGetCall { 1895 c := &GroupsMembershipsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1896 c.name = name 1897 return c 1898} 1899 1900// Fields allows partial responses to be retrieved. See 1901// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1902// for more information. 1903func (c *GroupsMembershipsGetCall) Fields(s ...googleapi.Field) *GroupsMembershipsGetCall { 1904 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1905 return c 1906} 1907 1908// IfNoneMatch sets the optional parameter which makes the operation 1909// fail if the object's ETag matches the given value. This is useful for 1910// getting updates only after the object has changed since the last 1911// request. Use googleapi.IsNotModified to check whether the response 1912// error from Do is the result of In-None-Match. 1913func (c *GroupsMembershipsGetCall) IfNoneMatch(entityTag string) *GroupsMembershipsGetCall { 1914 c.ifNoneMatch_ = entityTag 1915 return c 1916} 1917 1918// Context sets the context to be used in this call's Do method. Any 1919// pending HTTP request will be aborted if the provided context is 1920// canceled. 1921func (c *GroupsMembershipsGetCall) Context(ctx context.Context) *GroupsMembershipsGetCall { 1922 c.ctx_ = ctx 1923 return c 1924} 1925 1926// Header returns an http.Header that can be modified by the caller to 1927// add HTTP headers to the request. 1928func (c *GroupsMembershipsGetCall) Header() http.Header { 1929 if c.header_ == nil { 1930 c.header_ = make(http.Header) 1931 } 1932 return c.header_ 1933} 1934 1935func (c *GroupsMembershipsGetCall) doRequest(alt string) (*http.Response, error) { 1936 reqHeaders := make(http.Header) 1937 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 1938 for k, v := range c.header_ { 1939 reqHeaders[k] = v 1940 } 1941 reqHeaders.Set("User-Agent", c.s.userAgent()) 1942 if c.ifNoneMatch_ != "" { 1943 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1944 } 1945 var body io.Reader = nil 1946 c.urlParams_.Set("alt", alt) 1947 c.urlParams_.Set("prettyPrint", "false") 1948 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1949 urls += "?" + c.urlParams_.Encode() 1950 req, err := http.NewRequest("GET", urls, body) 1951 if err != nil { 1952 return nil, err 1953 } 1954 req.Header = reqHeaders 1955 googleapi.Expand(req.URL, map[string]string{ 1956 "name": c.name, 1957 }) 1958 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1959} 1960 1961// Do executes the "cloudidentity.groups.memberships.get" call. 1962// Exactly one of *Membership or error will be non-nil. Any non-2xx 1963// status code is an error. Response headers are in either 1964// *Membership.ServerResponse.Header or (if a response was returned at 1965// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1966// to check whether the returned error was because 1967// http.StatusNotModified was returned. 1968func (c *GroupsMembershipsGetCall) Do(opts ...googleapi.CallOption) (*Membership, error) { 1969 gensupport.SetOptions(c.urlParams_, opts...) 1970 res, err := c.doRequest("json") 1971 if res != nil && res.StatusCode == http.StatusNotModified { 1972 if res.Body != nil { 1973 res.Body.Close() 1974 } 1975 return nil, &googleapi.Error{ 1976 Code: res.StatusCode, 1977 Header: res.Header, 1978 } 1979 } 1980 if err != nil { 1981 return nil, err 1982 } 1983 defer googleapi.CloseBody(res) 1984 if err := googleapi.CheckResponse(res); err != nil { 1985 return nil, err 1986 } 1987 ret := &Membership{ 1988 ServerResponse: googleapi.ServerResponse{ 1989 Header: res.Header, 1990 HTTPStatusCode: res.StatusCode, 1991 }, 1992 } 1993 target := &ret 1994 if err := gensupport.DecodeResponse(target, res); err != nil { 1995 return nil, err 1996 } 1997 return ret, nil 1998 // { 1999 // "description": "Retrieves a Membership.", 2000 // "flatPath": "v1beta1/groups/{groupsId}/memberships/{membershipsId}", 2001 // "httpMethod": "GET", 2002 // "id": "cloudidentity.groups.memberships.get", 2003 // "parameterOrder": [ 2004 // "name" 2005 // ], 2006 // "parameters": { 2007 // "name": { 2008 // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nMembership to be retrieved.\n\nFormat: `groups/{group_id}/memberships/{member_id}`, where `group_id` is\nthe unique id assigned to the Group to which Membership belongs to, and\n`member_id` is the unique id assigned to the member.", 2009 // "location": "path", 2010 // "pattern": "^groups/[^/]+/memberships/[^/]+$", 2011 // "required": true, 2012 // "type": "string" 2013 // } 2014 // }, 2015 // "path": "v1beta1/{+name}", 2016 // "response": { 2017 // "$ref": "Membership" 2018 // }, 2019 // "scopes": [ 2020 // "https://www.googleapis.com/auth/cloud-identity.groups", 2021 // "https://www.googleapis.com/auth/cloud-identity.groups.readonly", 2022 // "https://www.googleapis.com/auth/cloud-platform" 2023 // ] 2024 // } 2025 2026} 2027 2028// method id "cloudidentity.groups.memberships.list": 2029 2030type GroupsMembershipsListCall struct { 2031 s *Service 2032 parent string 2033 urlParams_ gensupport.URLParams 2034 ifNoneMatch_ string 2035 ctx_ context.Context 2036 header_ http.Header 2037} 2038 2039// List: List Memberships within a Group. 2040func (r *GroupsMembershipsService) List(parent string) *GroupsMembershipsListCall { 2041 c := &GroupsMembershipsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2042 c.parent = parent 2043 return c 2044} 2045 2046// PageSize sets the optional parameter "pageSize": The default page 2047// size is 200 (max 1000) for the BASIC view, and 50 2048// (max 500) for the FULL view. 2049func (c *GroupsMembershipsListCall) PageSize(pageSize int64) *GroupsMembershipsListCall { 2050 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2051 return c 2052} 2053 2054// PageToken sets the optional parameter "pageToken": The 2055// next_page_token value returned from a previous list request, if any 2056func (c *GroupsMembershipsListCall) PageToken(pageToken string) *GroupsMembershipsListCall { 2057 c.urlParams_.Set("pageToken", pageToken) 2058 return c 2059} 2060 2061// View sets the optional parameter "view": Membership resource view to 2062// be returned. Defaults to MembershipView.BASIC. 2063// 2064// Possible values: 2065// "BASIC" 2066// "FULL" 2067func (c *GroupsMembershipsListCall) View(view string) *GroupsMembershipsListCall { 2068 c.urlParams_.Set("view", view) 2069 return c 2070} 2071 2072// Fields allows partial responses to be retrieved. See 2073// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2074// for more information. 2075func (c *GroupsMembershipsListCall) Fields(s ...googleapi.Field) *GroupsMembershipsListCall { 2076 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2077 return c 2078} 2079 2080// IfNoneMatch sets the optional parameter which makes the operation 2081// fail if the object's ETag matches the given value. This is useful for 2082// getting updates only after the object has changed since the last 2083// request. Use googleapi.IsNotModified to check whether the response 2084// error from Do is the result of In-None-Match. 2085func (c *GroupsMembershipsListCall) IfNoneMatch(entityTag string) *GroupsMembershipsListCall { 2086 c.ifNoneMatch_ = entityTag 2087 return c 2088} 2089 2090// Context sets the context to be used in this call's Do method. Any 2091// pending HTTP request will be aborted if the provided context is 2092// canceled. 2093func (c *GroupsMembershipsListCall) Context(ctx context.Context) *GroupsMembershipsListCall { 2094 c.ctx_ = ctx 2095 return c 2096} 2097 2098// Header returns an http.Header that can be modified by the caller to 2099// add HTTP headers to the request. 2100func (c *GroupsMembershipsListCall) Header() http.Header { 2101 if c.header_ == nil { 2102 c.header_ = make(http.Header) 2103 } 2104 return c.header_ 2105} 2106 2107func (c *GroupsMembershipsListCall) doRequest(alt string) (*http.Response, error) { 2108 reqHeaders := make(http.Header) 2109 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 2110 for k, v := range c.header_ { 2111 reqHeaders[k] = v 2112 } 2113 reqHeaders.Set("User-Agent", c.s.userAgent()) 2114 if c.ifNoneMatch_ != "" { 2115 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2116 } 2117 var body io.Reader = nil 2118 c.urlParams_.Set("alt", alt) 2119 c.urlParams_.Set("prettyPrint", "false") 2120 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/memberships") 2121 urls += "?" + c.urlParams_.Encode() 2122 req, err := http.NewRequest("GET", urls, body) 2123 if err != nil { 2124 return nil, err 2125 } 2126 req.Header = reqHeaders 2127 googleapi.Expand(req.URL, map[string]string{ 2128 "parent": c.parent, 2129 }) 2130 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2131} 2132 2133// Do executes the "cloudidentity.groups.memberships.list" call. 2134// Exactly one of *ListMembershipsResponse or error will be non-nil. Any 2135// non-2xx status code is an error. Response headers are in either 2136// *ListMembershipsResponse.ServerResponse.Header or (if a response was 2137// returned at all) in error.(*googleapi.Error).Header. Use 2138// googleapi.IsNotModified to check whether the returned error was 2139// because http.StatusNotModified was returned. 2140func (c *GroupsMembershipsListCall) Do(opts ...googleapi.CallOption) (*ListMembershipsResponse, error) { 2141 gensupport.SetOptions(c.urlParams_, opts...) 2142 res, err := c.doRequest("json") 2143 if res != nil && res.StatusCode == http.StatusNotModified { 2144 if res.Body != nil { 2145 res.Body.Close() 2146 } 2147 return nil, &googleapi.Error{ 2148 Code: res.StatusCode, 2149 Header: res.Header, 2150 } 2151 } 2152 if err != nil { 2153 return nil, err 2154 } 2155 defer googleapi.CloseBody(res) 2156 if err := googleapi.CheckResponse(res); err != nil { 2157 return nil, err 2158 } 2159 ret := &ListMembershipsResponse{ 2160 ServerResponse: googleapi.ServerResponse{ 2161 Header: res.Header, 2162 HTTPStatusCode: res.StatusCode, 2163 }, 2164 } 2165 target := &ret 2166 if err := gensupport.DecodeResponse(target, res); err != nil { 2167 return nil, err 2168 } 2169 return ret, nil 2170 // { 2171 // "description": "List Memberships within a Group.", 2172 // "flatPath": "v1beta1/groups/{groupsId}/memberships", 2173 // "httpMethod": "GET", 2174 // "id": "cloudidentity.groups.memberships.list", 2175 // "parameterOrder": [ 2176 // "parent" 2177 // ], 2178 // "parameters": { 2179 // "pageSize": { 2180 // "description": "The default page size is 200 (max 1000) for the BASIC view, and 50\n(max 500) for the FULL view.", 2181 // "format": "int32", 2182 // "location": "query", 2183 // "type": "integer" 2184 // }, 2185 // "pageToken": { 2186 // "description": "The next_page_token value returned from a previous list request, if any", 2187 // "location": "query", 2188 // "type": "string" 2189 // }, 2190 // "parent": { 2191 // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup to list Memberships within.\n\nFormat: `groups/{group_id}`, where `group_id` is the unique id assigned to\nthe Group.", 2192 // "location": "path", 2193 // "pattern": "^groups/[^/]+$", 2194 // "required": true, 2195 // "type": "string" 2196 // }, 2197 // "view": { 2198 // "description": "Membership resource view to be returned. Defaults to MembershipView.BASIC.", 2199 // "enum": [ 2200 // "BASIC", 2201 // "FULL" 2202 // ], 2203 // "location": "query", 2204 // "type": "string" 2205 // } 2206 // }, 2207 // "path": "v1beta1/{+parent}/memberships", 2208 // "response": { 2209 // "$ref": "ListMembershipsResponse" 2210 // }, 2211 // "scopes": [ 2212 // "https://www.googleapis.com/auth/cloud-identity.groups", 2213 // "https://www.googleapis.com/auth/cloud-identity.groups.readonly", 2214 // "https://www.googleapis.com/auth/cloud-platform" 2215 // ] 2216 // } 2217 2218} 2219 2220// Pages invokes f for each page of results. 2221// A non-nil error returned from f will halt the iteration. 2222// The provided context supersedes any context provided to the Context method. 2223func (c *GroupsMembershipsListCall) Pages(ctx context.Context, f func(*ListMembershipsResponse) error) error { 2224 c.ctx_ = ctx 2225 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2226 for { 2227 x, err := c.Do() 2228 if err != nil { 2229 return err 2230 } 2231 if err := f(x); err != nil { 2232 return err 2233 } 2234 if x.NextPageToken == "" { 2235 return nil 2236 } 2237 c.PageToken(x.NextPageToken) 2238 } 2239} 2240 2241// method id "cloudidentity.groups.memberships.lookup": 2242 2243type GroupsMembershipsLookupCall struct { 2244 s *Service 2245 parent string 2246 urlParams_ gensupport.URLParams 2247 ifNoneMatch_ string 2248 ctx_ context.Context 2249 header_ http.Header 2250} 2251 2252// Lookup: Looks up 2253// [resource 2254// name](https://cloud.google.com/apis/design/resource_names) of a 2255// Membership 2256// within a Group by member's EntityKey. 2257func (r *GroupsMembershipsService) Lookup(parent string) *GroupsMembershipsLookupCall { 2258 c := &GroupsMembershipsLookupCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2259 c.parent = parent 2260 return c 2261} 2262 2263// MemberKeyId sets the optional parameter "memberKey.id": The id of the 2264// entity within the given namespace. The id must be unique 2265// within its namespace. 2266func (c *GroupsMembershipsLookupCall) MemberKeyId(memberKeyId string) *GroupsMembershipsLookupCall { 2267 c.urlParams_.Set("memberKey.id", memberKeyId) 2268 return c 2269} 2270 2271// MemberKeyNamespace sets the optional parameter "memberKey.namespace": 2272// Namespaces provide isolation for ids, i.e an id only needs to be 2273// unique 2274// within its namespace. 2275// 2276// Namespaces are currently only created as part of IdentitySource 2277// creation 2278// from Admin Console. A namespace 2279// "identitysources/{identity_source_id}" is 2280// created corresponding to every Identity Source `identity_source_id`. 2281func (c *GroupsMembershipsLookupCall) MemberKeyNamespace(memberKeyNamespace string) *GroupsMembershipsLookupCall { 2282 c.urlParams_.Set("memberKey.namespace", memberKeyNamespace) 2283 return c 2284} 2285 2286// Fields allows partial responses to be retrieved. See 2287// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2288// for more information. 2289func (c *GroupsMembershipsLookupCall) Fields(s ...googleapi.Field) *GroupsMembershipsLookupCall { 2290 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2291 return c 2292} 2293 2294// IfNoneMatch sets the optional parameter which makes the operation 2295// fail if the object's ETag matches the given value. This is useful for 2296// getting updates only after the object has changed since the last 2297// request. Use googleapi.IsNotModified to check whether the response 2298// error from Do is the result of In-None-Match. 2299func (c *GroupsMembershipsLookupCall) IfNoneMatch(entityTag string) *GroupsMembershipsLookupCall { 2300 c.ifNoneMatch_ = entityTag 2301 return c 2302} 2303 2304// Context sets the context to be used in this call's Do method. Any 2305// pending HTTP request will be aborted if the provided context is 2306// canceled. 2307func (c *GroupsMembershipsLookupCall) Context(ctx context.Context) *GroupsMembershipsLookupCall { 2308 c.ctx_ = ctx 2309 return c 2310} 2311 2312// Header returns an http.Header that can be modified by the caller to 2313// add HTTP headers to the request. 2314func (c *GroupsMembershipsLookupCall) Header() http.Header { 2315 if c.header_ == nil { 2316 c.header_ = make(http.Header) 2317 } 2318 return c.header_ 2319} 2320 2321func (c *GroupsMembershipsLookupCall) doRequest(alt string) (*http.Response, error) { 2322 reqHeaders := make(http.Header) 2323 reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190926") 2324 for k, v := range c.header_ { 2325 reqHeaders[k] = v 2326 } 2327 reqHeaders.Set("User-Agent", c.s.userAgent()) 2328 if c.ifNoneMatch_ != "" { 2329 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2330 } 2331 var body io.Reader = nil 2332 c.urlParams_.Set("alt", alt) 2333 c.urlParams_.Set("prettyPrint", "false") 2334 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/memberships:lookup") 2335 urls += "?" + c.urlParams_.Encode() 2336 req, err := http.NewRequest("GET", urls, body) 2337 if err != nil { 2338 return nil, err 2339 } 2340 req.Header = reqHeaders 2341 googleapi.Expand(req.URL, map[string]string{ 2342 "parent": c.parent, 2343 }) 2344 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2345} 2346 2347// Do executes the "cloudidentity.groups.memberships.lookup" call. 2348// Exactly one of *LookupMembershipNameResponse or error will be 2349// non-nil. Any non-2xx status code is an error. Response headers are in 2350// either *LookupMembershipNameResponse.ServerResponse.Header or (if a 2351// response was returned at all) in error.(*googleapi.Error).Header. Use 2352// googleapi.IsNotModified to check whether the returned error was 2353// because http.StatusNotModified was returned. 2354func (c *GroupsMembershipsLookupCall) Do(opts ...googleapi.CallOption) (*LookupMembershipNameResponse, error) { 2355 gensupport.SetOptions(c.urlParams_, opts...) 2356 res, err := c.doRequest("json") 2357 if res != nil && res.StatusCode == http.StatusNotModified { 2358 if res.Body != nil { 2359 res.Body.Close() 2360 } 2361 return nil, &googleapi.Error{ 2362 Code: res.StatusCode, 2363 Header: res.Header, 2364 } 2365 } 2366 if err != nil { 2367 return nil, err 2368 } 2369 defer googleapi.CloseBody(res) 2370 if err := googleapi.CheckResponse(res); err != nil { 2371 return nil, err 2372 } 2373 ret := &LookupMembershipNameResponse{ 2374 ServerResponse: googleapi.ServerResponse{ 2375 Header: res.Header, 2376 HTTPStatusCode: res.StatusCode, 2377 }, 2378 } 2379 target := &ret 2380 if err := gensupport.DecodeResponse(target, res); err != nil { 2381 return nil, err 2382 } 2383 return ret, nil 2384 // { 2385 // "description": "Looks up [resource\nname](https://cloud.google.com/apis/design/resource_names) of a Membership\nwithin a Group by member's EntityKey.", 2386 // "flatPath": "v1beta1/groups/{groupsId}/memberships:lookup", 2387 // "httpMethod": "GET", 2388 // "id": "cloudidentity.groups.memberships.lookup", 2389 // "parameterOrder": [ 2390 // "parent" 2391 // ], 2392 // "parameters": { 2393 // "memberKey.id": { 2394 // "description": "The id of the entity within the given namespace. The id must be unique\nwithin its namespace.", 2395 // "location": "query", 2396 // "type": "string" 2397 // }, 2398 // "memberKey.namespace": { 2399 // "description": "Namespaces provide isolation for ids, i.e an id only needs to be unique\nwithin its namespace.\n\nNamespaces are currently only created as part of IdentitySource creation\nfrom Admin Console. A namespace `\"identitysources/{identity_source_id}\"` is\ncreated corresponding to every Identity Source `identity_source_id`.", 2400 // "location": "query", 2401 // "type": "string" 2402 // }, 2403 // "parent": { 2404 // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup to lookup Membership within.\n\nFormat: `groups/{group_id}`, where `group_id` is the unique id assigned to\nthe Group.", 2405 // "location": "path", 2406 // "pattern": "^groups/[^/]+$", 2407 // "required": true, 2408 // "type": "string" 2409 // } 2410 // }, 2411 // "path": "v1beta1/{+parent}/memberships:lookup", 2412 // "response": { 2413 // "$ref": "LookupMembershipNameResponse" 2414 // }, 2415 // "scopes": [ 2416 // "https://www.googleapis.com/auth/cloud-identity.groups", 2417 // "https://www.googleapis.com/auth/cloud-identity.groups.readonly", 2418 // "https://www.googleapis.com/auth/cloud-platform" 2419 // ] 2420 // } 2421 2422} 2423