1// Copyright 2020 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 cloudresourcemanager provides access to the Cloud Resource Manager API. 8// 9// For product documentation, see: https://cloud.google.com/resource-manager 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/cloudresourcemanager/v2" 16// ... 17// ctx := context.Background() 18// cloudresourcemanagerService, err := cloudresourcemanager.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// cloudresourcemanagerService, err := cloudresourcemanager.NewService(ctx, option.WithScopes(cloudresourcemanager.CloudPlatformReadOnlyScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// cloudresourcemanagerService, err := cloudresourcemanager.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// cloudresourcemanagerService, err := cloudresourcemanager.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package cloudresourcemanager // import "google.golang.org/api/cloudresourcemanager/v2" 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 internaloption "google.golang.org/api/option/internaloption" 60 htransport "google.golang.org/api/transport/http" 61) 62 63// Always reference these packages, just in case the auto-generated code 64// below doesn't. 65var _ = bytes.NewBuffer 66var _ = strconv.Itoa 67var _ = fmt.Sprintf 68var _ = json.NewDecoder 69var _ = io.Copy 70var _ = url.Parse 71var _ = gensupport.MarshalJSON 72var _ = googleapi.Version 73var _ = errors.New 74var _ = strings.Replace 75var _ = context.Canceled 76var _ = internaloption.WithDefaultEndpoint 77 78const apiId = "cloudresourcemanager:v2" 79const apiName = "cloudresourcemanager" 80const apiVersion = "v2" 81const basePath = "https://cloudresourcemanager.googleapis.com/" 82 83// OAuth2 scopes used by this API. 84const ( 85 // View and manage your data across Google Cloud Platform services 86 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 87 88 // View your data across Google Cloud Platform services 89 CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only" 90) 91 92// NewService creates a new Service. 93func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 94 scopesOption := option.WithScopes( 95 "https://www.googleapis.com/auth/cloud-platform", 96 "https://www.googleapis.com/auth/cloud-platform.read-only", 97 ) 98 // NOTE: prepend, so we don't override user-specified scopes. 99 opts = append([]option.ClientOption{scopesOption}, opts...) 100 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 101 client, endpoint, err := htransport.NewClient(ctx, opts...) 102 if err != nil { 103 return nil, err 104 } 105 s, err := New(client) 106 if err != nil { 107 return nil, err 108 } 109 if endpoint != "" { 110 s.BasePath = endpoint 111 } 112 return s, nil 113} 114 115// New creates a new Service. It uses the provided http.Client for requests. 116// 117// Deprecated: please use NewService instead. 118// To provide a custom HTTP client, use option.WithHTTPClient. 119// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 120func New(client *http.Client) (*Service, error) { 121 if client == nil { 122 return nil, errors.New("client is nil") 123 } 124 s := &Service{client: client, BasePath: basePath} 125 s.Folders = NewFoldersService(s) 126 s.Operations = NewOperationsService(s) 127 return s, nil 128} 129 130type Service struct { 131 client *http.Client 132 BasePath string // API endpoint base URL 133 UserAgent string // optional additional User-Agent fragment 134 135 Folders *FoldersService 136 137 Operations *OperationsService 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 NewFoldersService(s *Service) *FoldersService { 148 rs := &FoldersService{s: s} 149 return rs 150} 151 152type FoldersService struct { 153 s *Service 154} 155 156func NewOperationsService(s *Service) *OperationsService { 157 rs := &OperationsService{s: s} 158 return rs 159} 160 161type OperationsService struct { 162 s *Service 163} 164 165// AuditConfig: Specifies the audit configuration for a service. 166// The configuration determines which permission types are logged, and 167// what 168// identities, if any, are exempted from logging. 169// An AuditConfig must have one or more AuditLogConfigs. 170// 171// If there are AuditConfigs for both `allServices` and a specific 172// service, 173// the union of the two AuditConfigs is used for that service: the 174// log_types 175// specified in each AuditConfig are enabled, and the exempted_members 176// in each 177// AuditLogConfig are exempted. 178// 179// Example Policy with multiple AuditConfigs: 180// 181// { 182// "audit_configs": [ 183// { 184// "service": "allServices" 185// "audit_log_configs": [ 186// { 187// "log_type": "DATA_READ", 188// "exempted_members": [ 189// "user:jose@example.com" 190// ] 191// }, 192// { 193// "log_type": "DATA_WRITE", 194// }, 195// { 196// "log_type": "ADMIN_READ", 197// } 198// ] 199// }, 200// { 201// "service": "sampleservice.googleapis.com" 202// "audit_log_configs": [ 203// { 204// "log_type": "DATA_READ", 205// }, 206// { 207// "log_type": "DATA_WRITE", 208// "exempted_members": [ 209// "user:aliya@example.com" 210// ] 211// } 212// ] 213// } 214// ] 215// } 216// 217// For sampleservice, this policy enables DATA_READ, DATA_WRITE and 218// ADMIN_READ 219// logging. It also exempts jose@example.com from DATA_READ logging, 220// and 221// aliya@example.com from DATA_WRITE logging. 222type AuditConfig struct { 223 // AuditLogConfigs: The configuration for logging of each type of 224 // permission. 225 AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"` 226 227 // Service: Specifies a service that will be enabled for audit 228 // logging. 229 // For example, `storage.googleapis.com`, 230 // `cloudsql.googleapis.com`. 231 // `allServices` is a special value that covers all services. 232 Service string `json:"service,omitempty"` 233 234 // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to 235 // unconditionally include in API requests. By default, fields with 236 // empty values are omitted from API requests. However, any non-pointer, 237 // non-interface field appearing in ForceSendFields will be sent to the 238 // server regardless of whether the field is empty or not. This may be 239 // used to include empty fields in Patch requests. 240 ForceSendFields []string `json:"-"` 241 242 // NullFields is a list of field names (e.g. "AuditLogConfigs") to 243 // include in API requests with the JSON null value. By default, fields 244 // with empty values are omitted from API requests. However, any field 245 // with an empty value appearing in NullFields will be sent to the 246 // server as null. It is an error if a field in this list has a 247 // non-empty value. This may be used to include null fields in Patch 248 // requests. 249 NullFields []string `json:"-"` 250} 251 252func (s *AuditConfig) MarshalJSON() ([]byte, error) { 253 type NoMethod AuditConfig 254 raw := NoMethod(*s) 255 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 256} 257 258// AuditLogConfig: Provides the configuration for logging a type of 259// permissions. 260// Example: 261// 262// { 263// "audit_log_configs": [ 264// { 265// "log_type": "DATA_READ", 266// "exempted_members": [ 267// "user:jose@example.com" 268// ] 269// }, 270// { 271// "log_type": "DATA_WRITE", 272// } 273// ] 274// } 275// 276// This enables 'DATA_READ' and 'DATA_WRITE' logging, while 277// exempting 278// jose@example.com from DATA_READ logging. 279type AuditLogConfig struct { 280 // ExemptedMembers: Specifies the identities that do not cause logging 281 // for this type of 282 // permission. 283 // Follows the same format of Binding.members. 284 ExemptedMembers []string `json:"exemptedMembers,omitempty"` 285 286 // LogType: The log type that this config enables. 287 // 288 // Possible values: 289 // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this. 290 // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy 291 // "DATA_WRITE" - Data writes. Example: CloudSQL Users create 292 // "DATA_READ" - Data reads. Example: CloudSQL Users list 293 LogType string `json:"logType,omitempty"` 294 295 // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to 296 // unconditionally include in API requests. By default, fields with 297 // empty values are omitted from API requests. However, any non-pointer, 298 // non-interface field appearing in ForceSendFields will be sent to the 299 // server regardless of whether the field is empty or not. This may be 300 // used to include empty fields in Patch requests. 301 ForceSendFields []string `json:"-"` 302 303 // NullFields is a list of field names (e.g. "ExemptedMembers") to 304 // include in API requests with the JSON null value. By default, fields 305 // with empty values are omitted from API requests. However, any field 306 // with an empty value appearing in NullFields will be sent to the 307 // server as null. It is an error if a field in this list has a 308 // non-empty value. This may be used to include null fields in Patch 309 // requests. 310 NullFields []string `json:"-"` 311} 312 313func (s *AuditLogConfig) MarshalJSON() ([]byte, error) { 314 type NoMethod AuditLogConfig 315 raw := NoMethod(*s) 316 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 317} 318 319// Binding: Associates `members` with a `role`. 320type Binding struct { 321 // Condition: The condition that is associated with this binding. 322 // NOTE: An unsatisfied condition will not allow user access via 323 // current 324 // binding. Different bindings, including their conditions, are 325 // examined 326 // independently. 327 Condition *Expr `json:"condition,omitempty"` 328 329 // Members: Specifies the identities requesting access for a Cloud 330 // Platform resource. 331 // `members` can have the following values: 332 // 333 // * `allUsers`: A special identifier that represents anyone who is 334 // on the internet; with or without a Google account. 335 // 336 // * `allAuthenticatedUsers`: A special identifier that represents 337 // anyone 338 // who is authenticated with a Google account or a service 339 // account. 340 // 341 // * `user:{emailid}`: An email address that represents a specific 342 // Google 343 // account. For example, `alice@example.com` . 344 // 345 // 346 // * `serviceAccount:{emailid}`: An email address that represents a 347 // service 348 // account. For example, 349 // `my-other-app@appspot.gserviceaccount.com`. 350 // 351 // * `group:{emailid}`: An email address that represents a Google 352 // group. 353 // For example, `admins@example.com`. 354 // 355 // * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus 356 // unique 357 // identifier) representing a user that has been recently deleted. 358 // For 359 // example, `alice@example.com?uid=123456789012345678901`. If the 360 // user is 361 // recovered, this value reverts to `user:{emailid}` and the 362 // recovered user 363 // retains the role in the binding. 364 // 365 // * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address 366 // (plus 367 // unique identifier) representing a service account that has been 368 // recently 369 // deleted. For example, 370 // 371 // `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. 372 // 373 // If the service account is undeleted, this value reverts to 374 // `serviceAccount:{emailid}` and the undeleted service account 375 // retains the 376 // role in the binding. 377 // 378 // * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus 379 // unique 380 // identifier) representing a Google group that has been recently 381 // deleted. For example, 382 // `admins@example.com?uid=123456789012345678901`. If 383 // the group is recovered, this value reverts to `group:{emailid}` 384 // and the 385 // recovered group retains the role in the binding. 386 // 387 // 388 // * `domain:{domain}`: The G Suite domain (primary) that represents all 389 // the 390 // users of that domain. For example, `google.com` or 391 // `example.com`. 392 // 393 // 394 Members []string `json:"members,omitempty"` 395 396 // Role: Role that is assigned to `members`. 397 // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. 398 Role string `json:"role,omitempty"` 399 400 // ForceSendFields is a list of field names (e.g. "Condition") to 401 // unconditionally include in API requests. By default, fields with 402 // empty values are omitted from API requests. However, any non-pointer, 403 // non-interface field appearing in ForceSendFields will be sent to the 404 // server regardless of whether the field is empty or not. This may be 405 // used to include empty fields in Patch requests. 406 ForceSendFields []string `json:"-"` 407 408 // NullFields is a list of field names (e.g. "Condition") to include in 409 // API requests with the JSON null value. By default, fields with empty 410 // values are omitted from API requests. However, any field with an 411 // empty value appearing in NullFields will be sent to the server as 412 // null. It is an error if a field in this list has a non-empty value. 413 // This may be used to include null fields in Patch requests. 414 NullFields []string `json:"-"` 415} 416 417func (s *Binding) MarshalJSON() ([]byte, error) { 418 type NoMethod Binding 419 raw := NoMethod(*s) 420 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 421} 422 423// Expr: Represents a textual expression in the Common Expression 424// Language (CEL) 425// syntax. CEL is a C-like expression language. The syntax and semantics 426// of CEL 427// are documented at https://github.com/google/cel-spec. 428// 429// Example (Comparison): 430// 431// title: "Summary size limit" 432// description: "Determines if a summary is less than 100 chars" 433// expression: "document.summary.size() < 100" 434// 435// Example (Equality): 436// 437// title: "Requestor is owner" 438// description: "Determines if requestor is the document owner" 439// expression: "document.owner == 440// request.auth.claims.email" 441// 442// Example (Logic): 443// 444// title: "Public documents" 445// description: "Determine whether the document should be publicly 446// visible" 447// expression: "document.type != 'private' && document.type != 448// 'internal'" 449// 450// Example (Data Manipulation): 451// 452// title: "Notification string" 453// description: "Create a notification string with a timestamp." 454// expression: "'New message received at ' + 455// string(document.create_time)" 456// 457// The exact variables and functions that may be referenced within an 458// expression 459// are determined by the service that evaluates it. See the 460// service 461// documentation for additional information. 462type Expr struct { 463 // Description: Optional. Description of the expression. This is a 464 // longer text which 465 // describes the expression, e.g. when hovered over it in a UI. 466 Description string `json:"description,omitempty"` 467 468 // Expression: Textual representation of an expression in Common 469 // Expression Language 470 // syntax. 471 Expression string `json:"expression,omitempty"` 472 473 // Location: Optional. String indicating the location of the expression 474 // for error 475 // reporting, e.g. a file name and a position in the file. 476 Location string `json:"location,omitempty"` 477 478 // Title: Optional. Title for the expression, i.e. a short string 479 // describing 480 // its purpose. This can be used e.g. in UIs which allow to enter 481 // the 482 // expression. 483 Title string `json:"title,omitempty"` 484 485 // ForceSendFields is a list of field names (e.g. "Description") to 486 // unconditionally include in API requests. By default, fields with 487 // empty values are omitted from API requests. However, any non-pointer, 488 // non-interface field appearing in ForceSendFields will be sent to the 489 // server regardless of whether the field is empty or not. This may be 490 // used to include empty fields in Patch requests. 491 ForceSendFields []string `json:"-"` 492 493 // NullFields is a list of field names (e.g. "Description") to include 494 // in API requests with the JSON null value. By default, fields with 495 // empty values are omitted from API requests. However, any field with 496 // an empty value appearing in NullFields will be sent to the server as 497 // null. It is an error if a field in this list has a non-empty value. 498 // This may be used to include null fields in Patch requests. 499 NullFields []string `json:"-"` 500} 501 502func (s *Expr) MarshalJSON() ([]byte, error) { 503 type NoMethod Expr 504 raw := NoMethod(*s) 505 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 506} 507 508// Folder: A Folder in an Organization's resource hierarchy, used 509// to 510// organize that Organization's resources. 511type Folder struct { 512 // CreateTime: Output only. Timestamp when the Folder was created. 513 // Assigned by the server. 514 CreateTime string `json:"createTime,omitempty"` 515 516 // DisplayName: The folder’s display name. 517 // A folder’s display name must be unique amongst its siblings, 518 // e.g. 519 // no two folders with the same parent can share the same display 520 // name. 521 // The display name must start and end with a letter or digit, may 522 // contain 523 // letters, digits, spaces, hyphens and underscores and can be no 524 // longer 525 // than 30 characters. This is captured by the regular 526 // expression: 527 // [\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?. 528 DisplayName string `json:"displayName,omitempty"` 529 530 // LifecycleState: Output only. The lifecycle state of the 531 // folder. 532 // Updates to the lifecycle_state must be performed via 533 // DeleteFolder and 534 // UndeleteFolder. 535 // 536 // Possible values: 537 // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state. 538 // "ACTIVE" - The normal and active state. 539 // "DELETE_REQUESTED" - The folder has been marked for deletion by the 540 // user. 541 LifecycleState string `json:"lifecycleState,omitempty"` 542 543 // Name: Output only. The resource name of the Folder. 544 // Its format is `folders/{folder_id}`, for example: "folders/1234". 545 Name string `json:"name,omitempty"` 546 547 // Parent: Required. The Folder’s parent's resource name. 548 // Updates to the folder's parent must be performed via 549 // MoveFolder. 550 Parent string `json:"parent,omitempty"` 551 552 // ServerResponse contains the HTTP response code and headers from the 553 // server. 554 googleapi.ServerResponse `json:"-"` 555 556 // ForceSendFields is a list of field names (e.g. "CreateTime") to 557 // unconditionally include in API requests. By default, fields with 558 // empty values are omitted from API requests. However, any non-pointer, 559 // non-interface field appearing in ForceSendFields will be sent to the 560 // server regardless of whether the field is empty or not. This may be 561 // used to include empty fields in Patch requests. 562 ForceSendFields []string `json:"-"` 563 564 // NullFields is a list of field names (e.g. "CreateTime") to include in 565 // API requests with the JSON null value. By default, fields with empty 566 // values are omitted from API requests. However, any field with an 567 // empty value appearing in NullFields will be sent to the server as 568 // null. It is an error if a field in this list has a non-empty value. 569 // This may be used to include null fields in Patch requests. 570 NullFields []string `json:"-"` 571} 572 573func (s *Folder) MarshalJSON() ([]byte, error) { 574 type NoMethod Folder 575 raw := NoMethod(*s) 576 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 577} 578 579// FolderOperation: Metadata describing a long running folder operation 580type FolderOperation struct { 581 // DestinationParent: The resource name of the folder or organization we 582 // are either creating 583 // the folder under or moving the folder to. 584 DestinationParent string `json:"destinationParent,omitempty"` 585 586 // DisplayName: The display name of the folder. 587 DisplayName string `json:"displayName,omitempty"` 588 589 // OperationType: The type of this operation. 590 // 591 // Possible values: 592 // "OPERATION_TYPE_UNSPECIFIED" - Operation type not specified. 593 // "CREATE" - A create folder operation. 594 // "MOVE" - A move folder operation. 595 OperationType string `json:"operationType,omitempty"` 596 597 // SourceParent: The resource name of the folder's parent. 598 // Only applicable when the operation_type is MOVE. 599 SourceParent string `json:"sourceParent,omitempty"` 600 601 // ForceSendFields is a list of field names (e.g. "DestinationParent") 602 // to unconditionally include in API requests. By default, fields with 603 // empty values are omitted from API requests. However, any non-pointer, 604 // non-interface field appearing in ForceSendFields will be sent to the 605 // server regardless of whether the field is empty or not. This may be 606 // used to include empty fields in Patch requests. 607 ForceSendFields []string `json:"-"` 608 609 // NullFields is a list of field names (e.g. "DestinationParent") to 610 // include in API requests with the JSON null value. By default, fields 611 // with empty values are omitted from API requests. However, any field 612 // with an empty value appearing in NullFields will be sent to the 613 // server as null. It is an error if a field in this list has a 614 // non-empty value. This may be used to include null fields in Patch 615 // requests. 616 NullFields []string `json:"-"` 617} 618 619func (s *FolderOperation) MarshalJSON() ([]byte, error) { 620 type NoMethod FolderOperation 621 raw := NoMethod(*s) 622 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 623} 624 625// FolderOperationError: A classification of the Folder Operation error. 626type FolderOperationError struct { 627 // ErrorMessageId: The type of operation error experienced. 628 // 629 // Possible values: 630 // "ERROR_TYPE_UNSPECIFIED" - The error type was unrecognized or 631 // unspecified. 632 // "ACTIVE_FOLDER_HEIGHT_VIOLATION" - The attempted action would 633 // violate the max folder depth constraint. 634 // "MAX_CHILD_FOLDERS_VIOLATION" - The attempted action would violate 635 // the max child folders constraint. 636 // "FOLDER_NAME_UNIQUENESS_VIOLATION" - The attempted action would 637 // violate the locally-unique folder 638 // display_name constraint. 639 // "RESOURCE_DELETED_VIOLATION" - The resource being moved has been 640 // deleted. 641 // "PARENT_DELETED_VIOLATION" - The resource a folder was being added 642 // to has been deleted. 643 // "CYCLE_INTRODUCED_VIOLATION" - The attempted action would introduce 644 // cycle in resource path. 645 // "FOLDER_BEING_MOVED_VIOLATION" - The attempted action would move a 646 // folder that is already being moved. 647 // "FOLDER_TO_DELETE_NON_EMPTY_VIOLATION" - The folder the caller is 648 // trying to delete contains active resources. 649 // "DELETED_FOLDER_HEIGHT_VIOLATION" - The attempted action would 650 // violate the max deleted folder depth 651 // constraint. 652 ErrorMessageId string `json:"errorMessageId,omitempty"` 653 654 // ForceSendFields is a list of field names (e.g. "ErrorMessageId") to 655 // unconditionally include in API requests. By default, fields with 656 // empty values are omitted from API requests. However, any non-pointer, 657 // non-interface field appearing in ForceSendFields will be sent to the 658 // server regardless of whether the field is empty or not. This may be 659 // used to include empty fields in Patch requests. 660 ForceSendFields []string `json:"-"` 661 662 // NullFields is a list of field names (e.g. "ErrorMessageId") to 663 // include in API requests with the JSON null value. By default, fields 664 // with empty values are omitted from API requests. However, any field 665 // with an empty value appearing in NullFields will be sent to the 666 // server as null. It is an error if a field in this list has a 667 // non-empty value. This may be used to include null fields in Patch 668 // requests. 669 NullFields []string `json:"-"` 670} 671 672func (s *FolderOperationError) MarshalJSON() ([]byte, error) { 673 type NoMethod FolderOperationError 674 raw := NoMethod(*s) 675 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 676} 677 678// GetIamPolicyRequest: Request message for `GetIamPolicy` method. 679type GetIamPolicyRequest struct { 680 // Options: OPTIONAL: A `GetPolicyOptions` object for specifying options 681 // to 682 // `GetIamPolicy`. This field is only used by Cloud IAM. 683 Options *GetPolicyOptions `json:"options,omitempty"` 684 685 // ForceSendFields is a list of field names (e.g. "Options") to 686 // unconditionally include in API requests. By default, fields with 687 // empty values are omitted from API requests. However, any non-pointer, 688 // non-interface field appearing in ForceSendFields will be sent to the 689 // server regardless of whether the field is empty or not. This may be 690 // used to include empty fields in Patch requests. 691 ForceSendFields []string `json:"-"` 692 693 // NullFields is a list of field names (e.g. "Options") to include in 694 // API requests with the JSON null value. By default, fields with empty 695 // values are omitted from API requests. However, any field with an 696 // empty value appearing in NullFields will be sent to the server as 697 // null. It is an error if a field in this list has a non-empty value. 698 // This may be used to include null fields in Patch requests. 699 NullFields []string `json:"-"` 700} 701 702func (s *GetIamPolicyRequest) MarshalJSON() ([]byte, error) { 703 type NoMethod GetIamPolicyRequest 704 raw := NoMethod(*s) 705 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 706} 707 708// GetPolicyOptions: Encapsulates settings provided to GetIamPolicy. 709type GetPolicyOptions struct { 710 // RequestedPolicyVersion: Optional. The policy format version to be 711 // returned. 712 // 713 // Valid values are 0, 1, and 3. Requests specifying an invalid value 714 // will be 715 // rejected. 716 // 717 // Requests for policies with any conditional bindings must specify 718 // version 3. 719 // Policies without any conditional bindings may specify any valid value 720 // or 721 // leave the field unset. 722 RequestedPolicyVersion int64 `json:"requestedPolicyVersion,omitempty"` 723 724 // ForceSendFields is a list of field names (e.g. 725 // "RequestedPolicyVersion") to unconditionally include in API requests. 726 // By default, fields with empty values are omitted from API requests. 727 // However, any non-pointer, non-interface field appearing in 728 // ForceSendFields will be sent to the server regardless of whether the 729 // field is empty or not. This may be used to include empty fields in 730 // Patch requests. 731 ForceSendFields []string `json:"-"` 732 733 // NullFields is a list of field names (e.g. "RequestedPolicyVersion") 734 // to include in API requests with the JSON null value. By default, 735 // fields with empty values are omitted from API requests. However, any 736 // field with an empty value appearing in NullFields will be sent to the 737 // server as null. It is an error if a field in this list has a 738 // non-empty value. This may be used to include null fields in Patch 739 // requests. 740 NullFields []string `json:"-"` 741} 742 743func (s *GetPolicyOptions) MarshalJSON() ([]byte, error) { 744 type NoMethod GetPolicyOptions 745 raw := NoMethod(*s) 746 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 747} 748 749// ListFoldersResponse: The ListFolders response message. 750type ListFoldersResponse struct { 751 // Folders: A possibly paginated list of Folders that are direct 752 // descendants of 753 // the specified parent resource. 754 Folders []*Folder `json:"folders,omitempty"` 755 756 // NextPageToken: A pagination token returned from a previous call to 757 // `ListFolders` 758 // that indicates from where listing should continue. 759 NextPageToken string `json:"nextPageToken,omitempty"` 760 761 // ServerResponse contains the HTTP response code and headers from the 762 // server. 763 googleapi.ServerResponse `json:"-"` 764 765 // ForceSendFields is a list of field names (e.g. "Folders") to 766 // unconditionally include in API requests. By default, fields with 767 // empty values are omitted from API requests. However, any non-pointer, 768 // non-interface field appearing in ForceSendFields will be sent to the 769 // server regardless of whether the field is empty or not. This may be 770 // used to include empty fields in Patch requests. 771 ForceSendFields []string `json:"-"` 772 773 // NullFields is a list of field names (e.g. "Folders") to include in 774 // API requests with the JSON null value. By default, fields with empty 775 // values are omitted from API requests. However, any field with an 776 // empty value appearing in NullFields will be sent to the server as 777 // null. It is an error if a field in this list has a non-empty value. 778 // This may be used to include null fields in Patch requests. 779 NullFields []string `json:"-"` 780} 781 782func (s *ListFoldersResponse) MarshalJSON() ([]byte, error) { 783 type NoMethod ListFoldersResponse 784 raw := NoMethod(*s) 785 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 786} 787 788// MoveFolderRequest: The MoveFolder request message. 789type MoveFolderRequest struct { 790 // DestinationParent: Required. The resource name of the Folder or 791 // Organization to reparent 792 // the folder under. 793 // Must be of the form `folders/{folder_id}` or 794 // `organizations/{org_id}`. 795 DestinationParent string `json:"destinationParent,omitempty"` 796 797 // ForceSendFields is a list of field names (e.g. "DestinationParent") 798 // to unconditionally include in API requests. By default, fields with 799 // empty values are omitted from API requests. However, any non-pointer, 800 // non-interface field appearing in ForceSendFields will be sent to the 801 // server regardless of whether the field is empty or not. This may be 802 // used to include empty fields in Patch requests. 803 ForceSendFields []string `json:"-"` 804 805 // NullFields is a list of field names (e.g. "DestinationParent") to 806 // include in API requests with the JSON null value. By default, fields 807 // with empty values are omitted from API requests. However, any field 808 // with an empty value appearing in NullFields will be sent to the 809 // server as null. It is an error if a field in this list has a 810 // non-empty value. This may be used to include null fields in Patch 811 // requests. 812 NullFields []string `json:"-"` 813} 814 815func (s *MoveFolderRequest) MarshalJSON() ([]byte, error) { 816 type NoMethod MoveFolderRequest 817 raw := NoMethod(*s) 818 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 819} 820 821// Operation: This resource represents a long-running operation that is 822// the result of a 823// network API call. 824type Operation struct { 825 // Done: If the value is `false`, it means the operation is still in 826 // progress. 827 // If `true`, the operation is completed, and either `error` or 828 // `response` is 829 // available. 830 Done bool `json:"done,omitempty"` 831 832 // Error: The error result of the operation in case of failure or 833 // cancellation. 834 Error *Status `json:"error,omitempty"` 835 836 // Metadata: Service-specific metadata associated with the operation. 837 // It typically 838 // contains progress information and common metadata such as create 839 // time. 840 // Some services might not provide such metadata. Any method that 841 // returns a 842 // long-running operation should document the metadata type, if any. 843 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 844 845 // Name: The server-assigned name, which is only unique within the same 846 // service that 847 // originally returns it. If you use the default HTTP mapping, 848 // the 849 // `name` should be a resource name ending with 850 // `operations/{unique_id}`. 851 Name string `json:"name,omitempty"` 852 853 // Response: The normal response of the operation in case of success. 854 // If the original 855 // method returns no data on success, such as `Delete`, the response 856 // is 857 // `google.protobuf.Empty`. If the original method is 858 // standard 859 // `Get`/`Create`/`Update`, the response should be the resource. For 860 // other 861 // methods, the response should have the type `XxxResponse`, where 862 // `Xxx` 863 // is the original method name. For example, if the original method 864 // name 865 // is `TakeSnapshot()`, the inferred response type 866 // is 867 // `TakeSnapshotResponse`. 868 Response googleapi.RawMessage `json:"response,omitempty"` 869 870 // ServerResponse contains the HTTP response code and headers from the 871 // server. 872 googleapi.ServerResponse `json:"-"` 873 874 // ForceSendFields is a list of field names (e.g. "Done") to 875 // unconditionally include in API requests. By default, fields with 876 // empty values are omitted from API requests. However, any non-pointer, 877 // non-interface field appearing in ForceSendFields will be sent to the 878 // server regardless of whether the field is empty or not. This may be 879 // used to include empty fields in Patch requests. 880 ForceSendFields []string `json:"-"` 881 882 // NullFields is a list of field names (e.g. "Done") to include in API 883 // requests with the JSON null value. By default, fields with empty 884 // values are omitted from API requests. However, any field with an 885 // empty value appearing in NullFields will be sent to the server as 886 // null. It is an error if a field in this list has a non-empty value. 887 // This may be used to include null fields in Patch requests. 888 NullFields []string `json:"-"` 889} 890 891func (s *Operation) MarshalJSON() ([]byte, error) { 892 type NoMethod Operation 893 raw := NoMethod(*s) 894 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 895} 896 897// Policy: An Identity and Access Management (IAM) policy, which 898// specifies access 899// controls for Google Cloud resources. 900// 901// 902// A `Policy` is a collection of `bindings`. A `binding` binds one or 903// more 904// `members` to a single `role`. Members can be user accounts, service 905// accounts, 906// Google groups, and domains (such as G Suite). A `role` is a named 907// list of 908// permissions; each `role` can be an IAM predefined role or a 909// user-created 910// custom role. 911// 912// Optionally, a `binding` can specify a `condition`, which is a 913// logical 914// expression that allows access to a resource only if the expression 915// evaluates 916// to `true`. A condition can add constraints based on attributes of 917// the 918// request, the resource, or both. 919// 920// **JSON example:** 921// 922// { 923// "bindings": [ 924// { 925// "role": "roles/resourcemanager.organizationAdmin", 926// "members": [ 927// "user:mike@example.com", 928// "group:admins@example.com", 929// "domain:google.com", 930// 931// "serviceAccount:my-project-id@appspot.gserviceaccount.com" 932// ] 933// }, 934// { 935// "role": "roles/resourcemanager.organizationViewer", 936// "members": ["user:eve@example.com"], 937// "condition": { 938// "title": "expirable access", 939// "description": "Does not grant access after Sep 2020", 940// "expression": "request.time < 941// timestamp('2020-10-01T00:00:00.000Z')", 942// } 943// } 944// ], 945// "etag": "BwWWja0YfJA=", 946// "version": 3 947// } 948// 949// **YAML example:** 950// 951// bindings: 952// - members: 953// - user:mike@example.com 954// - group:admins@example.com 955// - domain:google.com 956// - serviceAccount:my-project-id@appspot.gserviceaccount.com 957// role: roles/resourcemanager.organizationAdmin 958// - members: 959// - user:eve@example.com 960// role: roles/resourcemanager.organizationViewer 961// condition: 962// title: expirable access 963// description: Does not grant access after Sep 2020 964// expression: request.time < 965// timestamp('2020-10-01T00:00:00.000Z') 966// - etag: BwWWja0YfJA= 967// - version: 3 968// 969// For a description of IAM and its features, see the 970// [IAM documentation](https://cloud.google.com/iam/docs/). 971type Policy struct { 972 // AuditConfigs: Specifies cloud audit logging configuration for this 973 // policy. 974 AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"` 975 976 // Bindings: Associates a list of `members` to a `role`. Optionally, may 977 // specify a 978 // `condition` that determines how and when the `bindings` are applied. 979 // Each 980 // of the `bindings` must contain at least one member. 981 Bindings []*Binding `json:"bindings,omitempty"` 982 983 // Etag: `etag` is used for optimistic concurrency control as a way to 984 // help 985 // prevent simultaneous updates of a policy from overwriting each 986 // other. 987 // It is strongly suggested that systems make use of the `etag` in 988 // the 989 // read-modify-write cycle to perform policy updates in order to avoid 990 // race 991 // conditions: An `etag` is returned in the response to `getIamPolicy`, 992 // and 993 // systems are expected to put that etag in the request to 994 // `setIamPolicy` to 995 // ensure that their change will be applied to the same version of the 996 // policy. 997 // 998 // **Important:** If you use IAM Conditions, you must include the `etag` 999 // field 1000 // whenever you call `setIamPolicy`. If you omit this field, then IAM 1001 // allows 1002 // you to overwrite a version `3` policy with a version `1` policy, and 1003 // all of 1004 // the conditions in the version `3` policy are lost. 1005 Etag string `json:"etag,omitempty"` 1006 1007 // Version: Specifies the format of the policy. 1008 // 1009 // Valid values are `0`, `1`, and `3`. Requests that specify an invalid 1010 // value 1011 // are rejected. 1012 // 1013 // Any operation that affects conditional role bindings must specify 1014 // version 1015 // `3`. This requirement applies to the following operations: 1016 // 1017 // * Getting a policy that includes a conditional role binding 1018 // * Adding a conditional role binding to a policy 1019 // * Changing a conditional role binding in a policy 1020 // * Removing any role binding, with or without a condition, from a 1021 // policy 1022 // that includes conditions 1023 // 1024 // **Important:** If you use IAM Conditions, you must include the `etag` 1025 // field 1026 // whenever you call `setIamPolicy`. If you omit this field, then IAM 1027 // allows 1028 // you to overwrite a version `3` policy with a version `1` policy, and 1029 // all of 1030 // the conditions in the version `3` policy are lost. 1031 // 1032 // If a policy does not include any conditions, operations on that 1033 // policy may 1034 // specify any valid version or leave the field unset. 1035 Version int64 `json:"version,omitempty"` 1036 1037 // ServerResponse contains the HTTP response code and headers from the 1038 // server. 1039 googleapi.ServerResponse `json:"-"` 1040 1041 // ForceSendFields is a list of field names (e.g. "AuditConfigs") to 1042 // unconditionally include in API requests. By default, fields with 1043 // empty values are omitted from API requests. However, any non-pointer, 1044 // non-interface field appearing in ForceSendFields will be sent to the 1045 // server regardless of whether the field is empty or not. This may be 1046 // used to include empty fields in Patch requests. 1047 ForceSendFields []string `json:"-"` 1048 1049 // NullFields is a list of field names (e.g. "AuditConfigs") to include 1050 // in API requests with the JSON null value. By default, fields with 1051 // empty values are omitted from API requests. However, any field with 1052 // an empty value appearing in NullFields will be sent to the server as 1053 // null. It is an error if a field in this list has a non-empty value. 1054 // This may be used to include null fields in Patch requests. 1055 NullFields []string `json:"-"` 1056} 1057 1058func (s *Policy) MarshalJSON() ([]byte, error) { 1059 type NoMethod Policy 1060 raw := NoMethod(*s) 1061 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1062} 1063 1064// ProjectCreationStatus: A status object which is used as the 1065// `metadata` field for the Operation 1066// returned by CreateProject. It provides insight for when significant 1067// phases of 1068// Project creation have completed. 1069type ProjectCreationStatus struct { 1070 // CreateTime: Creation time of the project creation workflow. 1071 CreateTime string `json:"createTime,omitempty"` 1072 1073 // Gettable: True if the project can be retrieved using GetProject. No 1074 // other operations 1075 // on the project are guaranteed to work until the project creation 1076 // is 1077 // complete. 1078 Gettable bool `json:"gettable,omitempty"` 1079 1080 // Ready: True if the project creation process is complete. 1081 Ready bool `json:"ready,omitempty"` 1082 1083 // ForceSendFields is a list of field names (e.g. "CreateTime") to 1084 // unconditionally include in API requests. By default, fields with 1085 // empty values are omitted from API requests. However, any non-pointer, 1086 // non-interface field appearing in ForceSendFields will be sent to the 1087 // server regardless of whether the field is empty or not. This may be 1088 // used to include empty fields in Patch requests. 1089 ForceSendFields []string `json:"-"` 1090 1091 // NullFields is a list of field names (e.g. "CreateTime") to include in 1092 // API requests with the JSON null value. By default, fields with empty 1093 // values are omitted from API requests. However, any field with an 1094 // empty value appearing in NullFields will be sent to the server as 1095 // null. It is an error if a field in this list has a non-empty value. 1096 // This may be used to include null fields in Patch requests. 1097 NullFields []string `json:"-"` 1098} 1099 1100func (s *ProjectCreationStatus) MarshalJSON() ([]byte, error) { 1101 type NoMethod ProjectCreationStatus 1102 raw := NoMethod(*s) 1103 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1104} 1105 1106// SearchFoldersRequest: The request message for searching folders. 1107type SearchFoldersRequest struct { 1108 // PageSize: Optional. The maximum number of folders to return in the 1109 // response. 1110 PageSize int64 `json:"pageSize,omitempty"` 1111 1112 // PageToken: Optional. A pagination token returned from a previous call 1113 // to `SearchFolders` 1114 // that indicates from where search should continue. 1115 PageToken string `json:"pageToken,omitempty"` 1116 1117 // Query: Search criteria used to select the Folders to return. 1118 // If no search criteria is specified then all accessible folders will 1119 // be 1120 // returned. 1121 // 1122 // Query expressions can be used to restrict results based upon 1123 // displayName, 1124 // lifecycleState and parent, where the operators `=`, `NOT`, `AND` and 1125 // `OR` 1126 // can be used along with the suffix wildcard symbol `*`. 1127 // 1128 // The displayName field in a query expression should use escaped 1129 // quotes 1130 // for values that include whitespace to prevent unexpected 1131 // behavior. 1132 // 1133 // Some example queries are: 1134 // 1135 // * Query `displayName=Test*` returns Folder resources whose display 1136 // name 1137 // starts with "Test". 1138 // * Query `lifecycleState=ACTIVE` returns Folder resources 1139 // with 1140 // `lifecycleState` set to `ACTIVE`. 1141 // * Query `parent=folders/123` returns Folder resources that 1142 // have 1143 // `folders/123` as a parent resource. 1144 // * Query `parent=folders/123 AND lifecycleState=ACTIVE` returns 1145 // active 1146 // Folder resources that have `folders/123` as a parent resource. 1147 // * Query `displayName=\\"Test String\\" returns Folder resources 1148 // with 1149 // display names that include both "Test" and "String". 1150 Query string `json:"query,omitempty"` 1151 1152 // ForceSendFields is a list of field names (e.g. "PageSize") to 1153 // unconditionally include in API requests. By default, fields with 1154 // empty values are omitted from API requests. However, any non-pointer, 1155 // non-interface field appearing in ForceSendFields will be sent to the 1156 // server regardless of whether the field is empty or not. This may be 1157 // used to include empty fields in Patch requests. 1158 ForceSendFields []string `json:"-"` 1159 1160 // NullFields is a list of field names (e.g. "PageSize") to include in 1161 // API requests with the JSON null value. By default, fields with empty 1162 // values are omitted from API requests. However, any field with an 1163 // empty value appearing in NullFields will be sent to the server as 1164 // null. It is an error if a field in this list has a non-empty value. 1165 // This may be used to include null fields in Patch requests. 1166 NullFields []string `json:"-"` 1167} 1168 1169func (s *SearchFoldersRequest) MarshalJSON() ([]byte, error) { 1170 type NoMethod SearchFoldersRequest 1171 raw := NoMethod(*s) 1172 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1173} 1174 1175// SearchFoldersResponse: The response message for searching folders. 1176type SearchFoldersResponse struct { 1177 // Folders: A possibly paginated folder search results. 1178 // the specified parent resource. 1179 Folders []*Folder `json:"folders,omitempty"` 1180 1181 // NextPageToken: A pagination token returned from a previous call to 1182 // `SearchFolders` 1183 // that indicates from where searching should continue. 1184 NextPageToken string `json:"nextPageToken,omitempty"` 1185 1186 // ServerResponse contains the HTTP response code and headers from the 1187 // server. 1188 googleapi.ServerResponse `json:"-"` 1189 1190 // ForceSendFields is a list of field names (e.g. "Folders") to 1191 // unconditionally include in API requests. By default, fields with 1192 // empty values are omitted from API requests. However, any non-pointer, 1193 // non-interface field appearing in ForceSendFields will be sent to the 1194 // server regardless of whether the field is empty or not. This may be 1195 // used to include empty fields in Patch requests. 1196 ForceSendFields []string `json:"-"` 1197 1198 // NullFields is a list of field names (e.g. "Folders") to include in 1199 // API requests with the JSON null value. By default, fields with empty 1200 // values are omitted from API requests. However, any field with an 1201 // empty value appearing in NullFields will be sent to the server as 1202 // null. It is an error if a field in this list has a non-empty value. 1203 // This may be used to include null fields in Patch requests. 1204 NullFields []string `json:"-"` 1205} 1206 1207func (s *SearchFoldersResponse) MarshalJSON() ([]byte, error) { 1208 type NoMethod SearchFoldersResponse 1209 raw := NoMethod(*s) 1210 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1211} 1212 1213// SetIamPolicyRequest: Request message for `SetIamPolicy` method. 1214type SetIamPolicyRequest struct { 1215 // Policy: REQUIRED: The complete policy to be applied to the 1216 // `resource`. The size of 1217 // the policy is limited to a few 10s of KB. An empty policy is a 1218 // valid policy but certain Cloud Platform services (such as 1219 // Projects) 1220 // might reject them. 1221 Policy *Policy `json:"policy,omitempty"` 1222 1223 // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the 1224 // policy to modify. Only 1225 // the fields in the mask will be modified. If no mask is provided, 1226 // the 1227 // following default mask is used: 1228 // paths: "bindings, etag" 1229 // This field is only used by Cloud IAM. 1230 UpdateMask string `json:"updateMask,omitempty"` 1231 1232 // ForceSendFields is a list of field names (e.g. "Policy") to 1233 // unconditionally include in API requests. By default, fields with 1234 // empty values are omitted from API requests. However, any non-pointer, 1235 // non-interface field appearing in ForceSendFields will be sent to the 1236 // server regardless of whether the field is empty or not. This may be 1237 // used to include empty fields in Patch requests. 1238 ForceSendFields []string `json:"-"` 1239 1240 // NullFields is a list of field names (e.g. "Policy") to include in API 1241 // requests with the JSON null value. By default, fields with empty 1242 // values are omitted from API requests. However, any field with an 1243 // empty value appearing in NullFields will be sent to the server as 1244 // null. It is an error if a field in this list has a non-empty value. 1245 // This may be used to include null fields in Patch requests. 1246 NullFields []string `json:"-"` 1247} 1248 1249func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) { 1250 type NoMethod SetIamPolicyRequest 1251 raw := NoMethod(*s) 1252 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1253} 1254 1255// Status: The `Status` type defines a logical error model that is 1256// suitable for 1257// different programming environments, including REST APIs and RPC APIs. 1258// It is 1259// used by [gRPC](https://github.com/grpc). Each `Status` message 1260// contains 1261// three pieces of data: error code, error message, and error 1262// details. 1263// 1264// You can find out more about this error model and how to work with it 1265// in the 1266// [API Design Guide](https://cloud.google.com/apis/design/errors). 1267type Status struct { 1268 // Code: The status code, which should be an enum value of 1269 // google.rpc.Code. 1270 Code int64 `json:"code,omitempty"` 1271 1272 // Details: A list of messages that carry the error details. There is a 1273 // common set of 1274 // message types for APIs to use. 1275 Details []googleapi.RawMessage `json:"details,omitempty"` 1276 1277 // Message: A developer-facing error message, which should be in 1278 // English. Any 1279 // user-facing error message should be localized and sent in 1280 // the 1281 // google.rpc.Status.details field, or localized by the client. 1282 Message string `json:"message,omitempty"` 1283 1284 // ForceSendFields is a list of field names (e.g. "Code") to 1285 // unconditionally include in API requests. By default, fields with 1286 // empty values are omitted from API requests. However, any non-pointer, 1287 // non-interface field appearing in ForceSendFields will be sent to the 1288 // server regardless of whether the field is empty or not. This may be 1289 // used to include empty fields in Patch requests. 1290 ForceSendFields []string `json:"-"` 1291 1292 // NullFields is a list of field names (e.g. "Code") to include in API 1293 // requests with the JSON null value. By default, fields with empty 1294 // values are omitted from API requests. However, any field with an 1295 // empty value appearing in NullFields will be sent to the server as 1296 // null. It is an error if a field in this list has a non-empty value. 1297 // This may be used to include null fields in Patch requests. 1298 NullFields []string `json:"-"` 1299} 1300 1301func (s *Status) MarshalJSON() ([]byte, error) { 1302 type NoMethod Status 1303 raw := NoMethod(*s) 1304 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1305} 1306 1307// TestIamPermissionsRequest: Request message for `TestIamPermissions` 1308// method. 1309type TestIamPermissionsRequest struct { 1310 // Permissions: The set of permissions to check for the `resource`. 1311 // Permissions with 1312 // wildcards (such as '*' or 'storage.*') are not allowed. For 1313 // more 1314 // information see 1315 // [IAM 1316 // Overview](https://cloud.google.com/iam/docs/overview#permissions). 1317 Permissions []string `json:"permissions,omitempty"` 1318 1319 // ForceSendFields is a list of field names (e.g. "Permissions") to 1320 // unconditionally include in API requests. By default, fields with 1321 // empty values are omitted from API requests. However, any non-pointer, 1322 // non-interface field appearing in ForceSendFields will be sent to the 1323 // server regardless of whether the field is empty or not. This may be 1324 // used to include empty fields in Patch requests. 1325 ForceSendFields []string `json:"-"` 1326 1327 // NullFields is a list of field names (e.g. "Permissions") to include 1328 // in API requests with the JSON null value. By default, fields with 1329 // empty values are omitted from API requests. However, any field with 1330 // an empty value appearing in NullFields will be sent to the server as 1331 // null. It is an error if a field in this list has a non-empty value. 1332 // This may be used to include null fields in Patch requests. 1333 NullFields []string `json:"-"` 1334} 1335 1336func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) { 1337 type NoMethod TestIamPermissionsRequest 1338 raw := NoMethod(*s) 1339 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1340} 1341 1342// TestIamPermissionsResponse: Response message for `TestIamPermissions` 1343// method. 1344type TestIamPermissionsResponse struct { 1345 // Permissions: A subset of `TestPermissionsRequest.permissions` that 1346 // the caller is 1347 // allowed. 1348 Permissions []string `json:"permissions,omitempty"` 1349 1350 // ServerResponse contains the HTTP response code and headers from the 1351 // server. 1352 googleapi.ServerResponse `json:"-"` 1353 1354 // ForceSendFields is a list of field names (e.g. "Permissions") to 1355 // unconditionally include in API requests. By default, fields with 1356 // empty values are omitted from API requests. However, any non-pointer, 1357 // non-interface field appearing in ForceSendFields will be sent to the 1358 // server regardless of whether the field is empty or not. This may be 1359 // used to include empty fields in Patch requests. 1360 ForceSendFields []string `json:"-"` 1361 1362 // NullFields is a list of field names (e.g. "Permissions") to include 1363 // in API requests with the JSON null value. By default, fields with 1364 // empty values are omitted from API requests. However, any field with 1365 // an empty value appearing in NullFields will be sent to the server as 1366 // null. It is an error if a field in this list has a non-empty value. 1367 // This may be used to include null fields in Patch requests. 1368 NullFields []string `json:"-"` 1369} 1370 1371func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) { 1372 type NoMethod TestIamPermissionsResponse 1373 raw := NoMethod(*s) 1374 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1375} 1376 1377// UndeleteFolderRequest: The UndeleteFolder request message. 1378type UndeleteFolderRequest struct { 1379} 1380 1381// method id "cloudresourcemanager.folders.create": 1382 1383type FoldersCreateCall struct { 1384 s *Service 1385 folder *Folder 1386 urlParams_ gensupport.URLParams 1387 ctx_ context.Context 1388 header_ http.Header 1389} 1390 1391// Create: Creates a Folder in the resource hierarchy. 1392// Returns an Operation which can be used to track the progress of 1393// the 1394// folder creation workflow. 1395// Upon success the Operation.response field will be populated with 1396// the 1397// created Folder. 1398// 1399// In order to succeed, the addition of this new Folder must not 1400// violate 1401// the Folder naming, height or fanout constraints. 1402// 1403// + The Folder's display_name must be distinct from all other Folder's 1404// that 1405// share its parent. 1406// + The addition of the Folder must not cause the active Folder 1407// hierarchy 1408// to exceed a height of 4. Note, the full active + deleted Folder 1409// hierarchy 1410// is allowed to reach a height of 8; this provides additional headroom 1411// when 1412// moving folders that contain deleted folders. 1413// + The addition of the Folder must not cause the total number of 1414// Folders 1415// under its parent to exceed 100. 1416// 1417// If the operation fails due to a folder constraint violation, some 1418// errors 1419// may be returned by the CreateFolder request, with status 1420// code 1421// FAILED_PRECONDITION and an error description. Other folder 1422// constraint 1423// violations will be communicated in the Operation, with the 1424// specific 1425// PreconditionFailure returned via the details list in the 1426// Operation.error 1427// field. 1428// 1429// The caller must have `resourcemanager.folders.create` permission on 1430// the 1431// identified parent. 1432func (r *FoldersService) Create(folder *Folder) *FoldersCreateCall { 1433 c := &FoldersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1434 c.folder = folder 1435 return c 1436} 1437 1438// Parent sets the optional parameter "parent": Required. The resource 1439// name of the new Folder's parent. 1440// Must be of the form `folders/{folder_id}` or 1441// `organizations/{org_id}`. 1442func (c *FoldersCreateCall) Parent(parent string) *FoldersCreateCall { 1443 c.urlParams_.Set("parent", parent) 1444 return c 1445} 1446 1447// Fields allows partial responses to be retrieved. See 1448// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1449// for more information. 1450func (c *FoldersCreateCall) Fields(s ...googleapi.Field) *FoldersCreateCall { 1451 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1452 return c 1453} 1454 1455// Context sets the context to be used in this call's Do method. Any 1456// pending HTTP request will be aborted if the provided context is 1457// canceled. 1458func (c *FoldersCreateCall) Context(ctx context.Context) *FoldersCreateCall { 1459 c.ctx_ = ctx 1460 return c 1461} 1462 1463// Header returns an http.Header that can be modified by the caller to 1464// add HTTP headers to the request. 1465func (c *FoldersCreateCall) Header() http.Header { 1466 if c.header_ == nil { 1467 c.header_ = make(http.Header) 1468 } 1469 return c.header_ 1470} 1471 1472func (c *FoldersCreateCall) doRequest(alt string) (*http.Response, error) { 1473 reqHeaders := make(http.Header) 1474 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1475 for k, v := range c.header_ { 1476 reqHeaders[k] = v 1477 } 1478 reqHeaders.Set("User-Agent", c.s.userAgent()) 1479 var body io.Reader = nil 1480 body, err := googleapi.WithoutDataWrapper.JSONReader(c.folder) 1481 if err != nil { 1482 return nil, err 1483 } 1484 reqHeaders.Set("Content-Type", "application/json") 1485 c.urlParams_.Set("alt", alt) 1486 c.urlParams_.Set("prettyPrint", "false") 1487 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/folders") 1488 urls += "?" + c.urlParams_.Encode() 1489 req, err := http.NewRequest("POST", urls, body) 1490 if err != nil { 1491 return nil, err 1492 } 1493 req.Header = reqHeaders 1494 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1495} 1496 1497// Do executes the "cloudresourcemanager.folders.create" call. 1498// Exactly one of *Operation or error will be non-nil. Any non-2xx 1499// status code is an error. Response headers are in either 1500// *Operation.ServerResponse.Header or (if a response was returned at 1501// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1502// to check whether the returned error was because 1503// http.StatusNotModified was returned. 1504func (c *FoldersCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1505 gensupport.SetOptions(c.urlParams_, opts...) 1506 res, err := c.doRequest("json") 1507 if res != nil && res.StatusCode == http.StatusNotModified { 1508 if res.Body != nil { 1509 res.Body.Close() 1510 } 1511 return nil, &googleapi.Error{ 1512 Code: res.StatusCode, 1513 Header: res.Header, 1514 } 1515 } 1516 if err != nil { 1517 return nil, err 1518 } 1519 defer googleapi.CloseBody(res) 1520 if err := googleapi.CheckResponse(res); err != nil { 1521 return nil, err 1522 } 1523 ret := &Operation{ 1524 ServerResponse: googleapi.ServerResponse{ 1525 Header: res.Header, 1526 HTTPStatusCode: res.StatusCode, 1527 }, 1528 } 1529 target := &ret 1530 if err := gensupport.DecodeResponse(target, res); err != nil { 1531 return nil, err 1532 } 1533 return ret, nil 1534 // { 1535 // "description": "Creates a Folder in the resource hierarchy.\nReturns an Operation which can be used to track the progress of the\nfolder creation workflow.\nUpon success the Operation.response field will be populated with the\ncreated Folder.\n\nIn order to succeed, the addition of this new Folder must not violate\nthe Folder naming, height or fanout constraints.\n\n+ The Folder's display_name must be distinct from all other Folder's that\nshare its parent.\n+ The addition of the Folder must not cause the active Folder hierarchy\nto exceed a height of 4. Note, the full active + deleted Folder hierarchy\nis allowed to reach a height of 8; this provides additional headroom when\nmoving folders that contain deleted folders.\n+ The addition of the Folder must not cause the total number of Folders\nunder its parent to exceed 100.\n\nIf the operation fails due to a folder constraint violation, some errors\nmay be returned by the CreateFolder request, with status code\nFAILED_PRECONDITION and an error description. Other folder constraint\nviolations will be communicated in the Operation, with the specific\nPreconditionFailure returned via the details list in the Operation.error\nfield.\n\nThe caller must have `resourcemanager.folders.create` permission on the\nidentified parent.", 1536 // "flatPath": "v2/folders", 1537 // "httpMethod": "POST", 1538 // "id": "cloudresourcemanager.folders.create", 1539 // "parameterOrder": [], 1540 // "parameters": { 1541 // "parent": { 1542 // "description": "Required. The resource name of the new Folder's parent.\nMust be of the form `folders/{folder_id}` or `organizations/{org_id}`.", 1543 // "location": "query", 1544 // "type": "string" 1545 // } 1546 // }, 1547 // "path": "v2/folders", 1548 // "request": { 1549 // "$ref": "Folder" 1550 // }, 1551 // "response": { 1552 // "$ref": "Operation" 1553 // }, 1554 // "scopes": [ 1555 // "https://www.googleapis.com/auth/cloud-platform" 1556 // ] 1557 // } 1558 1559} 1560 1561// method id "cloudresourcemanager.folders.delete": 1562 1563type FoldersDeleteCall struct { 1564 s *Service 1565 name string 1566 urlParams_ gensupport.URLParams 1567 ctx_ context.Context 1568 header_ http.Header 1569} 1570 1571// Delete: Requests deletion of a Folder. The Folder is moved into 1572// the 1573// DELETE_REQUESTED state 1574// immediately, and is deleted approximately 30 days later. This method 1575// may 1576// only be called on an empty Folder in the 1577// ACTIVE state, where a Folder is empty if 1578// it doesn't contain any Folders or Projects in the 1579// ACTIVE state. 1580// The caller must have `resourcemanager.folders.delete` permission on 1581// the 1582// identified folder. 1583func (r *FoldersService) Delete(name string) *FoldersDeleteCall { 1584 c := &FoldersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1585 c.name = name 1586 return c 1587} 1588 1589// Fields allows partial responses to be retrieved. See 1590// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1591// for more information. 1592func (c *FoldersDeleteCall) Fields(s ...googleapi.Field) *FoldersDeleteCall { 1593 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1594 return c 1595} 1596 1597// Context sets the context to be used in this call's Do method. Any 1598// pending HTTP request will be aborted if the provided context is 1599// canceled. 1600func (c *FoldersDeleteCall) Context(ctx context.Context) *FoldersDeleteCall { 1601 c.ctx_ = ctx 1602 return c 1603} 1604 1605// Header returns an http.Header that can be modified by the caller to 1606// add HTTP headers to the request. 1607func (c *FoldersDeleteCall) Header() http.Header { 1608 if c.header_ == nil { 1609 c.header_ = make(http.Header) 1610 } 1611 return c.header_ 1612} 1613 1614func (c *FoldersDeleteCall) doRequest(alt string) (*http.Response, error) { 1615 reqHeaders := make(http.Header) 1616 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1617 for k, v := range c.header_ { 1618 reqHeaders[k] = v 1619 } 1620 reqHeaders.Set("User-Agent", c.s.userAgent()) 1621 var body io.Reader = nil 1622 c.urlParams_.Set("alt", alt) 1623 c.urlParams_.Set("prettyPrint", "false") 1624 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}") 1625 urls += "?" + c.urlParams_.Encode() 1626 req, err := http.NewRequest("DELETE", urls, body) 1627 if err != nil { 1628 return nil, err 1629 } 1630 req.Header = reqHeaders 1631 googleapi.Expand(req.URL, map[string]string{ 1632 "name": c.name, 1633 }) 1634 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1635} 1636 1637// Do executes the "cloudresourcemanager.folders.delete" call. 1638// Exactly one of *Folder or error will be non-nil. Any non-2xx status 1639// code is an error. Response headers are in either 1640// *Folder.ServerResponse.Header or (if a response was returned at all) 1641// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1642// check whether the returned error was because http.StatusNotModified 1643// was returned. 1644func (c *FoldersDeleteCall) Do(opts ...googleapi.CallOption) (*Folder, error) { 1645 gensupport.SetOptions(c.urlParams_, opts...) 1646 res, err := c.doRequest("json") 1647 if res != nil && res.StatusCode == http.StatusNotModified { 1648 if res.Body != nil { 1649 res.Body.Close() 1650 } 1651 return nil, &googleapi.Error{ 1652 Code: res.StatusCode, 1653 Header: res.Header, 1654 } 1655 } 1656 if err != nil { 1657 return nil, err 1658 } 1659 defer googleapi.CloseBody(res) 1660 if err := googleapi.CheckResponse(res); err != nil { 1661 return nil, err 1662 } 1663 ret := &Folder{ 1664 ServerResponse: googleapi.ServerResponse{ 1665 Header: res.Header, 1666 HTTPStatusCode: res.StatusCode, 1667 }, 1668 } 1669 target := &ret 1670 if err := gensupport.DecodeResponse(target, res); err != nil { 1671 return nil, err 1672 } 1673 return ret, nil 1674 // { 1675 // "description": "Requests deletion of a Folder. The Folder is moved into the\nDELETE_REQUESTED state\nimmediately, and is deleted approximately 30 days later. This method may\nonly be called on an empty Folder in the\nACTIVE state, where a Folder is empty if\nit doesn't contain any Folders or Projects in the\nACTIVE state.\nThe caller must have `resourcemanager.folders.delete` permission on the\nidentified folder.", 1676 // "flatPath": "v2/folders/{foldersId}", 1677 // "httpMethod": "DELETE", 1678 // "id": "cloudresourcemanager.folders.delete", 1679 // "parameterOrder": [ 1680 // "name" 1681 // ], 1682 // "parameters": { 1683 // "name": { 1684 // "description": "Required. the resource name of the Folder to be deleted.\nMust be of the form `folders/{folder_id}`.", 1685 // "location": "path", 1686 // "pattern": "^folders/[^/]+$", 1687 // "required": true, 1688 // "type": "string" 1689 // } 1690 // }, 1691 // "path": "v2/{+name}", 1692 // "response": { 1693 // "$ref": "Folder" 1694 // }, 1695 // "scopes": [ 1696 // "https://www.googleapis.com/auth/cloud-platform" 1697 // ] 1698 // } 1699 1700} 1701 1702// method id "cloudresourcemanager.folders.get": 1703 1704type FoldersGetCall struct { 1705 s *Service 1706 name string 1707 urlParams_ gensupport.URLParams 1708 ifNoneMatch_ string 1709 ctx_ context.Context 1710 header_ http.Header 1711} 1712 1713// Get: Retrieves a Folder identified by the supplied resource 1714// name. 1715// Valid Folder resource names have the format 1716// `folders/{folder_id}` 1717// (for example, `folders/1234`). 1718// The caller must have `resourcemanager.folders.get` permission on 1719// the 1720// identified folder. 1721func (r *FoldersService) Get(name string) *FoldersGetCall { 1722 c := &FoldersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1723 c.name = name 1724 return c 1725} 1726 1727// Fields allows partial responses to be retrieved. See 1728// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1729// for more information. 1730func (c *FoldersGetCall) Fields(s ...googleapi.Field) *FoldersGetCall { 1731 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1732 return c 1733} 1734 1735// IfNoneMatch sets the optional parameter which makes the operation 1736// fail if the object's ETag matches the given value. This is useful for 1737// getting updates only after the object has changed since the last 1738// request. Use googleapi.IsNotModified to check whether the response 1739// error from Do is the result of In-None-Match. 1740func (c *FoldersGetCall) IfNoneMatch(entityTag string) *FoldersGetCall { 1741 c.ifNoneMatch_ = entityTag 1742 return c 1743} 1744 1745// Context sets the context to be used in this call's Do method. Any 1746// pending HTTP request will be aborted if the provided context is 1747// canceled. 1748func (c *FoldersGetCall) Context(ctx context.Context) *FoldersGetCall { 1749 c.ctx_ = ctx 1750 return c 1751} 1752 1753// Header returns an http.Header that can be modified by the caller to 1754// add HTTP headers to the request. 1755func (c *FoldersGetCall) Header() http.Header { 1756 if c.header_ == nil { 1757 c.header_ = make(http.Header) 1758 } 1759 return c.header_ 1760} 1761 1762func (c *FoldersGetCall) doRequest(alt string) (*http.Response, error) { 1763 reqHeaders := make(http.Header) 1764 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1765 for k, v := range c.header_ { 1766 reqHeaders[k] = v 1767 } 1768 reqHeaders.Set("User-Agent", c.s.userAgent()) 1769 if c.ifNoneMatch_ != "" { 1770 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1771 } 1772 var body io.Reader = nil 1773 c.urlParams_.Set("alt", alt) 1774 c.urlParams_.Set("prettyPrint", "false") 1775 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}") 1776 urls += "?" + c.urlParams_.Encode() 1777 req, err := http.NewRequest("GET", urls, body) 1778 if err != nil { 1779 return nil, err 1780 } 1781 req.Header = reqHeaders 1782 googleapi.Expand(req.URL, map[string]string{ 1783 "name": c.name, 1784 }) 1785 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1786} 1787 1788// Do executes the "cloudresourcemanager.folders.get" call. 1789// Exactly one of *Folder or error will be non-nil. Any non-2xx status 1790// code is an error. Response headers are in either 1791// *Folder.ServerResponse.Header or (if a response was returned at all) 1792// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1793// check whether the returned error was because http.StatusNotModified 1794// was returned. 1795func (c *FoldersGetCall) Do(opts ...googleapi.CallOption) (*Folder, error) { 1796 gensupport.SetOptions(c.urlParams_, opts...) 1797 res, err := c.doRequest("json") 1798 if res != nil && res.StatusCode == http.StatusNotModified { 1799 if res.Body != nil { 1800 res.Body.Close() 1801 } 1802 return nil, &googleapi.Error{ 1803 Code: res.StatusCode, 1804 Header: res.Header, 1805 } 1806 } 1807 if err != nil { 1808 return nil, err 1809 } 1810 defer googleapi.CloseBody(res) 1811 if err := googleapi.CheckResponse(res); err != nil { 1812 return nil, err 1813 } 1814 ret := &Folder{ 1815 ServerResponse: googleapi.ServerResponse{ 1816 Header: res.Header, 1817 HTTPStatusCode: res.StatusCode, 1818 }, 1819 } 1820 target := &ret 1821 if err := gensupport.DecodeResponse(target, res); err != nil { 1822 return nil, err 1823 } 1824 return ret, nil 1825 // { 1826 // "description": "Retrieves a Folder identified by the supplied resource name.\nValid Folder resource names have the format `folders/{folder_id}`\n(for example, `folders/1234`).\nThe caller must have `resourcemanager.folders.get` permission on the\nidentified folder.", 1827 // "flatPath": "v2/folders/{foldersId}", 1828 // "httpMethod": "GET", 1829 // "id": "cloudresourcemanager.folders.get", 1830 // "parameterOrder": [ 1831 // "name" 1832 // ], 1833 // "parameters": { 1834 // "name": { 1835 // "description": "Required. The resource name of the Folder to retrieve.\nMust be of the form `folders/{folder_id}`.", 1836 // "location": "path", 1837 // "pattern": "^folders/[^/]+$", 1838 // "required": true, 1839 // "type": "string" 1840 // } 1841 // }, 1842 // "path": "v2/{+name}", 1843 // "response": { 1844 // "$ref": "Folder" 1845 // }, 1846 // "scopes": [ 1847 // "https://www.googleapis.com/auth/cloud-platform", 1848 // "https://www.googleapis.com/auth/cloud-platform.read-only" 1849 // ] 1850 // } 1851 1852} 1853 1854// method id "cloudresourcemanager.folders.getIamPolicy": 1855 1856type FoldersGetIamPolicyCall struct { 1857 s *Service 1858 resource string 1859 getiampolicyrequest *GetIamPolicyRequest 1860 urlParams_ gensupport.URLParams 1861 ctx_ context.Context 1862 header_ http.Header 1863} 1864 1865// GetIamPolicy: Gets the access control policy for a Folder. The 1866// returned policy may be 1867// empty if no such policy or resource exists. The `resource` field 1868// should 1869// be the Folder's resource name, e.g. "folders/1234". 1870// The caller must have `resourcemanager.folders.getIamPolicy` 1871// permission 1872// on the identified folder. 1873func (r *FoldersService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *FoldersGetIamPolicyCall { 1874 c := &FoldersGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1875 c.resource = resource 1876 c.getiampolicyrequest = getiampolicyrequest 1877 return c 1878} 1879 1880// Fields allows partial responses to be retrieved. See 1881// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1882// for more information. 1883func (c *FoldersGetIamPolicyCall) Fields(s ...googleapi.Field) *FoldersGetIamPolicyCall { 1884 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1885 return c 1886} 1887 1888// Context sets the context to be used in this call's Do method. Any 1889// pending HTTP request will be aborted if the provided context is 1890// canceled. 1891func (c *FoldersGetIamPolicyCall) Context(ctx context.Context) *FoldersGetIamPolicyCall { 1892 c.ctx_ = ctx 1893 return c 1894} 1895 1896// Header returns an http.Header that can be modified by the caller to 1897// add HTTP headers to the request. 1898func (c *FoldersGetIamPolicyCall) Header() http.Header { 1899 if c.header_ == nil { 1900 c.header_ = make(http.Header) 1901 } 1902 return c.header_ 1903} 1904 1905func (c *FoldersGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 1906 reqHeaders := make(http.Header) 1907 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1908 for k, v := range c.header_ { 1909 reqHeaders[k] = v 1910 } 1911 reqHeaders.Set("User-Agent", c.s.userAgent()) 1912 var body io.Reader = nil 1913 body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest) 1914 if err != nil { 1915 return nil, err 1916 } 1917 reqHeaders.Set("Content-Type", "application/json") 1918 c.urlParams_.Set("alt", alt) 1919 c.urlParams_.Set("prettyPrint", "false") 1920 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+resource}:getIamPolicy") 1921 urls += "?" + c.urlParams_.Encode() 1922 req, err := http.NewRequest("POST", urls, body) 1923 if err != nil { 1924 return nil, err 1925 } 1926 req.Header = reqHeaders 1927 googleapi.Expand(req.URL, map[string]string{ 1928 "resource": c.resource, 1929 }) 1930 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1931} 1932 1933// Do executes the "cloudresourcemanager.folders.getIamPolicy" call. 1934// Exactly one of *Policy or error will be non-nil. Any non-2xx status 1935// code is an error. Response headers are in either 1936// *Policy.ServerResponse.Header or (if a response was returned at all) 1937// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1938// check whether the returned error was because http.StatusNotModified 1939// was returned. 1940func (c *FoldersGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 1941 gensupport.SetOptions(c.urlParams_, opts...) 1942 res, err := c.doRequest("json") 1943 if res != nil && res.StatusCode == http.StatusNotModified { 1944 if res.Body != nil { 1945 res.Body.Close() 1946 } 1947 return nil, &googleapi.Error{ 1948 Code: res.StatusCode, 1949 Header: res.Header, 1950 } 1951 } 1952 if err != nil { 1953 return nil, err 1954 } 1955 defer googleapi.CloseBody(res) 1956 if err := googleapi.CheckResponse(res); err != nil { 1957 return nil, err 1958 } 1959 ret := &Policy{ 1960 ServerResponse: googleapi.ServerResponse{ 1961 Header: res.Header, 1962 HTTPStatusCode: res.StatusCode, 1963 }, 1964 } 1965 target := &ret 1966 if err := gensupport.DecodeResponse(target, res); err != nil { 1967 return nil, err 1968 } 1969 return ret, nil 1970 // { 1971 // "description": "Gets the access control policy for a Folder. The returned policy may be\nempty if no such policy or resource exists. The `resource` field should\nbe the Folder's resource name, e.g. \"folders/1234\".\nThe caller must have `resourcemanager.folders.getIamPolicy` permission\non the identified folder.", 1972 // "flatPath": "v2/folders/{foldersId}:getIamPolicy", 1973 // "httpMethod": "POST", 1974 // "id": "cloudresourcemanager.folders.getIamPolicy", 1975 // "parameterOrder": [ 1976 // "resource" 1977 // ], 1978 // "parameters": { 1979 // "resource": { 1980 // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.", 1981 // "location": "path", 1982 // "pattern": "^folders/[^/]+$", 1983 // "required": true, 1984 // "type": "string" 1985 // } 1986 // }, 1987 // "path": "v2/{+resource}:getIamPolicy", 1988 // "request": { 1989 // "$ref": "GetIamPolicyRequest" 1990 // }, 1991 // "response": { 1992 // "$ref": "Policy" 1993 // }, 1994 // "scopes": [ 1995 // "https://www.googleapis.com/auth/cloud-platform", 1996 // "https://www.googleapis.com/auth/cloud-platform.read-only" 1997 // ] 1998 // } 1999 2000} 2001 2002// method id "cloudresourcemanager.folders.list": 2003 2004type FoldersListCall struct { 2005 s *Service 2006 urlParams_ gensupport.URLParams 2007 ifNoneMatch_ string 2008 ctx_ context.Context 2009 header_ http.Header 2010} 2011 2012// List: Lists the Folders that are direct descendants of supplied 2013// parent resource. 2014// List provides a strongly consistent view of the Folders 2015// underneath 2016// the specified parent resource. 2017// List returns Folders sorted based upon the (ascending) lexical 2018// ordering 2019// of their display_name. 2020// The caller must have `resourcemanager.folders.list` permission on 2021// the 2022// identified parent. 2023func (r *FoldersService) List() *FoldersListCall { 2024 c := &FoldersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2025 return c 2026} 2027 2028// PageSize sets the optional parameter "pageSize": The maximum number 2029// of Folders to return in the response. 2030func (c *FoldersListCall) PageSize(pageSize int64) *FoldersListCall { 2031 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2032 return c 2033} 2034 2035// PageToken sets the optional parameter "pageToken": A pagination token 2036// returned from a previous call to `ListFolders` 2037// that indicates where this listing should continue from. 2038func (c *FoldersListCall) PageToken(pageToken string) *FoldersListCall { 2039 c.urlParams_.Set("pageToken", pageToken) 2040 return c 2041} 2042 2043// Parent sets the optional parameter "parent": Required. The resource 2044// name of the Organization or Folder whose Folders are 2045// being listed. 2046// Must be of the form `folders/{folder_id}` or 2047// `organizations/{org_id}`. 2048// Access to this method is controlled by checking 2049// the 2050// `resourcemanager.folders.list` permission on the `parent`. 2051func (c *FoldersListCall) Parent(parent string) *FoldersListCall { 2052 c.urlParams_.Set("parent", parent) 2053 return c 2054} 2055 2056// ShowDeleted sets the optional parameter "showDeleted": Controls 2057// whether Folders in the 2058// DELETE_REQUESTED 2059// state should be returned. Defaults to false. 2060func (c *FoldersListCall) ShowDeleted(showDeleted bool) *FoldersListCall { 2061 c.urlParams_.Set("showDeleted", fmt.Sprint(showDeleted)) 2062 return c 2063} 2064 2065// Fields allows partial responses to be retrieved. See 2066// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2067// for more information. 2068func (c *FoldersListCall) Fields(s ...googleapi.Field) *FoldersListCall { 2069 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2070 return c 2071} 2072 2073// IfNoneMatch sets the optional parameter which makes the operation 2074// fail if the object's ETag matches the given value. This is useful for 2075// getting updates only after the object has changed since the last 2076// request. Use googleapi.IsNotModified to check whether the response 2077// error from Do is the result of In-None-Match. 2078func (c *FoldersListCall) IfNoneMatch(entityTag string) *FoldersListCall { 2079 c.ifNoneMatch_ = entityTag 2080 return c 2081} 2082 2083// Context sets the context to be used in this call's Do method. Any 2084// pending HTTP request will be aborted if the provided context is 2085// canceled. 2086func (c *FoldersListCall) Context(ctx context.Context) *FoldersListCall { 2087 c.ctx_ = ctx 2088 return c 2089} 2090 2091// Header returns an http.Header that can be modified by the caller to 2092// add HTTP headers to the request. 2093func (c *FoldersListCall) Header() http.Header { 2094 if c.header_ == nil { 2095 c.header_ = make(http.Header) 2096 } 2097 return c.header_ 2098} 2099 2100func (c *FoldersListCall) doRequest(alt string) (*http.Response, error) { 2101 reqHeaders := make(http.Header) 2102 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2103 for k, v := range c.header_ { 2104 reqHeaders[k] = v 2105 } 2106 reqHeaders.Set("User-Agent", c.s.userAgent()) 2107 if c.ifNoneMatch_ != "" { 2108 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2109 } 2110 var body io.Reader = nil 2111 c.urlParams_.Set("alt", alt) 2112 c.urlParams_.Set("prettyPrint", "false") 2113 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/folders") 2114 urls += "?" + c.urlParams_.Encode() 2115 req, err := http.NewRequest("GET", urls, body) 2116 if err != nil { 2117 return nil, err 2118 } 2119 req.Header = reqHeaders 2120 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2121} 2122 2123// Do executes the "cloudresourcemanager.folders.list" call. 2124// Exactly one of *ListFoldersResponse or error will be non-nil. Any 2125// non-2xx status code is an error. Response headers are in either 2126// *ListFoldersResponse.ServerResponse.Header or (if a response was 2127// returned at all) in error.(*googleapi.Error).Header. Use 2128// googleapi.IsNotModified to check whether the returned error was 2129// because http.StatusNotModified was returned. 2130func (c *FoldersListCall) Do(opts ...googleapi.CallOption) (*ListFoldersResponse, error) { 2131 gensupport.SetOptions(c.urlParams_, opts...) 2132 res, err := c.doRequest("json") 2133 if res != nil && res.StatusCode == http.StatusNotModified { 2134 if res.Body != nil { 2135 res.Body.Close() 2136 } 2137 return nil, &googleapi.Error{ 2138 Code: res.StatusCode, 2139 Header: res.Header, 2140 } 2141 } 2142 if err != nil { 2143 return nil, err 2144 } 2145 defer googleapi.CloseBody(res) 2146 if err := googleapi.CheckResponse(res); err != nil { 2147 return nil, err 2148 } 2149 ret := &ListFoldersResponse{ 2150 ServerResponse: googleapi.ServerResponse{ 2151 Header: res.Header, 2152 HTTPStatusCode: res.StatusCode, 2153 }, 2154 } 2155 target := &ret 2156 if err := gensupport.DecodeResponse(target, res); err != nil { 2157 return nil, err 2158 } 2159 return ret, nil 2160 // { 2161 // "description": "Lists the Folders that are direct descendants of supplied parent resource.\nList provides a strongly consistent view of the Folders underneath\nthe specified parent resource.\nList returns Folders sorted based upon the (ascending) lexical ordering\nof their display_name.\nThe caller must have `resourcemanager.folders.list` permission on the\nidentified parent.", 2162 // "flatPath": "v2/folders", 2163 // "httpMethod": "GET", 2164 // "id": "cloudresourcemanager.folders.list", 2165 // "parameterOrder": [], 2166 // "parameters": { 2167 // "pageSize": { 2168 // "description": "Optional. The maximum number of Folders to return in the response.", 2169 // "format": "int32", 2170 // "location": "query", 2171 // "type": "integer" 2172 // }, 2173 // "pageToken": { 2174 // "description": "Optional. A pagination token returned from a previous call to `ListFolders`\nthat indicates where this listing should continue from.", 2175 // "location": "query", 2176 // "type": "string" 2177 // }, 2178 // "parent": { 2179 // "description": "Required. The resource name of the Organization or Folder whose Folders are\nbeing listed.\nMust be of the form `folders/{folder_id}` or `organizations/{org_id}`.\nAccess to this method is controlled by checking the\n`resourcemanager.folders.list` permission on the `parent`.", 2180 // "location": "query", 2181 // "type": "string" 2182 // }, 2183 // "showDeleted": { 2184 // "description": "Optional. Controls whether Folders in the\nDELETE_REQUESTED\nstate should be returned. Defaults to false.", 2185 // "location": "query", 2186 // "type": "boolean" 2187 // } 2188 // }, 2189 // "path": "v2/folders", 2190 // "response": { 2191 // "$ref": "ListFoldersResponse" 2192 // }, 2193 // "scopes": [ 2194 // "https://www.googleapis.com/auth/cloud-platform", 2195 // "https://www.googleapis.com/auth/cloud-platform.read-only" 2196 // ] 2197 // } 2198 2199} 2200 2201// Pages invokes f for each page of results. 2202// A non-nil error returned from f will halt the iteration. 2203// The provided context supersedes any context provided to the Context method. 2204func (c *FoldersListCall) Pages(ctx context.Context, f func(*ListFoldersResponse) error) error { 2205 c.ctx_ = ctx 2206 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2207 for { 2208 x, err := c.Do() 2209 if err != nil { 2210 return err 2211 } 2212 if err := f(x); err != nil { 2213 return err 2214 } 2215 if x.NextPageToken == "" { 2216 return nil 2217 } 2218 c.PageToken(x.NextPageToken) 2219 } 2220} 2221 2222// method id "cloudresourcemanager.folders.move": 2223 2224type FoldersMoveCall struct { 2225 s *Service 2226 name string 2227 movefolderrequest *MoveFolderRequest 2228 urlParams_ gensupport.URLParams 2229 ctx_ context.Context 2230 header_ http.Header 2231} 2232 2233// Move: Moves a Folder under a new resource parent. 2234// Returns an Operation which can be used to track the progress of 2235// the 2236// folder move workflow. 2237// Upon success the Operation.response field will be populated with 2238// the 2239// moved Folder. 2240// Upon failure, a FolderOperationError categorizing the failure cause 2241// will 2242// be returned - if the failure occurs synchronously then 2243// the 2244// FolderOperationError will be returned via the Status.details 2245// field 2246// and if it occurs asynchronously then the FolderOperation will be 2247// returned 2248// via the Operation.error field. 2249// In addition, the Operation.metadata field will be populated with 2250// a 2251// FolderOperation message as an aid to stateless clients. 2252// Folder moves will be rejected if they violate either the naming, 2253// height 2254// or fanout constraints described in the 2255// CreateFolder documentation. 2256// The caller must have `resourcemanager.folders.move` permission on 2257// the 2258// folder's current and proposed new parent. 2259func (r *FoldersService) Move(name string, movefolderrequest *MoveFolderRequest) *FoldersMoveCall { 2260 c := &FoldersMoveCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2261 c.name = name 2262 c.movefolderrequest = movefolderrequest 2263 return c 2264} 2265 2266// Fields allows partial responses to be retrieved. See 2267// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2268// for more information. 2269func (c *FoldersMoveCall) Fields(s ...googleapi.Field) *FoldersMoveCall { 2270 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2271 return c 2272} 2273 2274// Context sets the context to be used in this call's Do method. Any 2275// pending HTTP request will be aborted if the provided context is 2276// canceled. 2277func (c *FoldersMoveCall) Context(ctx context.Context) *FoldersMoveCall { 2278 c.ctx_ = ctx 2279 return c 2280} 2281 2282// Header returns an http.Header that can be modified by the caller to 2283// add HTTP headers to the request. 2284func (c *FoldersMoveCall) Header() http.Header { 2285 if c.header_ == nil { 2286 c.header_ = make(http.Header) 2287 } 2288 return c.header_ 2289} 2290 2291func (c *FoldersMoveCall) doRequest(alt string) (*http.Response, error) { 2292 reqHeaders := make(http.Header) 2293 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2294 for k, v := range c.header_ { 2295 reqHeaders[k] = v 2296 } 2297 reqHeaders.Set("User-Agent", c.s.userAgent()) 2298 var body io.Reader = nil 2299 body, err := googleapi.WithoutDataWrapper.JSONReader(c.movefolderrequest) 2300 if err != nil { 2301 return nil, err 2302 } 2303 reqHeaders.Set("Content-Type", "application/json") 2304 c.urlParams_.Set("alt", alt) 2305 c.urlParams_.Set("prettyPrint", "false") 2306 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:move") 2307 urls += "?" + c.urlParams_.Encode() 2308 req, err := http.NewRequest("POST", urls, body) 2309 if err != nil { 2310 return nil, err 2311 } 2312 req.Header = reqHeaders 2313 googleapi.Expand(req.URL, map[string]string{ 2314 "name": c.name, 2315 }) 2316 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2317} 2318 2319// Do executes the "cloudresourcemanager.folders.move" call. 2320// Exactly one of *Operation or error will be non-nil. Any non-2xx 2321// status code is an error. Response headers are in either 2322// *Operation.ServerResponse.Header or (if a response was returned at 2323// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2324// to check whether the returned error was because 2325// http.StatusNotModified was returned. 2326func (c *FoldersMoveCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2327 gensupport.SetOptions(c.urlParams_, opts...) 2328 res, err := c.doRequest("json") 2329 if res != nil && res.StatusCode == http.StatusNotModified { 2330 if res.Body != nil { 2331 res.Body.Close() 2332 } 2333 return nil, &googleapi.Error{ 2334 Code: res.StatusCode, 2335 Header: res.Header, 2336 } 2337 } 2338 if err != nil { 2339 return nil, err 2340 } 2341 defer googleapi.CloseBody(res) 2342 if err := googleapi.CheckResponse(res); err != nil { 2343 return nil, err 2344 } 2345 ret := &Operation{ 2346 ServerResponse: googleapi.ServerResponse{ 2347 Header: res.Header, 2348 HTTPStatusCode: res.StatusCode, 2349 }, 2350 } 2351 target := &ret 2352 if err := gensupport.DecodeResponse(target, res); err != nil { 2353 return nil, err 2354 } 2355 return ret, nil 2356 // { 2357 // "description": "Moves a Folder under a new resource parent.\nReturns an Operation which can be used to track the progress of the\nfolder move workflow.\nUpon success the Operation.response field will be populated with the\nmoved Folder.\nUpon failure, a FolderOperationError categorizing the failure cause will\nbe returned - if the failure occurs synchronously then the\nFolderOperationError will be returned via the Status.details field\nand if it occurs asynchronously then the FolderOperation will be returned\nvia the Operation.error field.\nIn addition, the Operation.metadata field will be populated with a\nFolderOperation message as an aid to stateless clients.\nFolder moves will be rejected if they violate either the naming, height\nor fanout constraints described in the\nCreateFolder documentation.\nThe caller must have `resourcemanager.folders.move` permission on the\nfolder's current and proposed new parent.", 2358 // "flatPath": "v2/folders/{foldersId}:move", 2359 // "httpMethod": "POST", 2360 // "id": "cloudresourcemanager.folders.move", 2361 // "parameterOrder": [ 2362 // "name" 2363 // ], 2364 // "parameters": { 2365 // "name": { 2366 // "description": "Required. The resource name of the Folder to move.\nMust be of the form folders/{folder_id}", 2367 // "location": "path", 2368 // "pattern": "^folders/[^/]+$", 2369 // "required": true, 2370 // "type": "string" 2371 // } 2372 // }, 2373 // "path": "v2/{+name}:move", 2374 // "request": { 2375 // "$ref": "MoveFolderRequest" 2376 // }, 2377 // "response": { 2378 // "$ref": "Operation" 2379 // }, 2380 // "scopes": [ 2381 // "https://www.googleapis.com/auth/cloud-platform" 2382 // ] 2383 // } 2384 2385} 2386 2387// method id "cloudresourcemanager.folders.patch": 2388 2389type FoldersPatchCall struct { 2390 s *Service 2391 name string 2392 folder *Folder 2393 urlParams_ gensupport.URLParams 2394 ctx_ context.Context 2395 header_ http.Header 2396} 2397 2398// Patch: Updates a Folder, changing its display_name. 2399// Changes to the folder display_name will be rejected if they violate 2400// either 2401// the display_name formatting rules or naming constraints described 2402// in 2403// the CreateFolder documentation. 2404// 2405// The Folder's display name must start and end with a letter or 2406// digit, 2407// may contain letters, digits, spaces, hyphens and underscores and can 2408// be 2409// no longer than 30 characters. This is captured by the regular 2410// expression: 2411// [\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?. 2412// The caller must have `resourcemanager.folders.update` permission on 2413// the 2414// identified folder. 2415// 2416// If the update fails due to the unique name constraint then 2417// a 2418// PreconditionFailure explaining this violation will be returned 2419// in the Status.details field. 2420func (r *FoldersService) Patch(name string, folder *Folder) *FoldersPatchCall { 2421 c := &FoldersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2422 c.name = name 2423 c.folder = folder 2424 return c 2425} 2426 2427// UpdateMask sets the optional parameter "updateMask": Required. Fields 2428// to be updated. 2429// Only the `display_name` can be updated. 2430func (c *FoldersPatchCall) UpdateMask(updateMask string) *FoldersPatchCall { 2431 c.urlParams_.Set("updateMask", updateMask) 2432 return c 2433} 2434 2435// Fields allows partial responses to be retrieved. See 2436// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2437// for more information. 2438func (c *FoldersPatchCall) Fields(s ...googleapi.Field) *FoldersPatchCall { 2439 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2440 return c 2441} 2442 2443// Context sets the context to be used in this call's Do method. Any 2444// pending HTTP request will be aborted if the provided context is 2445// canceled. 2446func (c *FoldersPatchCall) Context(ctx context.Context) *FoldersPatchCall { 2447 c.ctx_ = ctx 2448 return c 2449} 2450 2451// Header returns an http.Header that can be modified by the caller to 2452// add HTTP headers to the request. 2453func (c *FoldersPatchCall) Header() http.Header { 2454 if c.header_ == nil { 2455 c.header_ = make(http.Header) 2456 } 2457 return c.header_ 2458} 2459 2460func (c *FoldersPatchCall) doRequest(alt string) (*http.Response, error) { 2461 reqHeaders := make(http.Header) 2462 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2463 for k, v := range c.header_ { 2464 reqHeaders[k] = v 2465 } 2466 reqHeaders.Set("User-Agent", c.s.userAgent()) 2467 var body io.Reader = nil 2468 body, err := googleapi.WithoutDataWrapper.JSONReader(c.folder) 2469 if err != nil { 2470 return nil, err 2471 } 2472 reqHeaders.Set("Content-Type", "application/json") 2473 c.urlParams_.Set("alt", alt) 2474 c.urlParams_.Set("prettyPrint", "false") 2475 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}") 2476 urls += "?" + c.urlParams_.Encode() 2477 req, err := http.NewRequest("PATCH", urls, body) 2478 if err != nil { 2479 return nil, err 2480 } 2481 req.Header = reqHeaders 2482 googleapi.Expand(req.URL, map[string]string{ 2483 "name": c.name, 2484 }) 2485 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2486} 2487 2488// Do executes the "cloudresourcemanager.folders.patch" call. 2489// Exactly one of *Folder or error will be non-nil. Any non-2xx status 2490// code is an error. Response headers are in either 2491// *Folder.ServerResponse.Header or (if a response was returned at all) 2492// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2493// check whether the returned error was because http.StatusNotModified 2494// was returned. 2495func (c *FoldersPatchCall) Do(opts ...googleapi.CallOption) (*Folder, error) { 2496 gensupport.SetOptions(c.urlParams_, opts...) 2497 res, err := c.doRequest("json") 2498 if res != nil && res.StatusCode == http.StatusNotModified { 2499 if res.Body != nil { 2500 res.Body.Close() 2501 } 2502 return nil, &googleapi.Error{ 2503 Code: res.StatusCode, 2504 Header: res.Header, 2505 } 2506 } 2507 if err != nil { 2508 return nil, err 2509 } 2510 defer googleapi.CloseBody(res) 2511 if err := googleapi.CheckResponse(res); err != nil { 2512 return nil, err 2513 } 2514 ret := &Folder{ 2515 ServerResponse: googleapi.ServerResponse{ 2516 Header: res.Header, 2517 HTTPStatusCode: res.StatusCode, 2518 }, 2519 } 2520 target := &ret 2521 if err := gensupport.DecodeResponse(target, res); err != nil { 2522 return nil, err 2523 } 2524 return ret, nil 2525 // { 2526 // "description": "Updates a Folder, changing its display_name.\nChanges to the folder display_name will be rejected if they violate either\nthe display_name formatting rules or naming constraints described in\nthe CreateFolder documentation.\n\nThe Folder's display name must start and end with a letter or digit,\nmay contain letters, digits, spaces, hyphens and underscores and can be\nno longer than 30 characters. This is captured by the regular expression:\n[\\p{L}\\p{N}]([\\p{L}\\p{N}_- ]{0,28}[\\p{L}\\p{N}])?.\nThe caller must have `resourcemanager.folders.update` permission on the\nidentified folder.\n\nIf the update fails due to the unique name constraint then a\nPreconditionFailure explaining this violation will be returned\nin the Status.details field.", 2527 // "flatPath": "v2/folders/{foldersId}", 2528 // "httpMethod": "PATCH", 2529 // "id": "cloudresourcemanager.folders.patch", 2530 // "parameterOrder": [ 2531 // "name" 2532 // ], 2533 // "parameters": { 2534 // "name": { 2535 // "description": "Output only. The resource name of the Folder.\nIts format is `folders/{folder_id}`, for example: \"folders/1234\".", 2536 // "location": "path", 2537 // "pattern": "^folders/[^/]+$", 2538 // "required": true, 2539 // "type": "string" 2540 // }, 2541 // "updateMask": { 2542 // "description": "Required. Fields to be updated.\nOnly the `display_name` can be updated.", 2543 // "format": "google-fieldmask", 2544 // "location": "query", 2545 // "type": "string" 2546 // } 2547 // }, 2548 // "path": "v2/{+name}", 2549 // "request": { 2550 // "$ref": "Folder" 2551 // }, 2552 // "response": { 2553 // "$ref": "Folder" 2554 // }, 2555 // "scopes": [ 2556 // "https://www.googleapis.com/auth/cloud-platform" 2557 // ] 2558 // } 2559 2560} 2561 2562// method id "cloudresourcemanager.folders.search": 2563 2564type FoldersSearchCall struct { 2565 s *Service 2566 searchfoldersrequest *SearchFoldersRequest 2567 urlParams_ gensupport.URLParams 2568 ctx_ context.Context 2569 header_ http.Header 2570} 2571 2572// Search: Search for folders that match specific filter 2573// criteria. 2574// Search provides an eventually consistent view of the folders a user 2575// has 2576// access to which meet the specified filter criteria. 2577// 2578// This will only return folders on which the caller has the 2579// permission `resourcemanager.folders.get`. 2580func (r *FoldersService) Search(searchfoldersrequest *SearchFoldersRequest) *FoldersSearchCall { 2581 c := &FoldersSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2582 c.searchfoldersrequest = searchfoldersrequest 2583 return c 2584} 2585 2586// Fields allows partial responses to be retrieved. See 2587// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2588// for more information. 2589func (c *FoldersSearchCall) Fields(s ...googleapi.Field) *FoldersSearchCall { 2590 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2591 return c 2592} 2593 2594// Context sets the context to be used in this call's Do method. Any 2595// pending HTTP request will be aborted if the provided context is 2596// canceled. 2597func (c *FoldersSearchCall) Context(ctx context.Context) *FoldersSearchCall { 2598 c.ctx_ = ctx 2599 return c 2600} 2601 2602// Header returns an http.Header that can be modified by the caller to 2603// add HTTP headers to the request. 2604func (c *FoldersSearchCall) Header() http.Header { 2605 if c.header_ == nil { 2606 c.header_ = make(http.Header) 2607 } 2608 return c.header_ 2609} 2610 2611func (c *FoldersSearchCall) doRequest(alt string) (*http.Response, error) { 2612 reqHeaders := make(http.Header) 2613 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2614 for k, v := range c.header_ { 2615 reqHeaders[k] = v 2616 } 2617 reqHeaders.Set("User-Agent", c.s.userAgent()) 2618 var body io.Reader = nil 2619 body, err := googleapi.WithoutDataWrapper.JSONReader(c.searchfoldersrequest) 2620 if err != nil { 2621 return nil, err 2622 } 2623 reqHeaders.Set("Content-Type", "application/json") 2624 c.urlParams_.Set("alt", alt) 2625 c.urlParams_.Set("prettyPrint", "false") 2626 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/folders:search") 2627 urls += "?" + c.urlParams_.Encode() 2628 req, err := http.NewRequest("POST", urls, body) 2629 if err != nil { 2630 return nil, err 2631 } 2632 req.Header = reqHeaders 2633 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2634} 2635 2636// Do executes the "cloudresourcemanager.folders.search" call. 2637// Exactly one of *SearchFoldersResponse or error will be non-nil. Any 2638// non-2xx status code is an error. Response headers are in either 2639// *SearchFoldersResponse.ServerResponse.Header or (if a response was 2640// returned at all) in error.(*googleapi.Error).Header. Use 2641// googleapi.IsNotModified to check whether the returned error was 2642// because http.StatusNotModified was returned. 2643func (c *FoldersSearchCall) Do(opts ...googleapi.CallOption) (*SearchFoldersResponse, error) { 2644 gensupport.SetOptions(c.urlParams_, opts...) 2645 res, err := c.doRequest("json") 2646 if res != nil && res.StatusCode == http.StatusNotModified { 2647 if res.Body != nil { 2648 res.Body.Close() 2649 } 2650 return nil, &googleapi.Error{ 2651 Code: res.StatusCode, 2652 Header: res.Header, 2653 } 2654 } 2655 if err != nil { 2656 return nil, err 2657 } 2658 defer googleapi.CloseBody(res) 2659 if err := googleapi.CheckResponse(res); err != nil { 2660 return nil, err 2661 } 2662 ret := &SearchFoldersResponse{ 2663 ServerResponse: googleapi.ServerResponse{ 2664 Header: res.Header, 2665 HTTPStatusCode: res.StatusCode, 2666 }, 2667 } 2668 target := &ret 2669 if err := gensupport.DecodeResponse(target, res); err != nil { 2670 return nil, err 2671 } 2672 return ret, nil 2673 // { 2674 // "description": "Search for folders that match specific filter criteria.\nSearch provides an eventually consistent view of the folders a user has\naccess to which meet the specified filter criteria.\n\nThis will only return folders on which the caller has the\npermission `resourcemanager.folders.get`.", 2675 // "flatPath": "v2/folders:search", 2676 // "httpMethod": "POST", 2677 // "id": "cloudresourcemanager.folders.search", 2678 // "parameterOrder": [], 2679 // "parameters": {}, 2680 // "path": "v2/folders:search", 2681 // "request": { 2682 // "$ref": "SearchFoldersRequest" 2683 // }, 2684 // "response": { 2685 // "$ref": "SearchFoldersResponse" 2686 // }, 2687 // "scopes": [ 2688 // "https://www.googleapis.com/auth/cloud-platform", 2689 // "https://www.googleapis.com/auth/cloud-platform.read-only" 2690 // ] 2691 // } 2692 2693} 2694 2695// Pages invokes f for each page of results. 2696// A non-nil error returned from f will halt the iteration. 2697// The provided context supersedes any context provided to the Context method. 2698func (c *FoldersSearchCall) Pages(ctx context.Context, f func(*SearchFoldersResponse) error) error { 2699 c.ctx_ = ctx 2700 defer func(pt string) { c.searchfoldersrequest.PageToken = pt }(c.searchfoldersrequest.PageToken) // reset paging to original point 2701 for { 2702 x, err := c.Do() 2703 if err != nil { 2704 return err 2705 } 2706 if err := f(x); err != nil { 2707 return err 2708 } 2709 if x.NextPageToken == "" { 2710 return nil 2711 } 2712 c.searchfoldersrequest.PageToken = x.NextPageToken 2713 } 2714} 2715 2716// method id "cloudresourcemanager.folders.setIamPolicy": 2717 2718type FoldersSetIamPolicyCall struct { 2719 s *Service 2720 resource string 2721 setiampolicyrequest *SetIamPolicyRequest 2722 urlParams_ gensupport.URLParams 2723 ctx_ context.Context 2724 header_ http.Header 2725} 2726 2727// SetIamPolicy: Sets the access control policy on a Folder, replacing 2728// any existing policy. 2729// The `resource` field should be the Folder's resource name, 2730// e.g. 2731// "folders/1234". 2732// The caller must have `resourcemanager.folders.setIamPolicy` 2733// permission 2734// on the identified folder. 2735func (r *FoldersService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *FoldersSetIamPolicyCall { 2736 c := &FoldersSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2737 c.resource = resource 2738 c.setiampolicyrequest = setiampolicyrequest 2739 return c 2740} 2741 2742// Fields allows partial responses to be retrieved. See 2743// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2744// for more information. 2745func (c *FoldersSetIamPolicyCall) Fields(s ...googleapi.Field) *FoldersSetIamPolicyCall { 2746 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2747 return c 2748} 2749 2750// Context sets the context to be used in this call's Do method. Any 2751// pending HTTP request will be aborted if the provided context is 2752// canceled. 2753func (c *FoldersSetIamPolicyCall) Context(ctx context.Context) *FoldersSetIamPolicyCall { 2754 c.ctx_ = ctx 2755 return c 2756} 2757 2758// Header returns an http.Header that can be modified by the caller to 2759// add HTTP headers to the request. 2760func (c *FoldersSetIamPolicyCall) Header() http.Header { 2761 if c.header_ == nil { 2762 c.header_ = make(http.Header) 2763 } 2764 return c.header_ 2765} 2766 2767func (c *FoldersSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 2768 reqHeaders := make(http.Header) 2769 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2770 for k, v := range c.header_ { 2771 reqHeaders[k] = v 2772 } 2773 reqHeaders.Set("User-Agent", c.s.userAgent()) 2774 var body io.Reader = nil 2775 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 2776 if err != nil { 2777 return nil, err 2778 } 2779 reqHeaders.Set("Content-Type", "application/json") 2780 c.urlParams_.Set("alt", alt) 2781 c.urlParams_.Set("prettyPrint", "false") 2782 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+resource}:setIamPolicy") 2783 urls += "?" + c.urlParams_.Encode() 2784 req, err := http.NewRequest("POST", urls, body) 2785 if err != nil { 2786 return nil, err 2787 } 2788 req.Header = reqHeaders 2789 googleapi.Expand(req.URL, map[string]string{ 2790 "resource": c.resource, 2791 }) 2792 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2793} 2794 2795// Do executes the "cloudresourcemanager.folders.setIamPolicy" call. 2796// Exactly one of *Policy or error will be non-nil. Any non-2xx status 2797// code is an error. Response headers are in either 2798// *Policy.ServerResponse.Header or (if a response was returned at all) 2799// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2800// check whether the returned error was because http.StatusNotModified 2801// was returned. 2802func (c *FoldersSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 2803 gensupport.SetOptions(c.urlParams_, opts...) 2804 res, err := c.doRequest("json") 2805 if res != nil && res.StatusCode == http.StatusNotModified { 2806 if res.Body != nil { 2807 res.Body.Close() 2808 } 2809 return nil, &googleapi.Error{ 2810 Code: res.StatusCode, 2811 Header: res.Header, 2812 } 2813 } 2814 if err != nil { 2815 return nil, err 2816 } 2817 defer googleapi.CloseBody(res) 2818 if err := googleapi.CheckResponse(res); err != nil { 2819 return nil, err 2820 } 2821 ret := &Policy{ 2822 ServerResponse: googleapi.ServerResponse{ 2823 Header: res.Header, 2824 HTTPStatusCode: res.StatusCode, 2825 }, 2826 } 2827 target := &ret 2828 if err := gensupport.DecodeResponse(target, res); err != nil { 2829 return nil, err 2830 } 2831 return ret, nil 2832 // { 2833 // "description": "Sets the access control policy on a Folder, replacing any existing policy.\nThe `resource` field should be the Folder's resource name, e.g.\n\"folders/1234\".\nThe caller must have `resourcemanager.folders.setIamPolicy` permission\non the identified folder.", 2834 // "flatPath": "v2/folders/{foldersId}:setIamPolicy", 2835 // "httpMethod": "POST", 2836 // "id": "cloudresourcemanager.folders.setIamPolicy", 2837 // "parameterOrder": [ 2838 // "resource" 2839 // ], 2840 // "parameters": { 2841 // "resource": { 2842 // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.", 2843 // "location": "path", 2844 // "pattern": "^folders/[^/]+$", 2845 // "required": true, 2846 // "type": "string" 2847 // } 2848 // }, 2849 // "path": "v2/{+resource}:setIamPolicy", 2850 // "request": { 2851 // "$ref": "SetIamPolicyRequest" 2852 // }, 2853 // "response": { 2854 // "$ref": "Policy" 2855 // }, 2856 // "scopes": [ 2857 // "https://www.googleapis.com/auth/cloud-platform" 2858 // ] 2859 // } 2860 2861} 2862 2863// method id "cloudresourcemanager.folders.testIamPermissions": 2864 2865type FoldersTestIamPermissionsCall struct { 2866 s *Service 2867 resource string 2868 testiampermissionsrequest *TestIamPermissionsRequest 2869 urlParams_ gensupport.URLParams 2870 ctx_ context.Context 2871 header_ http.Header 2872} 2873 2874// TestIamPermissions: Returns permissions that a caller has on the 2875// specified Folder. 2876// The `resource` field should be the Folder's resource name, 2877// e.g. "folders/1234". 2878// 2879// There are no permissions required for making this API call. 2880func (r *FoldersService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *FoldersTestIamPermissionsCall { 2881 c := &FoldersTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2882 c.resource = resource 2883 c.testiampermissionsrequest = testiampermissionsrequest 2884 return c 2885} 2886 2887// Fields allows partial responses to be retrieved. See 2888// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2889// for more information. 2890func (c *FoldersTestIamPermissionsCall) Fields(s ...googleapi.Field) *FoldersTestIamPermissionsCall { 2891 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2892 return c 2893} 2894 2895// Context sets the context to be used in this call's Do method. Any 2896// pending HTTP request will be aborted if the provided context is 2897// canceled. 2898func (c *FoldersTestIamPermissionsCall) Context(ctx context.Context) *FoldersTestIamPermissionsCall { 2899 c.ctx_ = ctx 2900 return c 2901} 2902 2903// Header returns an http.Header that can be modified by the caller to 2904// add HTTP headers to the request. 2905func (c *FoldersTestIamPermissionsCall) Header() http.Header { 2906 if c.header_ == nil { 2907 c.header_ = make(http.Header) 2908 } 2909 return c.header_ 2910} 2911 2912func (c *FoldersTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 2913 reqHeaders := make(http.Header) 2914 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2915 for k, v := range c.header_ { 2916 reqHeaders[k] = v 2917 } 2918 reqHeaders.Set("User-Agent", c.s.userAgent()) 2919 var body io.Reader = nil 2920 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 2921 if err != nil { 2922 return nil, err 2923 } 2924 reqHeaders.Set("Content-Type", "application/json") 2925 c.urlParams_.Set("alt", alt) 2926 c.urlParams_.Set("prettyPrint", "false") 2927 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+resource}:testIamPermissions") 2928 urls += "?" + c.urlParams_.Encode() 2929 req, err := http.NewRequest("POST", urls, body) 2930 if err != nil { 2931 return nil, err 2932 } 2933 req.Header = reqHeaders 2934 googleapi.Expand(req.URL, map[string]string{ 2935 "resource": c.resource, 2936 }) 2937 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2938} 2939 2940// Do executes the "cloudresourcemanager.folders.testIamPermissions" call. 2941// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 2942// Any non-2xx status code is an error. Response headers are in either 2943// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 2944// was returned at all) in error.(*googleapi.Error).Header. Use 2945// googleapi.IsNotModified to check whether the returned error was 2946// because http.StatusNotModified was returned. 2947func (c *FoldersTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 2948 gensupport.SetOptions(c.urlParams_, opts...) 2949 res, err := c.doRequest("json") 2950 if res != nil && res.StatusCode == http.StatusNotModified { 2951 if res.Body != nil { 2952 res.Body.Close() 2953 } 2954 return nil, &googleapi.Error{ 2955 Code: res.StatusCode, 2956 Header: res.Header, 2957 } 2958 } 2959 if err != nil { 2960 return nil, err 2961 } 2962 defer googleapi.CloseBody(res) 2963 if err := googleapi.CheckResponse(res); err != nil { 2964 return nil, err 2965 } 2966 ret := &TestIamPermissionsResponse{ 2967 ServerResponse: googleapi.ServerResponse{ 2968 Header: res.Header, 2969 HTTPStatusCode: res.StatusCode, 2970 }, 2971 } 2972 target := &ret 2973 if err := gensupport.DecodeResponse(target, res); err != nil { 2974 return nil, err 2975 } 2976 return ret, nil 2977 // { 2978 // "description": "Returns permissions that a caller has on the specified Folder.\nThe `resource` field should be the Folder's resource name,\ne.g. \"folders/1234\".\n\nThere are no permissions required for making this API call.", 2979 // "flatPath": "v2/folders/{foldersId}:testIamPermissions", 2980 // "httpMethod": "POST", 2981 // "id": "cloudresourcemanager.folders.testIamPermissions", 2982 // "parameterOrder": [ 2983 // "resource" 2984 // ], 2985 // "parameters": { 2986 // "resource": { 2987 // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.", 2988 // "location": "path", 2989 // "pattern": "^folders/[^/]+$", 2990 // "required": true, 2991 // "type": "string" 2992 // } 2993 // }, 2994 // "path": "v2/{+resource}:testIamPermissions", 2995 // "request": { 2996 // "$ref": "TestIamPermissionsRequest" 2997 // }, 2998 // "response": { 2999 // "$ref": "TestIamPermissionsResponse" 3000 // }, 3001 // "scopes": [ 3002 // "https://www.googleapis.com/auth/cloud-platform" 3003 // ] 3004 // } 3005 3006} 3007 3008// method id "cloudresourcemanager.folders.undelete": 3009 3010type FoldersUndeleteCall struct { 3011 s *Service 3012 name string 3013 undeletefolderrequest *UndeleteFolderRequest 3014 urlParams_ gensupport.URLParams 3015 ctx_ context.Context 3016 header_ http.Header 3017} 3018 3019// Undelete: Cancels the deletion request for a Folder. This method may 3020// only be 3021// called on a Folder in the 3022// DELETE_REQUESTED state. 3023// In order to succeed, the Folder's parent must be in the 3024// ACTIVE state. 3025// In addition, reintroducing the folder into the tree must not 3026// violate 3027// folder naming, height and fanout constraints described in 3028// the 3029// CreateFolder documentation. 3030// The caller must have `resourcemanager.folders.undelete` permission on 3031// the 3032// identified folder. 3033func (r *FoldersService) Undelete(name string, undeletefolderrequest *UndeleteFolderRequest) *FoldersUndeleteCall { 3034 c := &FoldersUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3035 c.name = name 3036 c.undeletefolderrequest = undeletefolderrequest 3037 return c 3038} 3039 3040// Fields allows partial responses to be retrieved. See 3041// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3042// for more information. 3043func (c *FoldersUndeleteCall) Fields(s ...googleapi.Field) *FoldersUndeleteCall { 3044 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3045 return c 3046} 3047 3048// Context sets the context to be used in this call's Do method. Any 3049// pending HTTP request will be aborted if the provided context is 3050// canceled. 3051func (c *FoldersUndeleteCall) Context(ctx context.Context) *FoldersUndeleteCall { 3052 c.ctx_ = ctx 3053 return c 3054} 3055 3056// Header returns an http.Header that can be modified by the caller to 3057// add HTTP headers to the request. 3058func (c *FoldersUndeleteCall) Header() http.Header { 3059 if c.header_ == nil { 3060 c.header_ = make(http.Header) 3061 } 3062 return c.header_ 3063} 3064 3065func (c *FoldersUndeleteCall) doRequest(alt string) (*http.Response, error) { 3066 reqHeaders := make(http.Header) 3067 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3068 for k, v := range c.header_ { 3069 reqHeaders[k] = v 3070 } 3071 reqHeaders.Set("User-Agent", c.s.userAgent()) 3072 var body io.Reader = nil 3073 body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeletefolderrequest) 3074 if err != nil { 3075 return nil, err 3076 } 3077 reqHeaders.Set("Content-Type", "application/json") 3078 c.urlParams_.Set("alt", alt) 3079 c.urlParams_.Set("prettyPrint", "false") 3080 urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}:undelete") 3081 urls += "?" + c.urlParams_.Encode() 3082 req, err := http.NewRequest("POST", urls, body) 3083 if err != nil { 3084 return nil, err 3085 } 3086 req.Header = reqHeaders 3087 googleapi.Expand(req.URL, map[string]string{ 3088 "name": c.name, 3089 }) 3090 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3091} 3092 3093// Do executes the "cloudresourcemanager.folders.undelete" call. 3094// Exactly one of *Folder or error will be non-nil. Any non-2xx status 3095// code is an error. Response headers are in either 3096// *Folder.ServerResponse.Header or (if a response was returned at all) 3097// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3098// check whether the returned error was because http.StatusNotModified 3099// was returned. 3100func (c *FoldersUndeleteCall) Do(opts ...googleapi.CallOption) (*Folder, error) { 3101 gensupport.SetOptions(c.urlParams_, opts...) 3102 res, err := c.doRequest("json") 3103 if res != nil && res.StatusCode == http.StatusNotModified { 3104 if res.Body != nil { 3105 res.Body.Close() 3106 } 3107 return nil, &googleapi.Error{ 3108 Code: res.StatusCode, 3109 Header: res.Header, 3110 } 3111 } 3112 if err != nil { 3113 return nil, err 3114 } 3115 defer googleapi.CloseBody(res) 3116 if err := googleapi.CheckResponse(res); err != nil { 3117 return nil, err 3118 } 3119 ret := &Folder{ 3120 ServerResponse: googleapi.ServerResponse{ 3121 Header: res.Header, 3122 HTTPStatusCode: res.StatusCode, 3123 }, 3124 } 3125 target := &ret 3126 if err := gensupport.DecodeResponse(target, res); err != nil { 3127 return nil, err 3128 } 3129 return ret, nil 3130 // { 3131 // "description": "Cancels the deletion request for a Folder. This method may only be\ncalled on a Folder in the\nDELETE_REQUESTED state.\nIn order to succeed, the Folder's parent must be in the\nACTIVE state.\nIn addition, reintroducing the folder into the tree must not violate\nfolder naming, height and fanout constraints described in the\nCreateFolder documentation.\nThe caller must have `resourcemanager.folders.undelete` permission on the\nidentified folder.", 3132 // "flatPath": "v2/folders/{foldersId}:undelete", 3133 // "httpMethod": "POST", 3134 // "id": "cloudresourcemanager.folders.undelete", 3135 // "parameterOrder": [ 3136 // "name" 3137 // ], 3138 // "parameters": { 3139 // "name": { 3140 // "description": "Required. The resource name of the Folder to undelete.\nMust be of the form `folders/{folder_id}`.", 3141 // "location": "path", 3142 // "pattern": "^folders/[^/]+$", 3143 // "required": true, 3144 // "type": "string" 3145 // } 3146 // }, 3147 // "path": "v2/{+name}:undelete", 3148 // "request": { 3149 // "$ref": "UndeleteFolderRequest" 3150 // }, 3151 // "response": { 3152 // "$ref": "Folder" 3153 // }, 3154 // "scopes": [ 3155 // "https://www.googleapis.com/auth/cloud-platform" 3156 // ] 3157 // } 3158 3159} 3160 3161// method id "cloudresourcemanager.operations.get": 3162 3163type OperationsGetCall struct { 3164 s *Service 3165 name string 3166 urlParams_ gensupport.URLParams 3167 ifNoneMatch_ string 3168 ctx_ context.Context 3169 header_ http.Header 3170} 3171 3172// Get: Gets the latest state of a long-running operation. Clients can 3173// use this 3174// method to poll the operation result at intervals as recommended by 3175// the API 3176// service. 3177func (r *OperationsService) Get(name string) *OperationsGetCall { 3178 c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3179 c.name = name 3180 return c 3181} 3182 3183// Fields allows partial responses to be retrieved. See 3184// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3185// for more information. 3186func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall { 3187 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3188 return c 3189} 3190 3191// IfNoneMatch sets the optional parameter which makes the operation 3192// fail if the object's ETag matches the given value. This is useful for 3193// getting updates only after the object has changed since the last 3194// request. Use googleapi.IsNotModified to check whether the response 3195// error from Do is the result of In-None-Match. 3196func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall { 3197 c.ifNoneMatch_ = entityTag 3198 return c 3199} 3200 3201// Context sets the context to be used in this call's Do method. Any 3202// pending HTTP request will be aborted if the provided context is 3203// canceled. 3204func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall { 3205 c.ctx_ = ctx 3206 return c 3207} 3208 3209// Header returns an http.Header that can be modified by the caller to 3210// add HTTP headers to the request. 3211func (c *OperationsGetCall) Header() http.Header { 3212 if c.header_ == nil { 3213 c.header_ = make(http.Header) 3214 } 3215 return c.header_ 3216} 3217 3218func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) { 3219 reqHeaders := make(http.Header) 3220 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3221 for k, v := range c.header_ { 3222 reqHeaders[k] = v 3223 } 3224 reqHeaders.Set("User-Agent", c.s.userAgent()) 3225 if c.ifNoneMatch_ != "" { 3226 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3227 } 3228 var body io.Reader = nil 3229 c.urlParams_.Set("alt", alt) 3230 c.urlParams_.Set("prettyPrint", "false") 3231 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 3232 urls += "?" + c.urlParams_.Encode() 3233 req, err := http.NewRequest("GET", urls, body) 3234 if err != nil { 3235 return nil, err 3236 } 3237 req.Header = reqHeaders 3238 googleapi.Expand(req.URL, map[string]string{ 3239 "name": c.name, 3240 }) 3241 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3242} 3243 3244// Do executes the "cloudresourcemanager.operations.get" call. 3245// Exactly one of *Operation or error will be non-nil. Any non-2xx 3246// status code is an error. Response headers are in either 3247// *Operation.ServerResponse.Header or (if a response was returned at 3248// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3249// to check whether the returned error was because 3250// http.StatusNotModified was returned. 3251func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 3252 gensupport.SetOptions(c.urlParams_, opts...) 3253 res, err := c.doRequest("json") 3254 if res != nil && res.StatusCode == http.StatusNotModified { 3255 if res.Body != nil { 3256 res.Body.Close() 3257 } 3258 return nil, &googleapi.Error{ 3259 Code: res.StatusCode, 3260 Header: res.Header, 3261 } 3262 } 3263 if err != nil { 3264 return nil, err 3265 } 3266 defer googleapi.CloseBody(res) 3267 if err := googleapi.CheckResponse(res); err != nil { 3268 return nil, err 3269 } 3270 ret := &Operation{ 3271 ServerResponse: googleapi.ServerResponse{ 3272 Header: res.Header, 3273 HTTPStatusCode: res.StatusCode, 3274 }, 3275 } 3276 target := &ret 3277 if err := gensupport.DecodeResponse(target, res); err != nil { 3278 return nil, err 3279 } 3280 return ret, nil 3281 // { 3282 // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.", 3283 // "flatPath": "v1/operations/{operationsId}", 3284 // "httpMethod": "GET", 3285 // "id": "cloudresourcemanager.operations.get", 3286 // "parameterOrder": [ 3287 // "name" 3288 // ], 3289 // "parameters": { 3290 // "name": { 3291 // "description": "The name of the operation resource.", 3292 // "location": "path", 3293 // "pattern": "^operations/.*$", 3294 // "required": true, 3295 // "type": "string" 3296 // } 3297 // }, 3298 // "path": "v1/{+name}", 3299 // "response": { 3300 // "$ref": "Operation" 3301 // }, 3302 // "scopes": [ 3303 // "https://www.googleapis.com/auth/cloud-platform", 3304 // "https://www.googleapis.com/auth/cloud-platform.read-only" 3305 // ] 3306 // } 3307 3308} 3309