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/v1beta1" 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/v1beta1" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 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:v1beta1" 79const apiName = "cloudresourcemanager" 80const apiVersion = "v1beta1" 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.Organizations = NewOrganizationsService(s) 126 s.Projects = NewProjectsService(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 Organizations *OrganizationsService 136 137 Projects *ProjectsService 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 NewOrganizationsService(s *Service) *OrganizationsService { 148 rs := &OrganizationsService{s: s} 149 return rs 150} 151 152type OrganizationsService struct { 153 s *Service 154} 155 156func NewProjectsService(s *Service) *ProjectsService { 157 rs := &ProjectsService{s: s} 158 return rs 159} 160 161type ProjectsService struct { 162 s *Service 163} 164 165// Ancestor: Identifying information for a single ancestor of a project. 166type Ancestor struct { 167 // ResourceId: Resource id of the ancestor. 168 ResourceId *ResourceId `json:"resourceId,omitempty"` 169 170 // ForceSendFields is a list of field names (e.g. "ResourceId") to 171 // unconditionally include in API requests. By default, fields with 172 // empty values are omitted from API requests. However, any non-pointer, 173 // non-interface field appearing in ForceSendFields will be sent to the 174 // server regardless of whether the field is empty or not. This may be 175 // used to include empty fields in Patch requests. 176 ForceSendFields []string `json:"-"` 177 178 // NullFields is a list of field names (e.g. "ResourceId") to include in 179 // API requests with the JSON null value. By default, fields with empty 180 // values are omitted from API requests. However, any field with an 181 // empty value appearing in NullFields will be sent to the server as 182 // null. It is an error if a field in this list has a non-empty value. 183 // This may be used to include null fields in Patch requests. 184 NullFields []string `json:"-"` 185} 186 187func (s *Ancestor) MarshalJSON() ([]byte, error) { 188 type NoMethod Ancestor 189 raw := NoMethod(*s) 190 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 191} 192 193// AuditConfig: Specifies the audit configuration for a service. 194// The configuration determines which permission types are logged, and 195// what 196// identities, if any, are exempted from logging. 197// An AuditConfig must have one or more AuditLogConfigs. 198// 199// If there are AuditConfigs for both `allServices` and a specific 200// service, 201// the union of the two AuditConfigs is used for that service: the 202// log_types 203// specified in each AuditConfig are enabled, and the exempted_members 204// in each 205// AuditLogConfig are exempted. 206// 207// Example Policy with multiple AuditConfigs: 208// 209// { 210// "audit_configs": [ 211// { 212// "service": "allServices" 213// "audit_log_configs": [ 214// { 215// "log_type": "DATA_READ", 216// "exempted_members": [ 217// "user:jose@example.com" 218// ] 219// }, 220// { 221// "log_type": "DATA_WRITE", 222// }, 223// { 224// "log_type": "ADMIN_READ", 225// } 226// ] 227// }, 228// { 229// "service": "sampleservice.googleapis.com" 230// "audit_log_configs": [ 231// { 232// "log_type": "DATA_READ", 233// }, 234// { 235// "log_type": "DATA_WRITE", 236// "exempted_members": [ 237// "user:aliya@example.com" 238// ] 239// } 240// ] 241// } 242// ] 243// } 244// 245// For sampleservice, this policy enables DATA_READ, DATA_WRITE and 246// ADMIN_READ 247// logging. It also exempts jose@example.com from DATA_READ logging, 248// and 249// aliya@example.com from DATA_WRITE logging. 250type AuditConfig struct { 251 // AuditLogConfigs: The configuration for logging of each type of 252 // permission. 253 AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"` 254 255 // Service: Specifies a service that will be enabled for audit 256 // logging. 257 // For example, `storage.googleapis.com`, 258 // `cloudsql.googleapis.com`. 259 // `allServices` is a special value that covers all services. 260 Service string `json:"service,omitempty"` 261 262 // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to 263 // unconditionally include in API requests. By default, fields with 264 // empty values are omitted from API requests. However, any non-pointer, 265 // non-interface field appearing in ForceSendFields will be sent to the 266 // server regardless of whether the field is empty or not. This may be 267 // used to include empty fields in Patch requests. 268 ForceSendFields []string `json:"-"` 269 270 // NullFields is a list of field names (e.g. "AuditLogConfigs") to 271 // include in API requests with the JSON null value. By default, fields 272 // with empty values are omitted from API requests. However, any field 273 // with an empty value appearing in NullFields will be sent to the 274 // server as null. It is an error if a field in this list has a 275 // non-empty value. This may be used to include null fields in Patch 276 // requests. 277 NullFields []string `json:"-"` 278} 279 280func (s *AuditConfig) MarshalJSON() ([]byte, error) { 281 type NoMethod AuditConfig 282 raw := NoMethod(*s) 283 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 284} 285 286// AuditLogConfig: Provides the configuration for logging a type of 287// permissions. 288// Example: 289// 290// { 291// "audit_log_configs": [ 292// { 293// "log_type": "DATA_READ", 294// "exempted_members": [ 295// "user:jose@example.com" 296// ] 297// }, 298// { 299// "log_type": "DATA_WRITE", 300// } 301// ] 302// } 303// 304// This enables 'DATA_READ' and 'DATA_WRITE' logging, while 305// exempting 306// jose@example.com from DATA_READ logging. 307type AuditLogConfig struct { 308 // ExemptedMembers: Specifies the identities that do not cause logging 309 // for this type of 310 // permission. 311 // Follows the same format of Binding.members. 312 ExemptedMembers []string `json:"exemptedMembers,omitempty"` 313 314 // LogType: The log type that this config enables. 315 // 316 // Possible values: 317 // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this. 318 // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy 319 // "DATA_WRITE" - Data writes. Example: CloudSQL Users create 320 // "DATA_READ" - Data reads. Example: CloudSQL Users list 321 LogType string `json:"logType,omitempty"` 322 323 // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to 324 // unconditionally include in API requests. By default, fields with 325 // empty values are omitted from API requests. However, any non-pointer, 326 // non-interface field appearing in ForceSendFields will be sent to the 327 // server regardless of whether the field is empty or not. This may be 328 // used to include empty fields in Patch requests. 329 ForceSendFields []string `json:"-"` 330 331 // NullFields is a list of field names (e.g. "ExemptedMembers") to 332 // include in API requests with the JSON null value. By default, fields 333 // with empty values are omitted from API requests. However, any field 334 // with an empty value appearing in NullFields will be sent to the 335 // server as null. It is an error if a field in this list has a 336 // non-empty value. This may be used to include null fields in Patch 337 // requests. 338 NullFields []string `json:"-"` 339} 340 341func (s *AuditLogConfig) MarshalJSON() ([]byte, error) { 342 type NoMethod AuditLogConfig 343 raw := NoMethod(*s) 344 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 345} 346 347// Binding: Associates `members` with a `role`. 348type Binding struct { 349 // Condition: The condition that is associated with this binding. 350 // NOTE: An unsatisfied condition will not allow user access via 351 // current 352 // binding. Different bindings, including their conditions, are 353 // examined 354 // independently. 355 Condition *Expr `json:"condition,omitempty"` 356 357 // Members: Specifies the identities requesting access for a Cloud 358 // Platform resource. 359 // `members` can have the following values: 360 // 361 // * `allUsers`: A special identifier that represents anyone who is 362 // on the internet; with or without a Google account. 363 // 364 // * `allAuthenticatedUsers`: A special identifier that represents 365 // anyone 366 // who is authenticated with a Google account or a service 367 // account. 368 // 369 // * `user:{emailid}`: An email address that represents a specific 370 // Google 371 // account. For example, `alice@example.com` . 372 // 373 // 374 // * `serviceAccount:{emailid}`: An email address that represents a 375 // service 376 // account. For example, 377 // `my-other-app@appspot.gserviceaccount.com`. 378 // 379 // * `group:{emailid}`: An email address that represents a Google 380 // group. 381 // For example, `admins@example.com`. 382 // 383 // * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus 384 // unique 385 // identifier) representing a user that has been recently deleted. 386 // For 387 // example, `alice@example.com?uid=123456789012345678901`. If the 388 // user is 389 // recovered, this value reverts to `user:{emailid}` and the 390 // recovered user 391 // retains the role in the binding. 392 // 393 // * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address 394 // (plus 395 // unique identifier) representing a service account that has been 396 // recently 397 // deleted. For example, 398 // 399 // `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. 400 // 401 // If the service account is undeleted, this value reverts to 402 // `serviceAccount:{emailid}` and the undeleted service account 403 // retains the 404 // role in the binding. 405 // 406 // * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus 407 // unique 408 // identifier) representing a Google group that has been recently 409 // deleted. For example, 410 // `admins@example.com?uid=123456789012345678901`. If 411 // the group is recovered, this value reverts to `group:{emailid}` 412 // and the 413 // recovered group retains the role in the binding. 414 // 415 // 416 // * `domain:{domain}`: The G Suite domain (primary) that represents all 417 // the 418 // users of that domain. For example, `google.com` or 419 // `example.com`. 420 // 421 // 422 Members []string `json:"members,omitempty"` 423 424 // Role: Role that is assigned to `members`. 425 // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. 426 Role string `json:"role,omitempty"` 427 428 // ForceSendFields is a list of field names (e.g. "Condition") to 429 // unconditionally include in API requests. By default, fields with 430 // empty values are omitted from API requests. However, any non-pointer, 431 // non-interface field appearing in ForceSendFields will be sent to the 432 // server regardless of whether the field is empty or not. This may be 433 // used to include empty fields in Patch requests. 434 ForceSendFields []string `json:"-"` 435 436 // NullFields is a list of field names (e.g. "Condition") to include in 437 // API requests with the JSON null value. By default, fields with empty 438 // values are omitted from API requests. However, any field with an 439 // empty value appearing in NullFields will be sent to the server as 440 // null. It is an error if a field in this list has a non-empty value. 441 // This may be used to include null fields in Patch requests. 442 NullFields []string `json:"-"` 443} 444 445func (s *Binding) MarshalJSON() ([]byte, error) { 446 type NoMethod Binding 447 raw := NoMethod(*s) 448 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 449} 450 451// Empty: A generic empty message that you can re-use to avoid defining 452// duplicated 453// empty messages in your APIs. A typical example is to use it as the 454// request 455// or the response type of an API method. For instance: 456// 457// service Foo { 458// rpc Bar(google.protobuf.Empty) returns 459// (google.protobuf.Empty); 460// } 461// 462// The JSON representation for `Empty` is empty JSON object `{}`. 463type Empty struct { 464 // ServerResponse contains the HTTP response code and headers from the 465 // server. 466 googleapi.ServerResponse `json:"-"` 467} 468 469// Expr: Represents a textual expression in the Common Expression 470// Language (CEL) 471// syntax. CEL is a C-like expression language. The syntax and semantics 472// of CEL 473// are documented at https://github.com/google/cel-spec. 474// 475// Example (Comparison): 476// 477// title: "Summary size limit" 478// description: "Determines if a summary is less than 100 chars" 479// expression: "document.summary.size() < 100" 480// 481// Example (Equality): 482// 483// title: "Requestor is owner" 484// description: "Determines if requestor is the document owner" 485// expression: "document.owner == 486// request.auth.claims.email" 487// 488// Example (Logic): 489// 490// title: "Public documents" 491// description: "Determine whether the document should be publicly 492// visible" 493// expression: "document.type != 'private' && document.type != 494// 'internal'" 495// 496// Example (Data Manipulation): 497// 498// title: "Notification string" 499// description: "Create a notification string with a timestamp." 500// expression: "'New message received at ' + 501// string(document.create_time)" 502// 503// The exact variables and functions that may be referenced within an 504// expression 505// are determined by the service that evaluates it. See the 506// service 507// documentation for additional information. 508type Expr struct { 509 // Description: Optional. Description of the expression. This is a 510 // longer text which 511 // describes the expression, e.g. when hovered over it in a UI. 512 Description string `json:"description,omitempty"` 513 514 // Expression: Textual representation of an expression in Common 515 // Expression Language 516 // syntax. 517 Expression string `json:"expression,omitempty"` 518 519 // Location: Optional. String indicating the location of the expression 520 // for error 521 // reporting, e.g. a file name and a position in the file. 522 Location string `json:"location,omitempty"` 523 524 // Title: Optional. Title for the expression, i.e. a short string 525 // describing 526 // its purpose. This can be used e.g. in UIs which allow to enter 527 // the 528 // expression. 529 Title string `json:"title,omitempty"` 530 531 // ForceSendFields is a list of field names (e.g. "Description") to 532 // unconditionally include in API requests. By default, fields with 533 // empty values are omitted from API requests. However, any non-pointer, 534 // non-interface field appearing in ForceSendFields will be sent to the 535 // server regardless of whether the field is empty or not. This may be 536 // used to include empty fields in Patch requests. 537 ForceSendFields []string `json:"-"` 538 539 // NullFields is a list of field names (e.g. "Description") to include 540 // in API requests with the JSON null value. By default, fields with 541 // empty values are omitted from API requests. However, any field with 542 // an empty value appearing in NullFields will be sent to the server as 543 // null. It is an error if a field in this list has a non-empty value. 544 // This may be used to include null fields in Patch requests. 545 NullFields []string `json:"-"` 546} 547 548func (s *Expr) MarshalJSON() ([]byte, error) { 549 type NoMethod Expr 550 raw := NoMethod(*s) 551 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 552} 553 554// FolderOperation: Metadata describing a long running folder operation 555type FolderOperation struct { 556 // DestinationParent: The resource name of the folder or organization we 557 // are either creating 558 // the folder under or moving the folder to. 559 DestinationParent string `json:"destinationParent,omitempty"` 560 561 // DisplayName: The display name of the folder. 562 DisplayName string `json:"displayName,omitempty"` 563 564 // OperationType: The type of this operation. 565 // 566 // Possible values: 567 // "OPERATION_TYPE_UNSPECIFIED" - Operation type not specified. 568 // "CREATE" - A create folder operation. 569 // "MOVE" - A move folder operation. 570 OperationType string `json:"operationType,omitempty"` 571 572 // SourceParent: The resource name of the folder's parent. 573 // Only applicable when the operation_type is MOVE. 574 SourceParent string `json:"sourceParent,omitempty"` 575 576 // ForceSendFields is a list of field names (e.g. "DestinationParent") 577 // to unconditionally include in API requests. By default, fields with 578 // empty values are omitted from API requests. However, any non-pointer, 579 // non-interface field appearing in ForceSendFields will be sent to the 580 // server regardless of whether the field is empty or not. This may be 581 // used to include empty fields in Patch requests. 582 ForceSendFields []string `json:"-"` 583 584 // NullFields is a list of field names (e.g. "DestinationParent") to 585 // include in API requests with the JSON null value. By default, fields 586 // with empty values are omitted from API requests. However, any field 587 // with an empty value appearing in NullFields will be sent to the 588 // server as null. It is an error if a field in this list has a 589 // non-empty value. This may be used to include null fields in Patch 590 // requests. 591 NullFields []string `json:"-"` 592} 593 594func (s *FolderOperation) MarshalJSON() ([]byte, error) { 595 type NoMethod FolderOperation 596 raw := NoMethod(*s) 597 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 598} 599 600// FolderOperationError: A classification of the Folder Operation error. 601type FolderOperationError struct { 602 // ErrorMessageId: The type of operation error experienced. 603 // 604 // Possible values: 605 // "ERROR_TYPE_UNSPECIFIED" - The error type was unrecognized or 606 // unspecified. 607 // "ACTIVE_FOLDER_HEIGHT_VIOLATION" - The attempted action would 608 // violate the max folder depth constraint. 609 // "MAX_CHILD_FOLDERS_VIOLATION" - The attempted action would violate 610 // the max child folders constraint. 611 // "FOLDER_NAME_UNIQUENESS_VIOLATION" - The attempted action would 612 // violate the locally-unique folder 613 // display_name constraint. 614 // "RESOURCE_DELETED_VIOLATION" - The resource being moved has been 615 // deleted. 616 // "PARENT_DELETED_VIOLATION" - The resource a folder was being added 617 // to has been deleted. 618 // "CYCLE_INTRODUCED_VIOLATION" - The attempted action would introduce 619 // cycle in resource path. 620 // "FOLDER_BEING_MOVED_VIOLATION" - The attempted action would move a 621 // folder that is already being moved. 622 // "FOLDER_TO_DELETE_NON_EMPTY_VIOLATION" - The folder the caller is 623 // trying to delete contains active resources. 624 // "DELETED_FOLDER_HEIGHT_VIOLATION" - The attempted action would 625 // violate the max deleted folder depth 626 // constraint. 627 ErrorMessageId string `json:"errorMessageId,omitempty"` 628 629 // ForceSendFields is a list of field names (e.g. "ErrorMessageId") to 630 // unconditionally include in API requests. By default, fields with 631 // empty values are omitted from API requests. However, any non-pointer, 632 // non-interface field appearing in ForceSendFields will be sent to the 633 // server regardless of whether the field is empty or not. This may be 634 // used to include empty fields in Patch requests. 635 ForceSendFields []string `json:"-"` 636 637 // NullFields is a list of field names (e.g. "ErrorMessageId") to 638 // include in API requests with the JSON null value. By default, fields 639 // with empty values are omitted from API requests. However, any field 640 // with an empty value appearing in NullFields will be sent to the 641 // server as null. It is an error if a field in this list has a 642 // non-empty value. This may be used to include null fields in Patch 643 // requests. 644 NullFields []string `json:"-"` 645} 646 647func (s *FolderOperationError) MarshalJSON() ([]byte, error) { 648 type NoMethod FolderOperationError 649 raw := NoMethod(*s) 650 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 651} 652 653// GetAncestryRequest: The request sent to the 654// GetAncestry 655// method. 656type GetAncestryRequest struct { 657} 658 659// GetAncestryResponse: Response from the GetAncestry method. 660type GetAncestryResponse struct { 661 // Ancestor: Ancestors are ordered from bottom to top of the resource 662 // hierarchy. The 663 // first ancestor is the project itself, followed by the project's 664 // parent, 665 // etc. 666 Ancestor []*Ancestor `json:"ancestor,omitempty"` 667 668 // ServerResponse contains the HTTP response code and headers from the 669 // server. 670 googleapi.ServerResponse `json:"-"` 671 672 // ForceSendFields is a list of field names (e.g. "Ancestor") to 673 // unconditionally include in API requests. By default, fields with 674 // empty values are omitted from API requests. However, any non-pointer, 675 // non-interface field appearing in ForceSendFields will be sent to the 676 // server regardless of whether the field is empty or not. This may be 677 // used to include empty fields in Patch requests. 678 ForceSendFields []string `json:"-"` 679 680 // NullFields is a list of field names (e.g. "Ancestor") to include in 681 // API requests with the JSON null value. By default, fields with empty 682 // values are omitted from API requests. However, any field with an 683 // empty value appearing in NullFields will be sent to the server as 684 // null. It is an error if a field in this list has a non-empty value. 685 // This may be used to include null fields in Patch requests. 686 NullFields []string `json:"-"` 687} 688 689func (s *GetAncestryResponse) MarshalJSON() ([]byte, error) { 690 type NoMethod GetAncestryResponse 691 raw := NoMethod(*s) 692 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 693} 694 695// GetIamPolicyRequest: Request message for `GetIamPolicy` method. 696type GetIamPolicyRequest struct { 697 // Options: OPTIONAL: A `GetPolicyOptions` object for specifying options 698 // to 699 // `GetIamPolicy`. This field is only used by Cloud IAM. 700 Options *GetPolicyOptions `json:"options,omitempty"` 701 702 // ForceSendFields is a list of field names (e.g. "Options") to 703 // unconditionally include in API requests. By default, fields with 704 // empty values are omitted from API requests. However, any non-pointer, 705 // non-interface field appearing in ForceSendFields will be sent to the 706 // server regardless of whether the field is empty or not. This may be 707 // used to include empty fields in Patch requests. 708 ForceSendFields []string `json:"-"` 709 710 // NullFields is a list of field names (e.g. "Options") to include in 711 // API requests with the JSON null value. By default, fields with empty 712 // values are omitted from API requests. However, any field with an 713 // empty value appearing in NullFields will be sent to the server as 714 // null. It is an error if a field in this list has a non-empty value. 715 // This may be used to include null fields in Patch requests. 716 NullFields []string `json:"-"` 717} 718 719func (s *GetIamPolicyRequest) MarshalJSON() ([]byte, error) { 720 type NoMethod GetIamPolicyRequest 721 raw := NoMethod(*s) 722 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 723} 724 725// GetPolicyOptions: Encapsulates settings provided to GetIamPolicy. 726type GetPolicyOptions struct { 727 // RequestedPolicyVersion: Optional. The policy format version to be 728 // returned. 729 // 730 // Valid values are 0, 1, and 3. Requests specifying an invalid value 731 // will be 732 // rejected. 733 // 734 // Requests for policies with any conditional bindings must specify 735 // version 3. 736 // Policies without any conditional bindings may specify any valid value 737 // or 738 // leave the field unset. 739 RequestedPolicyVersion int64 `json:"requestedPolicyVersion,omitempty"` 740 741 // ForceSendFields is a list of field names (e.g. 742 // "RequestedPolicyVersion") to unconditionally include in API requests. 743 // By default, fields with empty values are omitted from API requests. 744 // However, any non-pointer, non-interface field appearing in 745 // ForceSendFields will be sent to the server regardless of whether the 746 // field is empty or not. This may be used to include empty fields in 747 // Patch requests. 748 ForceSendFields []string `json:"-"` 749 750 // NullFields is a list of field names (e.g. "RequestedPolicyVersion") 751 // to include in API requests with the JSON null value. By default, 752 // fields with empty values are omitted from API requests. However, any 753 // field with an empty value appearing in NullFields will be sent to the 754 // server as null. It is an error if a field in this list has a 755 // non-empty value. This may be used to include null fields in Patch 756 // requests. 757 NullFields []string `json:"-"` 758} 759 760func (s *GetPolicyOptions) MarshalJSON() ([]byte, error) { 761 type NoMethod GetPolicyOptions 762 raw := NoMethod(*s) 763 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 764} 765 766// ListOrganizationsResponse: The response returned from the 767// `ListOrganizations` method. 768type ListOrganizationsResponse struct { 769 // NextPageToken: A pagination token to be used to retrieve the next 770 // page of results. If the 771 // result is too large to fit within the page size specified in the 772 // request, 773 // this field will be set with a token that can be used to fetch the 774 // next page 775 // of results. If this field is empty, it indicates that this 776 // response 777 // contains the last page of results. 778 NextPageToken string `json:"nextPageToken,omitempty"` 779 780 // Organizations: The list of Organizations that matched the list query, 781 // possibly paginated. 782 Organizations []*Organization `json:"organizations,omitempty"` 783 784 // ServerResponse contains the HTTP response code and headers from the 785 // server. 786 googleapi.ServerResponse `json:"-"` 787 788 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 789 // unconditionally include in API requests. By default, fields with 790 // empty values are omitted from API requests. However, any non-pointer, 791 // non-interface field appearing in ForceSendFields will be sent to the 792 // server regardless of whether the field is empty or not. This may be 793 // used to include empty fields in Patch requests. 794 ForceSendFields []string `json:"-"` 795 796 // NullFields is a list of field names (e.g. "NextPageToken") to include 797 // in API requests with the JSON null value. By default, fields with 798 // empty values are omitted from API requests. However, any field with 799 // an empty value appearing in NullFields will be sent to the server as 800 // null. It is an error if a field in this list has a non-empty value. 801 // This may be used to include null fields in Patch requests. 802 NullFields []string `json:"-"` 803} 804 805func (s *ListOrganizationsResponse) MarshalJSON() ([]byte, error) { 806 type NoMethod ListOrganizationsResponse 807 raw := NoMethod(*s) 808 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 809} 810 811// ListProjectsResponse: A page of the response received from 812// the 813// ListProjects 814// method. 815// 816// A paginated response where more pages are available 817// has 818// `next_page_token` set. This token can be used in a subsequent request 819// to 820// retrieve the next request page. 821type ListProjectsResponse struct { 822 // NextPageToken: Pagination token. 823 // 824 // If the result set is too large to fit in a single response, this 825 // token 826 // is returned. It encodes the position of the current result 827 // cursor. 828 // Feeding this value into a new list request with the `page_token` 829 // parameter 830 // gives the next page of the results. 831 // 832 // When `next_page_token` is not filled in, there is no next page 833 // and 834 // the list returned is the last page in the result set. 835 // 836 // Pagination tokens have a limited lifetime. 837 NextPageToken string `json:"nextPageToken,omitempty"` 838 839 // Projects: The list of Projects that matched the list filter. This 840 // list can 841 // be paginated. 842 Projects []*Project `json:"projects,omitempty"` 843 844 // ServerResponse contains the HTTP response code and headers from the 845 // server. 846 googleapi.ServerResponse `json:"-"` 847 848 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 849 // unconditionally include in API requests. By default, fields with 850 // empty values are omitted from API requests. However, any non-pointer, 851 // non-interface field appearing in ForceSendFields will be sent to the 852 // server regardless of whether the field is empty or not. This may be 853 // used to include empty fields in Patch requests. 854 ForceSendFields []string `json:"-"` 855 856 // NullFields is a list of field names (e.g. "NextPageToken") to include 857 // in API requests with the JSON null value. By default, fields with 858 // empty values are omitted from API requests. However, any field with 859 // an empty value appearing in NullFields will be sent to the server as 860 // null. It is an error if a field in this list has a non-empty value. 861 // This may be used to include null fields in Patch requests. 862 NullFields []string `json:"-"` 863} 864 865func (s *ListProjectsResponse) MarshalJSON() ([]byte, error) { 866 type NoMethod ListProjectsResponse 867 raw := NoMethod(*s) 868 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 869} 870 871// Organization: The root node in the resource hierarchy to which a 872// particular entity's 873// (e.g., company) resources belong. 874type Organization struct { 875 // CreationTime: Timestamp when the Organization was created. Assigned 876 // by the server. 877 CreationTime string `json:"creationTime,omitempty"` 878 879 // DisplayName: A human-readable string that refers to the Organization 880 // in the 881 // GCP Console UI. This string is set by the server and cannot 882 // be 883 // changed. The string will be set to the primary domain (for 884 // example, 885 // "google.com") of the G Suite customer that owns the organization. 886 DisplayName string `json:"displayName,omitempty"` 887 888 // LifecycleState: The organization's current lifecycle state. Assigned 889 // by the server. 890 // 891 // Possible values: 892 // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state. This is only 893 // useful for distinguishing unset values. 894 // "ACTIVE" - The normal and active state. 895 // "DELETE_REQUESTED" - The organization has been marked for deletion 896 // by the user. 897 LifecycleState string `json:"lifecycleState,omitempty"` 898 899 // Name: Output only. The resource name of the organization. This is 900 // the 901 // organization's relative path in the API. Its format 902 // is 903 // "organizations/[organization_id]". For example, "organizations/1234". 904 Name string `json:"name,omitempty"` 905 906 // OrganizationId: An immutable id for the Organization that is assigned 907 // on creation. This 908 // should be omitted when creating a new Organization. 909 // This field is read-only. 910 OrganizationId string `json:"organizationId,omitempty"` 911 912 // Owner: The owner of this Organization. The owner should be specified 913 // on 914 // creation. Once set, it cannot be changed. 915 // This field is required. 916 Owner *OrganizationOwner `json:"owner,omitempty"` 917 918 // ServerResponse contains the HTTP response code and headers from the 919 // server. 920 googleapi.ServerResponse `json:"-"` 921 922 // ForceSendFields is a list of field names (e.g. "CreationTime") to 923 // unconditionally include in API requests. By default, fields with 924 // empty values are omitted from API requests. However, any non-pointer, 925 // non-interface field appearing in ForceSendFields will be sent to the 926 // server regardless of whether the field is empty or not. This may be 927 // used to include empty fields in Patch requests. 928 ForceSendFields []string `json:"-"` 929 930 // NullFields is a list of field names (e.g. "CreationTime") to include 931 // in API requests with the JSON null value. By default, fields with 932 // empty values are omitted from API requests. However, any field with 933 // an empty value appearing in NullFields will be sent to the server as 934 // null. It is an error if a field in this list has a non-empty value. 935 // This may be used to include null fields in Patch requests. 936 NullFields []string `json:"-"` 937} 938 939func (s *Organization) MarshalJSON() ([]byte, error) { 940 type NoMethod Organization 941 raw := NoMethod(*s) 942 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 943} 944 945// OrganizationOwner: The entity that owns an Organization. The lifetime 946// of the Organization and 947// all of its descendants are bound to the `OrganizationOwner`. If 948// the 949// `OrganizationOwner` is deleted, the Organization and all its 950// descendants will 951// be deleted. 952type OrganizationOwner struct { 953 // DirectoryCustomerId: The G Suite customer id used in the Directory 954 // API. 955 DirectoryCustomerId string `json:"directoryCustomerId,omitempty"` 956 957 // ForceSendFields is a list of field names (e.g. "DirectoryCustomerId") 958 // to unconditionally include in API requests. By default, fields with 959 // empty values are omitted from API requests. However, any non-pointer, 960 // non-interface field appearing in ForceSendFields will be sent to the 961 // server regardless of whether the field is empty or not. This may be 962 // used to include empty fields in Patch requests. 963 ForceSendFields []string `json:"-"` 964 965 // NullFields is a list of field names (e.g. "DirectoryCustomerId") to 966 // include in API requests with the JSON null value. By default, fields 967 // with empty values are omitted from API requests. However, any field 968 // with an empty value appearing in NullFields will be sent to the 969 // server as null. It is an error if a field in this list has a 970 // non-empty value. This may be used to include null fields in Patch 971 // requests. 972 NullFields []string `json:"-"` 973} 974 975func (s *OrganizationOwner) MarshalJSON() ([]byte, error) { 976 type NoMethod OrganizationOwner 977 raw := NoMethod(*s) 978 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 979} 980 981// Policy: An Identity and Access Management (IAM) policy, which 982// specifies access 983// controls for Google Cloud resources. 984// 985// 986// A `Policy` is a collection of `bindings`. A `binding` binds one or 987// more 988// `members` to a single `role`. Members can be user accounts, service 989// accounts, 990// Google groups, and domains (such as G Suite). A `role` is a named 991// list of 992// permissions; each `role` can be an IAM predefined role or a 993// user-created 994// custom role. 995// 996// Optionally, a `binding` can specify a `condition`, which is a 997// logical 998// expression that allows access to a resource only if the expression 999// evaluates 1000// to `true`. A condition can add constraints based on attributes of 1001// the 1002// request, the resource, or both. 1003// 1004// **JSON example:** 1005// 1006// { 1007// "bindings": [ 1008// { 1009// "role": "roles/resourcemanager.organizationAdmin", 1010// "members": [ 1011// "user:mike@example.com", 1012// "group:admins@example.com", 1013// "domain:google.com", 1014// 1015// "serviceAccount:my-project-id@appspot.gserviceaccount.com" 1016// ] 1017// }, 1018// { 1019// "role": "roles/resourcemanager.organizationViewer", 1020// "members": ["user:eve@example.com"], 1021// "condition": { 1022// "title": "expirable access", 1023// "description": "Does not grant access after Sep 2020", 1024// "expression": "request.time < 1025// timestamp('2020-10-01T00:00:00.000Z')", 1026// } 1027// } 1028// ], 1029// "etag": "BwWWja0YfJA=", 1030// "version": 3 1031// } 1032// 1033// **YAML example:** 1034// 1035// bindings: 1036// - members: 1037// - user:mike@example.com 1038// - group:admins@example.com 1039// - domain:google.com 1040// - serviceAccount:my-project-id@appspot.gserviceaccount.com 1041// role: roles/resourcemanager.organizationAdmin 1042// - members: 1043// - user:eve@example.com 1044// role: roles/resourcemanager.organizationViewer 1045// condition: 1046// title: expirable access 1047// description: Does not grant access after Sep 2020 1048// expression: request.time < 1049// timestamp('2020-10-01T00:00:00.000Z') 1050// - etag: BwWWja0YfJA= 1051// - version: 3 1052// 1053// For a description of IAM and its features, see the 1054// [IAM documentation](https://cloud.google.com/iam/docs/). 1055type Policy struct { 1056 // AuditConfigs: Specifies cloud audit logging configuration for this 1057 // policy. 1058 AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"` 1059 1060 // Bindings: Associates a list of `members` to a `role`. Optionally, may 1061 // specify a 1062 // `condition` that determines how and when the `bindings` are applied. 1063 // Each 1064 // of the `bindings` must contain at least one member. 1065 Bindings []*Binding `json:"bindings,omitempty"` 1066 1067 // Etag: `etag` is used for optimistic concurrency control as a way to 1068 // help 1069 // prevent simultaneous updates of a policy from overwriting each 1070 // other. 1071 // It is strongly suggested that systems make use of the `etag` in 1072 // the 1073 // read-modify-write cycle to perform policy updates in order to avoid 1074 // race 1075 // conditions: An `etag` is returned in the response to `getIamPolicy`, 1076 // and 1077 // systems are expected to put that etag in the request to 1078 // `setIamPolicy` to 1079 // ensure that their change will be applied to the same version of the 1080 // policy. 1081 // 1082 // **Important:** If you use IAM Conditions, you must include the `etag` 1083 // field 1084 // whenever you call `setIamPolicy`. If you omit this field, then IAM 1085 // allows 1086 // you to overwrite a version `3` policy with a version `1` policy, and 1087 // all of 1088 // the conditions in the version `3` policy are lost. 1089 Etag string `json:"etag,omitempty"` 1090 1091 // Version: Specifies the format of the policy. 1092 // 1093 // Valid values are `0`, `1`, and `3`. Requests that specify an invalid 1094 // value 1095 // are rejected. 1096 // 1097 // Any operation that affects conditional role bindings must specify 1098 // version 1099 // `3`. This requirement applies to the following operations: 1100 // 1101 // * Getting a policy that includes a conditional role binding 1102 // * Adding a conditional role binding to a policy 1103 // * Changing a conditional role binding in a policy 1104 // * Removing any role binding, with or without a condition, from a 1105 // policy 1106 // that includes conditions 1107 // 1108 // **Important:** If you use IAM Conditions, you must include the `etag` 1109 // field 1110 // whenever you call `setIamPolicy`. If you omit this field, then IAM 1111 // allows 1112 // you to overwrite a version `3` policy with a version `1` policy, and 1113 // all of 1114 // the conditions in the version `3` policy are lost. 1115 // 1116 // If a policy does not include any conditions, operations on that 1117 // policy may 1118 // specify any valid version or leave the field unset. 1119 Version int64 `json:"version,omitempty"` 1120 1121 // ServerResponse contains the HTTP response code and headers from the 1122 // server. 1123 googleapi.ServerResponse `json:"-"` 1124 1125 // ForceSendFields is a list of field names (e.g. "AuditConfigs") to 1126 // unconditionally include in API requests. By default, fields with 1127 // empty values are omitted from API requests. However, any non-pointer, 1128 // non-interface field appearing in ForceSendFields will be sent to the 1129 // server regardless of whether the field is empty or not. This may be 1130 // used to include empty fields in Patch requests. 1131 ForceSendFields []string `json:"-"` 1132 1133 // NullFields is a list of field names (e.g. "AuditConfigs") to include 1134 // in API requests with the JSON null value. By default, fields with 1135 // empty values are omitted from API requests. However, any field with 1136 // an empty value appearing in NullFields will be sent to the server as 1137 // null. It is an error if a field in this list has a non-empty value. 1138 // This may be used to include null fields in Patch requests. 1139 NullFields []string `json:"-"` 1140} 1141 1142func (s *Policy) MarshalJSON() ([]byte, error) { 1143 type NoMethod Policy 1144 raw := NoMethod(*s) 1145 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1146} 1147 1148// Project: A Project is a high-level Google Cloud Platform entity. It 1149// is a 1150// container for ACLs, APIs, App Engine Apps, VMs, and other 1151// Google Cloud Platform resources. 1152type Project struct { 1153 // CreateTime: Creation time. 1154 // 1155 // Read-only. 1156 CreateTime string `json:"createTime,omitempty"` 1157 1158 // Labels: The labels associated with this Project. 1159 // 1160 // Label keys must be between 1 and 63 characters long and must 1161 // conform 1162 // to the following regular expression: 1163 // \[a-z\](\[-a-z0-9\]*\[a-z0-9\])?. 1164 // 1165 // Label values must be between 0 and 63 characters long and must 1166 // conform 1167 // to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. A 1168 // label 1169 // value can be empty. 1170 // 1171 // No more than 256 labels can be associated with a given 1172 // resource. 1173 // 1174 // Clients should store labels in a representation such as JSON that 1175 // does not 1176 // depend on specific characters being disallowed. 1177 // 1178 // Example: <code>"environment" : "dev"</code> 1179 // Read-write. 1180 Labels map[string]string `json:"labels,omitempty"` 1181 1182 // LifecycleState: The Project lifecycle state. 1183 // 1184 // Read-only. 1185 // 1186 // Possible values: 1187 // "LIFECYCLE_STATE_UNSPECIFIED" - Unspecified state. This is only 1188 // used/useful for distinguishing 1189 // unset values. 1190 // "ACTIVE" - The normal and active state. 1191 // "DELETE_REQUESTED" - The project has been marked for deletion by 1192 // the user 1193 // (by invoking 1194 // DeleteProject) 1195 // or by the system (Google Cloud Platform). 1196 // This can generally be reversed by invoking UndeleteProject. 1197 // "DELETE_IN_PROGRESS" - This lifecycle state is no longer used and 1198 // is not returned by the API. 1199 LifecycleState string `json:"lifecycleState,omitempty"` 1200 1201 // Name: The optional user-assigned display name of the Project. 1202 // When present it must be between 4 to 30 characters. 1203 // Allowed characters are: lowercase and uppercase letters, 1204 // numbers, 1205 // hyphen, single-quote, double-quote, space, and exclamation 1206 // point. 1207 // 1208 // Example: <code>My Project</code> 1209 // Read-write. 1210 Name string `json:"name,omitempty"` 1211 1212 // Parent: An optional reference to a parent Resource. 1213 // 1214 // Supported parent types include "organization" and "folder". Once set, 1215 // the 1216 // parent cannot be cleared. The `parent` can be set on creation or 1217 // using the 1218 // `UpdateProject` method; the end user must have 1219 // the 1220 // `resourcemanager.projects.create` permission on the 1221 // parent. 1222 // 1223 // Read-write. 1224 Parent *ResourceId `json:"parent,omitempty"` 1225 1226 // ProjectId: The unique, user-assigned ID of the Project. 1227 // It must be 6 to 30 lowercase letters, digits, or hyphens. 1228 // It must start with a letter. 1229 // Trailing hyphens are prohibited. 1230 // 1231 // Example: <code>tokyo-rain-123</code> 1232 // Read-only after creation. 1233 ProjectId string `json:"projectId,omitempty"` 1234 1235 // ProjectNumber: The number uniquely identifying the project. 1236 // 1237 // Example: <code>415104041262</code> 1238 // Read-only. 1239 ProjectNumber int64 `json:"projectNumber,omitempty,string"` 1240 1241 // ServerResponse contains the HTTP response code and headers from the 1242 // server. 1243 googleapi.ServerResponse `json:"-"` 1244 1245 // ForceSendFields is a list of field names (e.g. "CreateTime") to 1246 // unconditionally include in API requests. By default, fields with 1247 // empty values are omitted from API requests. However, any non-pointer, 1248 // non-interface field appearing in ForceSendFields will be sent to the 1249 // server regardless of whether the field is empty or not. This may be 1250 // used to include empty fields in Patch requests. 1251 ForceSendFields []string `json:"-"` 1252 1253 // NullFields is a list of field names (e.g. "CreateTime") to include in 1254 // API requests with the JSON null value. By default, fields with empty 1255 // values are omitted from API requests. However, any field with an 1256 // empty value appearing in NullFields will be sent to the server as 1257 // null. It is an error if a field in this list has a non-empty value. 1258 // This may be used to include null fields in Patch requests. 1259 NullFields []string `json:"-"` 1260} 1261 1262func (s *Project) MarshalJSON() ([]byte, error) { 1263 type NoMethod Project 1264 raw := NoMethod(*s) 1265 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1266} 1267 1268// ProjectCreationStatus: A status object which is used as the 1269// `metadata` field for the Operation 1270// returned by CreateProject. It provides insight for when significant 1271// phases of 1272// Project creation have completed. 1273type ProjectCreationStatus struct { 1274 // CreateTime: Creation time of the project creation workflow. 1275 CreateTime string `json:"createTime,omitempty"` 1276 1277 // Gettable: True if the project can be retrieved using GetProject. No 1278 // other operations 1279 // on the project are guaranteed to work until the project creation 1280 // is 1281 // complete. 1282 Gettable bool `json:"gettable,omitempty"` 1283 1284 // Ready: True if the project creation process is complete. 1285 Ready bool `json:"ready,omitempty"` 1286 1287 // ForceSendFields is a list of field names (e.g. "CreateTime") to 1288 // unconditionally include in API requests. By default, fields with 1289 // empty values are omitted from API requests. However, any non-pointer, 1290 // non-interface field appearing in ForceSendFields will be sent to the 1291 // server regardless of whether the field is empty or not. This may be 1292 // used to include empty fields in Patch requests. 1293 ForceSendFields []string `json:"-"` 1294 1295 // NullFields is a list of field names (e.g. "CreateTime") to include in 1296 // API requests with the JSON null value. By default, fields with empty 1297 // values are omitted from API requests. However, any field with an 1298 // empty value appearing in NullFields will be sent to the server as 1299 // null. It is an error if a field in this list has a non-empty value. 1300 // This may be used to include null fields in Patch requests. 1301 NullFields []string `json:"-"` 1302} 1303 1304func (s *ProjectCreationStatus) MarshalJSON() ([]byte, error) { 1305 type NoMethod ProjectCreationStatus 1306 raw := NoMethod(*s) 1307 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1308} 1309 1310// ResourceId: A container to reference an id for any resource type. A 1311// `resource` in Google 1312// Cloud Platform is a generic term for something you (a developer) may 1313// want to 1314// interact with through one of our API's. Some examples are an App 1315// Engine app, 1316// a Compute Engine instance, a Cloud SQL database, and so on. 1317type ResourceId struct { 1318 // Id: Required field for the type-specific id. This should correspond 1319 // to the id 1320 // used in the type-specific API's. 1321 Id string `json:"id,omitempty"` 1322 1323 // Type: Required field representing the resource type this id is 1324 // for. 1325 // At present, the valid types are "project", "folder", and 1326 // "organization". 1327 Type string `json:"type,omitempty"` 1328 1329 // ForceSendFields is a list of field names (e.g. "Id") to 1330 // unconditionally include in API requests. By default, fields with 1331 // empty values are omitted from API requests. However, any non-pointer, 1332 // non-interface field appearing in ForceSendFields will be sent to the 1333 // server regardless of whether the field is empty or not. This may be 1334 // used to include empty fields in Patch requests. 1335 ForceSendFields []string `json:"-"` 1336 1337 // NullFields is a list of field names (e.g. "Id") to include in API 1338 // requests with the JSON null value. By default, fields with empty 1339 // values are omitted from API requests. However, any field with an 1340 // empty value appearing in NullFields will be sent to the server as 1341 // null. It is an error if a field in this list has a non-empty value. 1342 // This may be used to include null fields in Patch requests. 1343 NullFields []string `json:"-"` 1344} 1345 1346func (s *ResourceId) MarshalJSON() ([]byte, error) { 1347 type NoMethod ResourceId 1348 raw := NoMethod(*s) 1349 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1350} 1351 1352// SetIamPolicyRequest: Request message for `SetIamPolicy` method. 1353type SetIamPolicyRequest struct { 1354 // Policy: REQUIRED: The complete policy to be applied to the 1355 // `resource`. The size of 1356 // the policy is limited to a few 10s of KB. An empty policy is a 1357 // valid policy but certain Cloud Platform services (such as 1358 // Projects) 1359 // might reject them. 1360 Policy *Policy `json:"policy,omitempty"` 1361 1362 // UpdateMask: OPTIONAL: A FieldMask specifying which fields of the 1363 // policy to modify. Only 1364 // the fields in the mask will be modified. If no mask is provided, 1365 // the 1366 // following default mask is used: 1367 // paths: "bindings, etag" 1368 // This field is only used by Cloud IAM. 1369 UpdateMask string `json:"updateMask,omitempty"` 1370 1371 // ForceSendFields is a list of field names (e.g. "Policy") to 1372 // unconditionally include in API requests. By default, fields with 1373 // empty values are omitted from API requests. However, any non-pointer, 1374 // non-interface field appearing in ForceSendFields will be sent to the 1375 // server regardless of whether the field is empty or not. This may be 1376 // used to include empty fields in Patch requests. 1377 ForceSendFields []string `json:"-"` 1378 1379 // NullFields is a list of field names (e.g. "Policy") to include in API 1380 // requests with the JSON null value. By default, fields with empty 1381 // values are omitted from API requests. However, any field with an 1382 // empty value appearing in NullFields will be sent to the server as 1383 // null. It is an error if a field in this list has a non-empty value. 1384 // This may be used to include null fields in Patch requests. 1385 NullFields []string `json:"-"` 1386} 1387 1388func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) { 1389 type NoMethod SetIamPolicyRequest 1390 raw := NoMethod(*s) 1391 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1392} 1393 1394// TestIamPermissionsRequest: Request message for `TestIamPermissions` 1395// method. 1396type TestIamPermissionsRequest struct { 1397 // Permissions: The set of permissions to check for the `resource`. 1398 // Permissions with 1399 // wildcards (such as '*' or 'storage.*') are not allowed. For 1400 // more 1401 // information see 1402 // [IAM 1403 // Overview](https://cloud.google.com/iam/docs/overview#permissions). 1404 Permissions []string `json:"permissions,omitempty"` 1405 1406 // ForceSendFields is a list of field names (e.g. "Permissions") to 1407 // unconditionally include in API requests. By default, fields with 1408 // empty values are omitted from API requests. However, any non-pointer, 1409 // non-interface field appearing in ForceSendFields will be sent to the 1410 // server regardless of whether the field is empty or not. This may be 1411 // used to include empty fields in Patch requests. 1412 ForceSendFields []string `json:"-"` 1413 1414 // NullFields is a list of field names (e.g. "Permissions") to include 1415 // in API requests with the JSON null value. By default, fields with 1416 // empty values are omitted from API requests. However, any field with 1417 // an empty value appearing in NullFields will be sent to the server as 1418 // null. It is an error if a field in this list has a non-empty value. 1419 // This may be used to include null fields in Patch requests. 1420 NullFields []string `json:"-"` 1421} 1422 1423func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) { 1424 type NoMethod TestIamPermissionsRequest 1425 raw := NoMethod(*s) 1426 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1427} 1428 1429// TestIamPermissionsResponse: Response message for `TestIamPermissions` 1430// method. 1431type TestIamPermissionsResponse struct { 1432 // Permissions: A subset of `TestPermissionsRequest.permissions` that 1433 // the caller is 1434 // allowed. 1435 Permissions []string `json:"permissions,omitempty"` 1436 1437 // ServerResponse contains the HTTP response code and headers from the 1438 // server. 1439 googleapi.ServerResponse `json:"-"` 1440 1441 // ForceSendFields is a list of field names (e.g. "Permissions") to 1442 // unconditionally include in API requests. By default, fields with 1443 // empty values are omitted from API requests. However, any non-pointer, 1444 // non-interface field appearing in ForceSendFields will be sent to the 1445 // server regardless of whether the field is empty or not. This may be 1446 // used to include empty fields in Patch requests. 1447 ForceSendFields []string `json:"-"` 1448 1449 // NullFields is a list of field names (e.g. "Permissions") to include 1450 // in API requests with the JSON null value. By default, fields with 1451 // empty values are omitted from API requests. However, any field with 1452 // an empty value appearing in NullFields will be sent to the server as 1453 // null. It is an error if a field in this list has a non-empty value. 1454 // This may be used to include null fields in Patch requests. 1455 NullFields []string `json:"-"` 1456} 1457 1458func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) { 1459 type NoMethod TestIamPermissionsResponse 1460 raw := NoMethod(*s) 1461 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1462} 1463 1464// UndeleteProjectRequest: The request sent to the 1465// UndeleteProject 1466// method. 1467type UndeleteProjectRequest struct { 1468} 1469 1470// method id "cloudresourcemanager.organizations.get": 1471 1472type OrganizationsGetCall struct { 1473 s *Service 1474 name string 1475 urlParams_ gensupport.URLParams 1476 ifNoneMatch_ string 1477 ctx_ context.Context 1478 header_ http.Header 1479} 1480 1481// Get: Fetches an Organization resource identified by the specified 1482// resource name. 1483func (r *OrganizationsService) Get(name string) *OrganizationsGetCall { 1484 c := &OrganizationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1485 c.name = name 1486 return c 1487} 1488 1489// OrganizationId sets the optional parameter "organizationId": The id 1490// of the Organization resource to fetch. 1491// This field is deprecated and will be removed in v1. Use name instead. 1492func (c *OrganizationsGetCall) OrganizationId(organizationId string) *OrganizationsGetCall { 1493 c.urlParams_.Set("organizationId", organizationId) 1494 return c 1495} 1496 1497// Fields allows partial responses to be retrieved. See 1498// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1499// for more information. 1500func (c *OrganizationsGetCall) Fields(s ...googleapi.Field) *OrganizationsGetCall { 1501 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1502 return c 1503} 1504 1505// IfNoneMatch sets the optional parameter which makes the operation 1506// fail if the object's ETag matches the given value. This is useful for 1507// getting updates only after the object has changed since the last 1508// request. Use googleapi.IsNotModified to check whether the response 1509// error from Do is the result of In-None-Match. 1510func (c *OrganizationsGetCall) IfNoneMatch(entityTag string) *OrganizationsGetCall { 1511 c.ifNoneMatch_ = entityTag 1512 return c 1513} 1514 1515// Context sets the context to be used in this call's Do method. Any 1516// pending HTTP request will be aborted if the provided context is 1517// canceled. 1518func (c *OrganizationsGetCall) Context(ctx context.Context) *OrganizationsGetCall { 1519 c.ctx_ = ctx 1520 return c 1521} 1522 1523// Header returns an http.Header that can be modified by the caller to 1524// add HTTP headers to the request. 1525func (c *OrganizationsGetCall) Header() http.Header { 1526 if c.header_ == nil { 1527 c.header_ = make(http.Header) 1528 } 1529 return c.header_ 1530} 1531 1532func (c *OrganizationsGetCall) doRequest(alt string) (*http.Response, error) { 1533 reqHeaders := make(http.Header) 1534 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1535 for k, v := range c.header_ { 1536 reqHeaders[k] = v 1537 } 1538 reqHeaders.Set("User-Agent", c.s.userAgent()) 1539 if c.ifNoneMatch_ != "" { 1540 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1541 } 1542 var body io.Reader = nil 1543 c.urlParams_.Set("alt", alt) 1544 c.urlParams_.Set("prettyPrint", "false") 1545 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 1546 urls += "?" + c.urlParams_.Encode() 1547 req, err := http.NewRequest("GET", urls, body) 1548 if err != nil { 1549 return nil, err 1550 } 1551 req.Header = reqHeaders 1552 googleapi.Expand(req.URL, map[string]string{ 1553 "name": c.name, 1554 }) 1555 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1556} 1557 1558// Do executes the "cloudresourcemanager.organizations.get" call. 1559// Exactly one of *Organization or error will be non-nil. Any non-2xx 1560// status code is an error. Response headers are in either 1561// *Organization.ServerResponse.Header or (if a response was returned at 1562// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1563// to check whether the returned error was because 1564// http.StatusNotModified was returned. 1565func (c *OrganizationsGetCall) Do(opts ...googleapi.CallOption) (*Organization, error) { 1566 gensupport.SetOptions(c.urlParams_, opts...) 1567 res, err := c.doRequest("json") 1568 if res != nil && res.StatusCode == http.StatusNotModified { 1569 if res.Body != nil { 1570 res.Body.Close() 1571 } 1572 return nil, &googleapi.Error{ 1573 Code: res.StatusCode, 1574 Header: res.Header, 1575 } 1576 } 1577 if err != nil { 1578 return nil, err 1579 } 1580 defer googleapi.CloseBody(res) 1581 if err := googleapi.CheckResponse(res); err != nil { 1582 return nil, err 1583 } 1584 ret := &Organization{ 1585 ServerResponse: googleapi.ServerResponse{ 1586 Header: res.Header, 1587 HTTPStatusCode: res.StatusCode, 1588 }, 1589 } 1590 target := &ret 1591 if err := gensupport.DecodeResponse(target, res); err != nil { 1592 return nil, err 1593 } 1594 return ret, nil 1595 // { 1596 // "description": "Fetches an Organization resource identified by the specified resource name.", 1597 // "flatPath": "v1beta1/organizations/{organizationsId}", 1598 // "httpMethod": "GET", 1599 // "id": "cloudresourcemanager.organizations.get", 1600 // "parameterOrder": [ 1601 // "name" 1602 // ], 1603 // "parameters": { 1604 // "name": { 1605 // "description": "The resource name of the Organization to fetch. This is the organization's\nrelative path in the API, formatted as \"organizations/[organizationId]\".\nFor example, \"organizations/1234\".", 1606 // "location": "path", 1607 // "pattern": "^organizations/[^/]+$", 1608 // "required": true, 1609 // "type": "string" 1610 // }, 1611 // "organizationId": { 1612 // "description": "The id of the Organization resource to fetch.\nThis field is deprecated and will be removed in v1. Use name instead.", 1613 // "location": "query", 1614 // "type": "string" 1615 // } 1616 // }, 1617 // "path": "v1beta1/{+name}", 1618 // "response": { 1619 // "$ref": "Organization" 1620 // }, 1621 // "scopes": [ 1622 // "https://www.googleapis.com/auth/cloud-platform", 1623 // "https://www.googleapis.com/auth/cloud-platform.read-only" 1624 // ] 1625 // } 1626 1627} 1628 1629// method id "cloudresourcemanager.organizations.getIamPolicy": 1630 1631type OrganizationsGetIamPolicyCall struct { 1632 s *Service 1633 resource string 1634 getiampolicyrequest *GetIamPolicyRequest 1635 urlParams_ gensupport.URLParams 1636 ctx_ context.Context 1637 header_ http.Header 1638} 1639 1640// GetIamPolicy: Gets the access control policy for an Organization 1641// resource. May be empty 1642// if no such policy or resource exists. The `resource` field should be 1643// the 1644// organization's resource name, e.g. "organizations/123". 1645func (r *OrganizationsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *OrganizationsGetIamPolicyCall { 1646 c := &OrganizationsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1647 c.resource = resource 1648 c.getiampolicyrequest = getiampolicyrequest 1649 return c 1650} 1651 1652// Fields allows partial responses to be retrieved. See 1653// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1654// for more information. 1655func (c *OrganizationsGetIamPolicyCall) Fields(s ...googleapi.Field) *OrganizationsGetIamPolicyCall { 1656 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1657 return c 1658} 1659 1660// Context sets the context to be used in this call's Do method. Any 1661// pending HTTP request will be aborted if the provided context is 1662// canceled. 1663func (c *OrganizationsGetIamPolicyCall) Context(ctx context.Context) *OrganizationsGetIamPolicyCall { 1664 c.ctx_ = ctx 1665 return c 1666} 1667 1668// Header returns an http.Header that can be modified by the caller to 1669// add HTTP headers to the request. 1670func (c *OrganizationsGetIamPolicyCall) Header() http.Header { 1671 if c.header_ == nil { 1672 c.header_ = make(http.Header) 1673 } 1674 return c.header_ 1675} 1676 1677func (c *OrganizationsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 1678 reqHeaders := make(http.Header) 1679 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1680 for k, v := range c.header_ { 1681 reqHeaders[k] = v 1682 } 1683 reqHeaders.Set("User-Agent", c.s.userAgent()) 1684 var body io.Reader = nil 1685 body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest) 1686 if err != nil { 1687 return nil, err 1688 } 1689 reqHeaders.Set("Content-Type", "application/json") 1690 c.urlParams_.Set("alt", alt) 1691 c.urlParams_.Set("prettyPrint", "false") 1692 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:getIamPolicy") 1693 urls += "?" + c.urlParams_.Encode() 1694 req, err := http.NewRequest("POST", urls, body) 1695 if err != nil { 1696 return nil, err 1697 } 1698 req.Header = reqHeaders 1699 googleapi.Expand(req.URL, map[string]string{ 1700 "resource": c.resource, 1701 }) 1702 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1703} 1704 1705// Do executes the "cloudresourcemanager.organizations.getIamPolicy" call. 1706// Exactly one of *Policy or error will be non-nil. Any non-2xx status 1707// code is an error. Response headers are in either 1708// *Policy.ServerResponse.Header or (if a response was returned at all) 1709// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1710// check whether the returned error was because http.StatusNotModified 1711// was returned. 1712func (c *OrganizationsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 1713 gensupport.SetOptions(c.urlParams_, opts...) 1714 res, err := c.doRequest("json") 1715 if res != nil && res.StatusCode == http.StatusNotModified { 1716 if res.Body != nil { 1717 res.Body.Close() 1718 } 1719 return nil, &googleapi.Error{ 1720 Code: res.StatusCode, 1721 Header: res.Header, 1722 } 1723 } 1724 if err != nil { 1725 return nil, err 1726 } 1727 defer googleapi.CloseBody(res) 1728 if err := googleapi.CheckResponse(res); err != nil { 1729 return nil, err 1730 } 1731 ret := &Policy{ 1732 ServerResponse: googleapi.ServerResponse{ 1733 Header: res.Header, 1734 HTTPStatusCode: res.StatusCode, 1735 }, 1736 } 1737 target := &ret 1738 if err := gensupport.DecodeResponse(target, res); err != nil { 1739 return nil, err 1740 } 1741 return ret, nil 1742 // { 1743 // "description": "Gets the access control policy for an Organization resource. May be empty\nif no such policy or resource exists. The `resource` field should be the\norganization's resource name, e.g. \"organizations/123\".", 1744 // "flatPath": "v1beta1/organizations/{organizationsId}:getIamPolicy", 1745 // "httpMethod": "POST", 1746 // "id": "cloudresourcemanager.organizations.getIamPolicy", 1747 // "parameterOrder": [ 1748 // "resource" 1749 // ], 1750 // "parameters": { 1751 // "resource": { 1752 // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.", 1753 // "location": "path", 1754 // "pattern": "^organizations/[^/]+$", 1755 // "required": true, 1756 // "type": "string" 1757 // } 1758 // }, 1759 // "path": "v1beta1/{+resource}:getIamPolicy", 1760 // "request": { 1761 // "$ref": "GetIamPolicyRequest" 1762 // }, 1763 // "response": { 1764 // "$ref": "Policy" 1765 // }, 1766 // "scopes": [ 1767 // "https://www.googleapis.com/auth/cloud-platform", 1768 // "https://www.googleapis.com/auth/cloud-platform.read-only" 1769 // ] 1770 // } 1771 1772} 1773 1774// method id "cloudresourcemanager.organizations.list": 1775 1776type OrganizationsListCall struct { 1777 s *Service 1778 urlParams_ gensupport.URLParams 1779 ifNoneMatch_ string 1780 ctx_ context.Context 1781 header_ http.Header 1782} 1783 1784// List: Lists Organization resources that are visible to the user and 1785// satisfy 1786// the specified filter. This method returns Organizations in an 1787// unspecified 1788// order. New Organizations do not necessarily appear at the end of the 1789// list. 1790func (r *OrganizationsService) List() *OrganizationsListCall { 1791 c := &OrganizationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1792 return c 1793} 1794 1795// Filter sets the optional parameter "filter": An optional query string 1796// used to filter the Organizations to return in 1797// the response. Filter rules are case-insensitive. 1798// 1799// 1800// Organizations may be filtered by `owner.directoryCustomerId` or 1801// by 1802// `domain`, where the domain is a G Suite domain, for example: 1803// 1804// * Filter `owner.directorycustomerid:123456789` returns 1805// Organization 1806// resources with `owner.directory_customer_id` equal to `123456789`. 1807// * Filter `domain:google.com` returns Organization resources 1808// corresponding 1809// to the domain `google.com`. 1810// 1811// This field is optional. 1812func (c *OrganizationsListCall) Filter(filter string) *OrganizationsListCall { 1813 c.urlParams_.Set("filter", filter) 1814 return c 1815} 1816 1817// PageSize sets the optional parameter "pageSize": The maximum number 1818// of Organizations to return in the response. 1819// This field is optional. 1820func (c *OrganizationsListCall) PageSize(pageSize int64) *OrganizationsListCall { 1821 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1822 return c 1823} 1824 1825// PageToken sets the optional parameter "pageToken": A pagination token 1826// returned from a previous call to `ListOrganizations` 1827// that indicates from where listing should continue. 1828// This field is optional. 1829func (c *OrganizationsListCall) PageToken(pageToken string) *OrganizationsListCall { 1830 c.urlParams_.Set("pageToken", pageToken) 1831 return c 1832} 1833 1834// Fields allows partial responses to be retrieved. See 1835// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1836// for more information. 1837func (c *OrganizationsListCall) Fields(s ...googleapi.Field) *OrganizationsListCall { 1838 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1839 return c 1840} 1841 1842// IfNoneMatch sets the optional parameter which makes the operation 1843// fail if the object's ETag matches the given value. This is useful for 1844// getting updates only after the object has changed since the last 1845// request. Use googleapi.IsNotModified to check whether the response 1846// error from Do is the result of In-None-Match. 1847func (c *OrganizationsListCall) IfNoneMatch(entityTag string) *OrganizationsListCall { 1848 c.ifNoneMatch_ = entityTag 1849 return c 1850} 1851 1852// Context sets the context to be used in this call's Do method. Any 1853// pending HTTP request will be aborted if the provided context is 1854// canceled. 1855func (c *OrganizationsListCall) Context(ctx context.Context) *OrganizationsListCall { 1856 c.ctx_ = ctx 1857 return c 1858} 1859 1860// Header returns an http.Header that can be modified by the caller to 1861// add HTTP headers to the request. 1862func (c *OrganizationsListCall) Header() http.Header { 1863 if c.header_ == nil { 1864 c.header_ = make(http.Header) 1865 } 1866 return c.header_ 1867} 1868 1869func (c *OrganizationsListCall) doRequest(alt string) (*http.Response, error) { 1870 reqHeaders := make(http.Header) 1871 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1872 for k, v := range c.header_ { 1873 reqHeaders[k] = v 1874 } 1875 reqHeaders.Set("User-Agent", c.s.userAgent()) 1876 if c.ifNoneMatch_ != "" { 1877 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1878 } 1879 var body io.Reader = nil 1880 c.urlParams_.Set("alt", alt) 1881 c.urlParams_.Set("prettyPrint", "false") 1882 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/organizations") 1883 urls += "?" + c.urlParams_.Encode() 1884 req, err := http.NewRequest("GET", urls, body) 1885 if err != nil { 1886 return nil, err 1887 } 1888 req.Header = reqHeaders 1889 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1890} 1891 1892// Do executes the "cloudresourcemanager.organizations.list" call. 1893// Exactly one of *ListOrganizationsResponse or error will be non-nil. 1894// Any non-2xx status code is an error. Response headers are in either 1895// *ListOrganizationsResponse.ServerResponse.Header or (if a response 1896// was returned at all) in error.(*googleapi.Error).Header. Use 1897// googleapi.IsNotModified to check whether the returned error was 1898// because http.StatusNotModified was returned. 1899func (c *OrganizationsListCall) Do(opts ...googleapi.CallOption) (*ListOrganizationsResponse, error) { 1900 gensupport.SetOptions(c.urlParams_, opts...) 1901 res, err := c.doRequest("json") 1902 if res != nil && res.StatusCode == http.StatusNotModified { 1903 if res.Body != nil { 1904 res.Body.Close() 1905 } 1906 return nil, &googleapi.Error{ 1907 Code: res.StatusCode, 1908 Header: res.Header, 1909 } 1910 } 1911 if err != nil { 1912 return nil, err 1913 } 1914 defer googleapi.CloseBody(res) 1915 if err := googleapi.CheckResponse(res); err != nil { 1916 return nil, err 1917 } 1918 ret := &ListOrganizationsResponse{ 1919 ServerResponse: googleapi.ServerResponse{ 1920 Header: res.Header, 1921 HTTPStatusCode: res.StatusCode, 1922 }, 1923 } 1924 target := &ret 1925 if err := gensupport.DecodeResponse(target, res); err != nil { 1926 return nil, err 1927 } 1928 return ret, nil 1929 // { 1930 // "description": "Lists Organization resources that are visible to the user and satisfy\nthe specified filter. This method returns Organizations in an unspecified\norder. New Organizations do not necessarily appear at the end of the list.", 1931 // "flatPath": "v1beta1/organizations", 1932 // "httpMethod": "GET", 1933 // "id": "cloudresourcemanager.organizations.list", 1934 // "parameterOrder": [], 1935 // "parameters": { 1936 // "filter": { 1937 // "description": "An optional query string used to filter the Organizations to return in\nthe response. Filter rules are case-insensitive.\n\n\nOrganizations may be filtered by `owner.directoryCustomerId` or by\n`domain`, where the domain is a G Suite domain, for example:\n\n* Filter `owner.directorycustomerid:123456789` returns Organization\nresources with `owner.directory_customer_id` equal to `123456789`.\n* Filter `domain:google.com` returns Organization resources corresponding\nto the domain `google.com`.\n\nThis field is optional.", 1938 // "location": "query", 1939 // "type": "string" 1940 // }, 1941 // "pageSize": { 1942 // "description": "The maximum number of Organizations to return in the response.\nThis field is optional.", 1943 // "format": "int32", 1944 // "location": "query", 1945 // "type": "integer" 1946 // }, 1947 // "pageToken": { 1948 // "description": "A pagination token returned from a previous call to `ListOrganizations`\nthat indicates from where listing should continue.\nThis field is optional.", 1949 // "location": "query", 1950 // "type": "string" 1951 // } 1952 // }, 1953 // "path": "v1beta1/organizations", 1954 // "response": { 1955 // "$ref": "ListOrganizationsResponse" 1956 // }, 1957 // "scopes": [ 1958 // "https://www.googleapis.com/auth/cloud-platform", 1959 // "https://www.googleapis.com/auth/cloud-platform.read-only" 1960 // ] 1961 // } 1962 1963} 1964 1965// Pages invokes f for each page of results. 1966// A non-nil error returned from f will halt the iteration. 1967// The provided context supersedes any context provided to the Context method. 1968func (c *OrganizationsListCall) Pages(ctx context.Context, f func(*ListOrganizationsResponse) error) error { 1969 c.ctx_ = ctx 1970 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1971 for { 1972 x, err := c.Do() 1973 if err != nil { 1974 return err 1975 } 1976 if err := f(x); err != nil { 1977 return err 1978 } 1979 if x.NextPageToken == "" { 1980 return nil 1981 } 1982 c.PageToken(x.NextPageToken) 1983 } 1984} 1985 1986// method id "cloudresourcemanager.organizations.setIamPolicy": 1987 1988type OrganizationsSetIamPolicyCall struct { 1989 s *Service 1990 resource string 1991 setiampolicyrequest *SetIamPolicyRequest 1992 urlParams_ gensupport.URLParams 1993 ctx_ context.Context 1994 header_ http.Header 1995} 1996 1997// SetIamPolicy: Sets the access control policy on an Organization 1998// resource. Replaces any 1999// existing policy. The `resource` field should be the organization's 2000// resource 2001// name, e.g. "organizations/123". 2002func (r *OrganizationsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *OrganizationsSetIamPolicyCall { 2003 c := &OrganizationsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2004 c.resource = resource 2005 c.setiampolicyrequest = setiampolicyrequest 2006 return c 2007} 2008 2009// Fields allows partial responses to be retrieved. See 2010// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2011// for more information. 2012func (c *OrganizationsSetIamPolicyCall) Fields(s ...googleapi.Field) *OrganizationsSetIamPolicyCall { 2013 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2014 return c 2015} 2016 2017// Context sets the context to be used in this call's Do method. Any 2018// pending HTTP request will be aborted if the provided context is 2019// canceled. 2020func (c *OrganizationsSetIamPolicyCall) Context(ctx context.Context) *OrganizationsSetIamPolicyCall { 2021 c.ctx_ = ctx 2022 return c 2023} 2024 2025// Header returns an http.Header that can be modified by the caller to 2026// add HTTP headers to the request. 2027func (c *OrganizationsSetIamPolicyCall) Header() http.Header { 2028 if c.header_ == nil { 2029 c.header_ = make(http.Header) 2030 } 2031 return c.header_ 2032} 2033 2034func (c *OrganizationsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 2035 reqHeaders := make(http.Header) 2036 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2037 for k, v := range c.header_ { 2038 reqHeaders[k] = v 2039 } 2040 reqHeaders.Set("User-Agent", c.s.userAgent()) 2041 var body io.Reader = nil 2042 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 2043 if err != nil { 2044 return nil, err 2045 } 2046 reqHeaders.Set("Content-Type", "application/json") 2047 c.urlParams_.Set("alt", alt) 2048 c.urlParams_.Set("prettyPrint", "false") 2049 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:setIamPolicy") 2050 urls += "?" + c.urlParams_.Encode() 2051 req, err := http.NewRequest("POST", urls, body) 2052 if err != nil { 2053 return nil, err 2054 } 2055 req.Header = reqHeaders 2056 googleapi.Expand(req.URL, map[string]string{ 2057 "resource": c.resource, 2058 }) 2059 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2060} 2061 2062// Do executes the "cloudresourcemanager.organizations.setIamPolicy" call. 2063// Exactly one of *Policy or error will be non-nil. Any non-2xx status 2064// code is an error. Response headers are in either 2065// *Policy.ServerResponse.Header or (if a response was returned at all) 2066// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2067// check whether the returned error was because http.StatusNotModified 2068// was returned. 2069func (c *OrganizationsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 2070 gensupport.SetOptions(c.urlParams_, opts...) 2071 res, err := c.doRequest("json") 2072 if res != nil && res.StatusCode == http.StatusNotModified { 2073 if res.Body != nil { 2074 res.Body.Close() 2075 } 2076 return nil, &googleapi.Error{ 2077 Code: res.StatusCode, 2078 Header: res.Header, 2079 } 2080 } 2081 if err != nil { 2082 return nil, err 2083 } 2084 defer googleapi.CloseBody(res) 2085 if err := googleapi.CheckResponse(res); err != nil { 2086 return nil, err 2087 } 2088 ret := &Policy{ 2089 ServerResponse: googleapi.ServerResponse{ 2090 Header: res.Header, 2091 HTTPStatusCode: res.StatusCode, 2092 }, 2093 } 2094 target := &ret 2095 if err := gensupport.DecodeResponse(target, res); err != nil { 2096 return nil, err 2097 } 2098 return ret, nil 2099 // { 2100 // "description": "Sets the access control policy on an Organization resource. Replaces any\nexisting policy. The `resource` field should be the organization's resource\nname, e.g. \"organizations/123\".", 2101 // "flatPath": "v1beta1/organizations/{organizationsId}:setIamPolicy", 2102 // "httpMethod": "POST", 2103 // "id": "cloudresourcemanager.organizations.setIamPolicy", 2104 // "parameterOrder": [ 2105 // "resource" 2106 // ], 2107 // "parameters": { 2108 // "resource": { 2109 // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.", 2110 // "location": "path", 2111 // "pattern": "^organizations/[^/]+$", 2112 // "required": true, 2113 // "type": "string" 2114 // } 2115 // }, 2116 // "path": "v1beta1/{+resource}:setIamPolicy", 2117 // "request": { 2118 // "$ref": "SetIamPolicyRequest" 2119 // }, 2120 // "response": { 2121 // "$ref": "Policy" 2122 // }, 2123 // "scopes": [ 2124 // "https://www.googleapis.com/auth/cloud-platform" 2125 // ] 2126 // } 2127 2128} 2129 2130// method id "cloudresourcemanager.organizations.testIamPermissions": 2131 2132type OrganizationsTestIamPermissionsCall struct { 2133 s *Service 2134 resource string 2135 testiampermissionsrequest *TestIamPermissionsRequest 2136 urlParams_ gensupport.URLParams 2137 ctx_ context.Context 2138 header_ http.Header 2139} 2140 2141// TestIamPermissions: Returns permissions that a caller has on the 2142// specified Organization. 2143// The `resource` field should be the organization's resource name, 2144// e.g. "organizations/123". 2145func (r *OrganizationsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *OrganizationsTestIamPermissionsCall { 2146 c := &OrganizationsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2147 c.resource = resource 2148 c.testiampermissionsrequest = testiampermissionsrequest 2149 return c 2150} 2151 2152// Fields allows partial responses to be retrieved. See 2153// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2154// for more information. 2155func (c *OrganizationsTestIamPermissionsCall) Fields(s ...googleapi.Field) *OrganizationsTestIamPermissionsCall { 2156 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2157 return c 2158} 2159 2160// Context sets the context to be used in this call's Do method. Any 2161// pending HTTP request will be aborted if the provided context is 2162// canceled. 2163func (c *OrganizationsTestIamPermissionsCall) Context(ctx context.Context) *OrganizationsTestIamPermissionsCall { 2164 c.ctx_ = ctx 2165 return c 2166} 2167 2168// Header returns an http.Header that can be modified by the caller to 2169// add HTTP headers to the request. 2170func (c *OrganizationsTestIamPermissionsCall) Header() http.Header { 2171 if c.header_ == nil { 2172 c.header_ = make(http.Header) 2173 } 2174 return c.header_ 2175} 2176 2177func (c *OrganizationsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 2178 reqHeaders := make(http.Header) 2179 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2180 for k, v := range c.header_ { 2181 reqHeaders[k] = v 2182 } 2183 reqHeaders.Set("User-Agent", c.s.userAgent()) 2184 var body io.Reader = nil 2185 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 2186 if err != nil { 2187 return nil, err 2188 } 2189 reqHeaders.Set("Content-Type", "application/json") 2190 c.urlParams_.Set("alt", alt) 2191 c.urlParams_.Set("prettyPrint", "false") 2192 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:testIamPermissions") 2193 urls += "?" + c.urlParams_.Encode() 2194 req, err := http.NewRequest("POST", urls, body) 2195 if err != nil { 2196 return nil, err 2197 } 2198 req.Header = reqHeaders 2199 googleapi.Expand(req.URL, map[string]string{ 2200 "resource": c.resource, 2201 }) 2202 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2203} 2204 2205// Do executes the "cloudresourcemanager.organizations.testIamPermissions" call. 2206// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 2207// Any non-2xx status code is an error. Response headers are in either 2208// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 2209// was returned at all) in error.(*googleapi.Error).Header. Use 2210// googleapi.IsNotModified to check whether the returned error was 2211// because http.StatusNotModified was returned. 2212func (c *OrganizationsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 2213 gensupport.SetOptions(c.urlParams_, opts...) 2214 res, err := c.doRequest("json") 2215 if res != nil && res.StatusCode == http.StatusNotModified { 2216 if res.Body != nil { 2217 res.Body.Close() 2218 } 2219 return nil, &googleapi.Error{ 2220 Code: res.StatusCode, 2221 Header: res.Header, 2222 } 2223 } 2224 if err != nil { 2225 return nil, err 2226 } 2227 defer googleapi.CloseBody(res) 2228 if err := googleapi.CheckResponse(res); err != nil { 2229 return nil, err 2230 } 2231 ret := &TestIamPermissionsResponse{ 2232 ServerResponse: googleapi.ServerResponse{ 2233 Header: res.Header, 2234 HTTPStatusCode: res.StatusCode, 2235 }, 2236 } 2237 target := &ret 2238 if err := gensupport.DecodeResponse(target, res); err != nil { 2239 return nil, err 2240 } 2241 return ret, nil 2242 // { 2243 // "description": "Returns permissions that a caller has on the specified Organization.\nThe `resource` field should be the organization's resource name,\ne.g. \"organizations/123\".", 2244 // "flatPath": "v1beta1/organizations/{organizationsId}:testIamPermissions", 2245 // "httpMethod": "POST", 2246 // "id": "cloudresourcemanager.organizations.testIamPermissions", 2247 // "parameterOrder": [ 2248 // "resource" 2249 // ], 2250 // "parameters": { 2251 // "resource": { 2252 // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.", 2253 // "location": "path", 2254 // "pattern": "^organizations/[^/]+$", 2255 // "required": true, 2256 // "type": "string" 2257 // } 2258 // }, 2259 // "path": "v1beta1/{+resource}:testIamPermissions", 2260 // "request": { 2261 // "$ref": "TestIamPermissionsRequest" 2262 // }, 2263 // "response": { 2264 // "$ref": "TestIamPermissionsResponse" 2265 // }, 2266 // "scopes": [ 2267 // "https://www.googleapis.com/auth/cloud-platform", 2268 // "https://www.googleapis.com/auth/cloud-platform.read-only" 2269 // ] 2270 // } 2271 2272} 2273 2274// method id "cloudresourcemanager.organizations.update": 2275 2276type OrganizationsUpdateCall struct { 2277 s *Service 2278 name string 2279 organization *Organization 2280 urlParams_ gensupport.URLParams 2281 ctx_ context.Context 2282 header_ http.Header 2283} 2284 2285// Update: Updates an Organization resource identified by the specified 2286// resource name. 2287func (r *OrganizationsService) Update(name string, organization *Organization) *OrganizationsUpdateCall { 2288 c := &OrganizationsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2289 c.name = name 2290 c.organization = organization 2291 return c 2292} 2293 2294// Fields allows partial responses to be retrieved. See 2295// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2296// for more information. 2297func (c *OrganizationsUpdateCall) Fields(s ...googleapi.Field) *OrganizationsUpdateCall { 2298 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2299 return c 2300} 2301 2302// Context sets the context to be used in this call's Do method. Any 2303// pending HTTP request will be aborted if the provided context is 2304// canceled. 2305func (c *OrganizationsUpdateCall) Context(ctx context.Context) *OrganizationsUpdateCall { 2306 c.ctx_ = ctx 2307 return c 2308} 2309 2310// Header returns an http.Header that can be modified by the caller to 2311// add HTTP headers to the request. 2312func (c *OrganizationsUpdateCall) Header() http.Header { 2313 if c.header_ == nil { 2314 c.header_ = make(http.Header) 2315 } 2316 return c.header_ 2317} 2318 2319func (c *OrganizationsUpdateCall) doRequest(alt string) (*http.Response, error) { 2320 reqHeaders := make(http.Header) 2321 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2322 for k, v := range c.header_ { 2323 reqHeaders[k] = v 2324 } 2325 reqHeaders.Set("User-Agent", c.s.userAgent()) 2326 var body io.Reader = nil 2327 body, err := googleapi.WithoutDataWrapper.JSONReader(c.organization) 2328 if err != nil { 2329 return nil, err 2330 } 2331 reqHeaders.Set("Content-Type", "application/json") 2332 c.urlParams_.Set("alt", alt) 2333 c.urlParams_.Set("prettyPrint", "false") 2334 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") 2335 urls += "?" + c.urlParams_.Encode() 2336 req, err := http.NewRequest("PUT", urls, body) 2337 if err != nil { 2338 return nil, err 2339 } 2340 req.Header = reqHeaders 2341 googleapi.Expand(req.URL, map[string]string{ 2342 "name": c.name, 2343 }) 2344 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2345} 2346 2347// Do executes the "cloudresourcemanager.organizations.update" call. 2348// Exactly one of *Organization or error will be non-nil. Any non-2xx 2349// status code is an error. Response headers are in either 2350// *Organization.ServerResponse.Header or (if a response was returned at 2351// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2352// to check whether the returned error was because 2353// http.StatusNotModified was returned. 2354func (c *OrganizationsUpdateCall) Do(opts ...googleapi.CallOption) (*Organization, error) { 2355 gensupport.SetOptions(c.urlParams_, opts...) 2356 res, err := c.doRequest("json") 2357 if res != nil && res.StatusCode == http.StatusNotModified { 2358 if res.Body != nil { 2359 res.Body.Close() 2360 } 2361 return nil, &googleapi.Error{ 2362 Code: res.StatusCode, 2363 Header: res.Header, 2364 } 2365 } 2366 if err != nil { 2367 return nil, err 2368 } 2369 defer googleapi.CloseBody(res) 2370 if err := googleapi.CheckResponse(res); err != nil { 2371 return nil, err 2372 } 2373 ret := &Organization{ 2374 ServerResponse: googleapi.ServerResponse{ 2375 Header: res.Header, 2376 HTTPStatusCode: res.StatusCode, 2377 }, 2378 } 2379 target := &ret 2380 if err := gensupport.DecodeResponse(target, res); err != nil { 2381 return nil, err 2382 } 2383 return ret, nil 2384 // { 2385 // "description": "Updates an Organization resource identified by the specified resource name.", 2386 // "flatPath": "v1beta1/organizations/{organizationsId}", 2387 // "httpMethod": "PUT", 2388 // "id": "cloudresourcemanager.organizations.update", 2389 // "parameterOrder": [ 2390 // "name" 2391 // ], 2392 // "parameters": { 2393 // "name": { 2394 // "description": "Output only. The resource name of the organization. This is the\norganization's relative path in the API. Its format is\n\"organizations/[organization_id]\". For example, \"organizations/1234\".", 2395 // "location": "path", 2396 // "pattern": "^organizations/[^/]+$", 2397 // "required": true, 2398 // "type": "string" 2399 // } 2400 // }, 2401 // "path": "v1beta1/{+name}", 2402 // "request": { 2403 // "$ref": "Organization" 2404 // }, 2405 // "response": { 2406 // "$ref": "Organization" 2407 // }, 2408 // "scopes": [ 2409 // "https://www.googleapis.com/auth/cloud-platform" 2410 // ] 2411 // } 2412 2413} 2414 2415// method id "cloudresourcemanager.projects.create": 2416 2417type ProjectsCreateCall struct { 2418 s *Service 2419 project *Project 2420 urlParams_ gensupport.URLParams 2421 ctx_ context.Context 2422 header_ http.Header 2423} 2424 2425// Create: Creates a Project resource. 2426// 2427// Initially, the Project resource is owned by its creator 2428// exclusively. 2429// The creator can later grant permission to others to read or update 2430// the 2431// Project. 2432// 2433// Several APIs are activated automatically for the Project, 2434// including 2435// Google Cloud Storage. The parent is identified by a 2436// specified 2437// ResourceId, which must include both an ID and a type, such 2438// as 2439// project, folder, or organization. 2440// 2441// This method does not associate the new project with a billing 2442// account. 2443// You can set or update the billing account associated with a project 2444// using 2445// the 2446// [`projects.updateBillingInfo`] 2447// (/billing/reference/rest/v1/projects/up 2448// dateBillingInfo) method. 2449func (r *ProjectsService) Create(project *Project) *ProjectsCreateCall { 2450 c := &ProjectsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2451 c.project = project 2452 return c 2453} 2454 2455// UseLegacyStack sets the optional parameter "useLegacyStack": A now 2456// unused experiment opt-out option. 2457func (c *ProjectsCreateCall) UseLegacyStack(useLegacyStack bool) *ProjectsCreateCall { 2458 c.urlParams_.Set("useLegacyStack", fmt.Sprint(useLegacyStack)) 2459 return c 2460} 2461 2462// Fields allows partial responses to be retrieved. See 2463// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2464// for more information. 2465func (c *ProjectsCreateCall) Fields(s ...googleapi.Field) *ProjectsCreateCall { 2466 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2467 return c 2468} 2469 2470// Context sets the context to be used in this call's Do method. Any 2471// pending HTTP request will be aborted if the provided context is 2472// canceled. 2473func (c *ProjectsCreateCall) Context(ctx context.Context) *ProjectsCreateCall { 2474 c.ctx_ = ctx 2475 return c 2476} 2477 2478// Header returns an http.Header that can be modified by the caller to 2479// add HTTP headers to the request. 2480func (c *ProjectsCreateCall) Header() http.Header { 2481 if c.header_ == nil { 2482 c.header_ = make(http.Header) 2483 } 2484 return c.header_ 2485} 2486 2487func (c *ProjectsCreateCall) doRequest(alt string) (*http.Response, error) { 2488 reqHeaders := make(http.Header) 2489 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2490 for k, v := range c.header_ { 2491 reqHeaders[k] = v 2492 } 2493 reqHeaders.Set("User-Agent", c.s.userAgent()) 2494 var body io.Reader = nil 2495 body, err := googleapi.WithoutDataWrapper.JSONReader(c.project) 2496 if err != nil { 2497 return nil, err 2498 } 2499 reqHeaders.Set("Content-Type", "application/json") 2500 c.urlParams_.Set("alt", alt) 2501 c.urlParams_.Set("prettyPrint", "false") 2502 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects") 2503 urls += "?" + c.urlParams_.Encode() 2504 req, err := http.NewRequest("POST", urls, body) 2505 if err != nil { 2506 return nil, err 2507 } 2508 req.Header = reqHeaders 2509 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2510} 2511 2512// Do executes the "cloudresourcemanager.projects.create" call. 2513// Exactly one of *Project or error will be non-nil. Any non-2xx status 2514// code is an error. Response headers are in either 2515// *Project.ServerResponse.Header or (if a response was returned at all) 2516// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2517// check whether the returned error was because http.StatusNotModified 2518// was returned. 2519func (c *ProjectsCreateCall) Do(opts ...googleapi.CallOption) (*Project, error) { 2520 gensupport.SetOptions(c.urlParams_, opts...) 2521 res, err := c.doRequest("json") 2522 if res != nil && res.StatusCode == http.StatusNotModified { 2523 if res.Body != nil { 2524 res.Body.Close() 2525 } 2526 return nil, &googleapi.Error{ 2527 Code: res.StatusCode, 2528 Header: res.Header, 2529 } 2530 } 2531 if err != nil { 2532 return nil, err 2533 } 2534 defer googleapi.CloseBody(res) 2535 if err := googleapi.CheckResponse(res); err != nil { 2536 return nil, err 2537 } 2538 ret := &Project{ 2539 ServerResponse: googleapi.ServerResponse{ 2540 Header: res.Header, 2541 HTTPStatusCode: res.StatusCode, 2542 }, 2543 } 2544 target := &ret 2545 if err := gensupport.DecodeResponse(target, res); err != nil { 2546 return nil, err 2547 } 2548 return ret, nil 2549 // { 2550 // "description": "Creates a Project resource.\n\nInitially, the Project resource is owned by its creator exclusively.\nThe creator can later grant permission to others to read or update the\nProject.\n\nSeveral APIs are activated automatically for the Project, including\nGoogle Cloud Storage. The parent is identified by a specified\nResourceId, which must include both an ID and a type, such as\nproject, folder, or organization.\n\nThis method does not associate the new project with a billing account.\nYou can set or update the billing account associated with a project using\nthe [`projects.updateBillingInfo`]\n(/billing/reference/rest/v1/projects/updateBillingInfo) method.", 2551 // "flatPath": "v1beta1/projects", 2552 // "httpMethod": "POST", 2553 // "id": "cloudresourcemanager.projects.create", 2554 // "parameterOrder": [], 2555 // "parameters": { 2556 // "useLegacyStack": { 2557 // "description": "A now unused experiment opt-out option.", 2558 // "location": "query", 2559 // "type": "boolean" 2560 // } 2561 // }, 2562 // "path": "v1beta1/projects", 2563 // "request": { 2564 // "$ref": "Project" 2565 // }, 2566 // "response": { 2567 // "$ref": "Project" 2568 // }, 2569 // "scopes": [ 2570 // "https://www.googleapis.com/auth/cloud-platform" 2571 // ] 2572 // } 2573 2574} 2575 2576// method id "cloudresourcemanager.projects.delete": 2577 2578type ProjectsDeleteCall struct { 2579 s *Service 2580 projectId string 2581 urlParams_ gensupport.URLParams 2582 ctx_ context.Context 2583 header_ http.Header 2584} 2585 2586// Delete: Marks the Project identified by the specified 2587// `project_id` (for example, `my-project-123`) for deletion. 2588// This method will only affect the Project if it has a lifecycle state 2589// of 2590// ACTIVE. 2591// 2592// This method changes the Project's lifecycle state from 2593// ACTIVE 2594// to DELETE_REQUESTED. 2595// The deletion starts at an unspecified time, at which point the 2596// project is 2597// no longer accessible. 2598// 2599// Until the deletion completes, you can check the lifecycle 2600// state 2601// checked by retrieving the Project with GetProject, 2602// and the Project remains visible to ListProjects. 2603// However, you cannot update the project. 2604// 2605// After the deletion completes, the Project is not retrievable by 2606// the GetProject 2607// and ListProjects 2608// methods. 2609// 2610// The caller must have modify permissions for this Project. 2611func (r *ProjectsService) Delete(projectId string) *ProjectsDeleteCall { 2612 c := &ProjectsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2613 c.projectId = projectId 2614 return c 2615} 2616 2617// Fields allows partial responses to be retrieved. See 2618// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2619// for more information. 2620func (c *ProjectsDeleteCall) Fields(s ...googleapi.Field) *ProjectsDeleteCall { 2621 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2622 return c 2623} 2624 2625// Context sets the context to be used in this call's Do method. Any 2626// pending HTTP request will be aborted if the provided context is 2627// canceled. 2628func (c *ProjectsDeleteCall) Context(ctx context.Context) *ProjectsDeleteCall { 2629 c.ctx_ = ctx 2630 return c 2631} 2632 2633// Header returns an http.Header that can be modified by the caller to 2634// add HTTP headers to the request. 2635func (c *ProjectsDeleteCall) Header() http.Header { 2636 if c.header_ == nil { 2637 c.header_ = make(http.Header) 2638 } 2639 return c.header_ 2640} 2641 2642func (c *ProjectsDeleteCall) doRequest(alt string) (*http.Response, error) { 2643 reqHeaders := make(http.Header) 2644 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2645 for k, v := range c.header_ { 2646 reqHeaders[k] = v 2647 } 2648 reqHeaders.Set("User-Agent", c.s.userAgent()) 2649 var body io.Reader = nil 2650 c.urlParams_.Set("alt", alt) 2651 c.urlParams_.Set("prettyPrint", "false") 2652 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}") 2653 urls += "?" + c.urlParams_.Encode() 2654 req, err := http.NewRequest("DELETE", urls, body) 2655 if err != nil { 2656 return nil, err 2657 } 2658 req.Header = reqHeaders 2659 googleapi.Expand(req.URL, map[string]string{ 2660 "projectId": c.projectId, 2661 }) 2662 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2663} 2664 2665// Do executes the "cloudresourcemanager.projects.delete" call. 2666// Exactly one of *Empty or error will be non-nil. Any non-2xx status 2667// code is an error. Response headers are in either 2668// *Empty.ServerResponse.Header or (if a response was returned at all) 2669// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2670// check whether the returned error was because http.StatusNotModified 2671// was returned. 2672func (c *ProjectsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2673 gensupport.SetOptions(c.urlParams_, opts...) 2674 res, err := c.doRequest("json") 2675 if res != nil && res.StatusCode == http.StatusNotModified { 2676 if res.Body != nil { 2677 res.Body.Close() 2678 } 2679 return nil, &googleapi.Error{ 2680 Code: res.StatusCode, 2681 Header: res.Header, 2682 } 2683 } 2684 if err != nil { 2685 return nil, err 2686 } 2687 defer googleapi.CloseBody(res) 2688 if err := googleapi.CheckResponse(res); err != nil { 2689 return nil, err 2690 } 2691 ret := &Empty{ 2692 ServerResponse: googleapi.ServerResponse{ 2693 Header: res.Header, 2694 HTTPStatusCode: res.StatusCode, 2695 }, 2696 } 2697 target := &ret 2698 if err := gensupport.DecodeResponse(target, res); err != nil { 2699 return nil, err 2700 } 2701 return ret, nil 2702 // { 2703 // "description": "Marks the Project identified by the specified\n`project_id` (for example, `my-project-123`) for deletion.\nThis method will only affect the Project if it has a lifecycle state of\nACTIVE.\n\nThis method changes the Project's lifecycle state from\nACTIVE\nto DELETE_REQUESTED.\nThe deletion starts at an unspecified time, at which point the project is\nno longer accessible.\n\nUntil the deletion completes, you can check the lifecycle state\nchecked by retrieving the Project with GetProject,\nand the Project remains visible to ListProjects.\nHowever, you cannot update the project.\n\nAfter the deletion completes, the Project is not retrievable by\nthe GetProject\nand ListProjects\nmethods.\n\nThe caller must have modify permissions for this Project.", 2704 // "flatPath": "v1beta1/projects/{projectId}", 2705 // "httpMethod": "DELETE", 2706 // "id": "cloudresourcemanager.projects.delete", 2707 // "parameterOrder": [ 2708 // "projectId" 2709 // ], 2710 // "parameters": { 2711 // "projectId": { 2712 // "description": "The Project ID (for example, `foo-bar-123`).\n\nRequired.", 2713 // "location": "path", 2714 // "required": true, 2715 // "type": "string" 2716 // } 2717 // }, 2718 // "path": "v1beta1/projects/{projectId}", 2719 // "response": { 2720 // "$ref": "Empty" 2721 // }, 2722 // "scopes": [ 2723 // "https://www.googleapis.com/auth/cloud-platform" 2724 // ] 2725 // } 2726 2727} 2728 2729// method id "cloudresourcemanager.projects.get": 2730 2731type ProjectsGetCall struct { 2732 s *Service 2733 projectId string 2734 urlParams_ gensupport.URLParams 2735 ifNoneMatch_ string 2736 ctx_ context.Context 2737 header_ http.Header 2738} 2739 2740// Get: Retrieves the Project identified by the specified 2741// `project_id` (for example, `my-project-123`). 2742// 2743// The caller must have read permissions for this Project. 2744func (r *ProjectsService) Get(projectId string) *ProjectsGetCall { 2745 c := &ProjectsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2746 c.projectId = projectId 2747 return c 2748} 2749 2750// Fields allows partial responses to be retrieved. See 2751// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2752// for more information. 2753func (c *ProjectsGetCall) Fields(s ...googleapi.Field) *ProjectsGetCall { 2754 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2755 return c 2756} 2757 2758// IfNoneMatch sets the optional parameter which makes the operation 2759// fail if the object's ETag matches the given value. This is useful for 2760// getting updates only after the object has changed since the last 2761// request. Use googleapi.IsNotModified to check whether the response 2762// error from Do is the result of In-None-Match. 2763func (c *ProjectsGetCall) IfNoneMatch(entityTag string) *ProjectsGetCall { 2764 c.ifNoneMatch_ = entityTag 2765 return c 2766} 2767 2768// Context sets the context to be used in this call's Do method. Any 2769// pending HTTP request will be aborted if the provided context is 2770// canceled. 2771func (c *ProjectsGetCall) Context(ctx context.Context) *ProjectsGetCall { 2772 c.ctx_ = ctx 2773 return c 2774} 2775 2776// Header returns an http.Header that can be modified by the caller to 2777// add HTTP headers to the request. 2778func (c *ProjectsGetCall) Header() http.Header { 2779 if c.header_ == nil { 2780 c.header_ = make(http.Header) 2781 } 2782 return c.header_ 2783} 2784 2785func (c *ProjectsGetCall) doRequest(alt string) (*http.Response, error) { 2786 reqHeaders := make(http.Header) 2787 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2788 for k, v := range c.header_ { 2789 reqHeaders[k] = v 2790 } 2791 reqHeaders.Set("User-Agent", c.s.userAgent()) 2792 if c.ifNoneMatch_ != "" { 2793 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2794 } 2795 var body io.Reader = nil 2796 c.urlParams_.Set("alt", alt) 2797 c.urlParams_.Set("prettyPrint", "false") 2798 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}") 2799 urls += "?" + c.urlParams_.Encode() 2800 req, err := http.NewRequest("GET", urls, body) 2801 if err != nil { 2802 return nil, err 2803 } 2804 req.Header = reqHeaders 2805 googleapi.Expand(req.URL, map[string]string{ 2806 "projectId": c.projectId, 2807 }) 2808 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2809} 2810 2811// Do executes the "cloudresourcemanager.projects.get" call. 2812// Exactly one of *Project or error will be non-nil. Any non-2xx status 2813// code is an error. Response headers are in either 2814// *Project.ServerResponse.Header or (if a response was returned at all) 2815// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2816// check whether the returned error was because http.StatusNotModified 2817// was returned. 2818func (c *ProjectsGetCall) Do(opts ...googleapi.CallOption) (*Project, error) { 2819 gensupport.SetOptions(c.urlParams_, opts...) 2820 res, err := c.doRequest("json") 2821 if res != nil && res.StatusCode == http.StatusNotModified { 2822 if res.Body != nil { 2823 res.Body.Close() 2824 } 2825 return nil, &googleapi.Error{ 2826 Code: res.StatusCode, 2827 Header: res.Header, 2828 } 2829 } 2830 if err != nil { 2831 return nil, err 2832 } 2833 defer googleapi.CloseBody(res) 2834 if err := googleapi.CheckResponse(res); err != nil { 2835 return nil, err 2836 } 2837 ret := &Project{ 2838 ServerResponse: googleapi.ServerResponse{ 2839 Header: res.Header, 2840 HTTPStatusCode: res.StatusCode, 2841 }, 2842 } 2843 target := &ret 2844 if err := gensupport.DecodeResponse(target, res); err != nil { 2845 return nil, err 2846 } 2847 return ret, nil 2848 // { 2849 // "description": "Retrieves the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.", 2850 // "flatPath": "v1beta1/projects/{projectId}", 2851 // "httpMethod": "GET", 2852 // "id": "cloudresourcemanager.projects.get", 2853 // "parameterOrder": [ 2854 // "projectId" 2855 // ], 2856 // "parameters": { 2857 // "projectId": { 2858 // "description": "The Project ID (for example, `my-project-123`).\n\nRequired.", 2859 // "location": "path", 2860 // "required": true, 2861 // "type": "string" 2862 // } 2863 // }, 2864 // "path": "v1beta1/projects/{projectId}", 2865 // "response": { 2866 // "$ref": "Project" 2867 // }, 2868 // "scopes": [ 2869 // "https://www.googleapis.com/auth/cloud-platform", 2870 // "https://www.googleapis.com/auth/cloud-platform.read-only" 2871 // ] 2872 // } 2873 2874} 2875 2876// method id "cloudresourcemanager.projects.getAncestry": 2877 2878type ProjectsGetAncestryCall struct { 2879 s *Service 2880 projectId string 2881 getancestryrequest *GetAncestryRequest 2882 urlParams_ gensupport.URLParams 2883 ctx_ context.Context 2884 header_ http.Header 2885} 2886 2887// GetAncestry: Gets a list of ancestors in the resource hierarchy for 2888// the Project 2889// identified by the specified `project_id` (for example, 2890// `my-project-123`). 2891// 2892// The caller must have read permissions for this Project. 2893func (r *ProjectsService) GetAncestry(projectId string, getancestryrequest *GetAncestryRequest) *ProjectsGetAncestryCall { 2894 c := &ProjectsGetAncestryCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2895 c.projectId = projectId 2896 c.getancestryrequest = getancestryrequest 2897 return c 2898} 2899 2900// Fields allows partial responses to be retrieved. See 2901// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2902// for more information. 2903func (c *ProjectsGetAncestryCall) Fields(s ...googleapi.Field) *ProjectsGetAncestryCall { 2904 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2905 return c 2906} 2907 2908// Context sets the context to be used in this call's Do method. Any 2909// pending HTTP request will be aborted if the provided context is 2910// canceled. 2911func (c *ProjectsGetAncestryCall) Context(ctx context.Context) *ProjectsGetAncestryCall { 2912 c.ctx_ = ctx 2913 return c 2914} 2915 2916// Header returns an http.Header that can be modified by the caller to 2917// add HTTP headers to the request. 2918func (c *ProjectsGetAncestryCall) Header() http.Header { 2919 if c.header_ == nil { 2920 c.header_ = make(http.Header) 2921 } 2922 return c.header_ 2923} 2924 2925func (c *ProjectsGetAncestryCall) doRequest(alt string) (*http.Response, error) { 2926 reqHeaders := make(http.Header) 2927 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2928 for k, v := range c.header_ { 2929 reqHeaders[k] = v 2930 } 2931 reqHeaders.Set("User-Agent", c.s.userAgent()) 2932 var body io.Reader = nil 2933 body, err := googleapi.WithoutDataWrapper.JSONReader(c.getancestryrequest) 2934 if err != nil { 2935 return nil, err 2936 } 2937 reqHeaders.Set("Content-Type", "application/json") 2938 c.urlParams_.Set("alt", alt) 2939 c.urlParams_.Set("prettyPrint", "false") 2940 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}:getAncestry") 2941 urls += "?" + c.urlParams_.Encode() 2942 req, err := http.NewRequest("POST", urls, body) 2943 if err != nil { 2944 return nil, err 2945 } 2946 req.Header = reqHeaders 2947 googleapi.Expand(req.URL, map[string]string{ 2948 "projectId": c.projectId, 2949 }) 2950 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2951} 2952 2953// Do executes the "cloudresourcemanager.projects.getAncestry" call. 2954// Exactly one of *GetAncestryResponse or error will be non-nil. Any 2955// non-2xx status code is an error. Response headers are in either 2956// *GetAncestryResponse.ServerResponse.Header or (if a response was 2957// returned at all) in error.(*googleapi.Error).Header. Use 2958// googleapi.IsNotModified to check whether the returned error was 2959// because http.StatusNotModified was returned. 2960func (c *ProjectsGetAncestryCall) Do(opts ...googleapi.CallOption) (*GetAncestryResponse, error) { 2961 gensupport.SetOptions(c.urlParams_, opts...) 2962 res, err := c.doRequest("json") 2963 if res != nil && res.StatusCode == http.StatusNotModified { 2964 if res.Body != nil { 2965 res.Body.Close() 2966 } 2967 return nil, &googleapi.Error{ 2968 Code: res.StatusCode, 2969 Header: res.Header, 2970 } 2971 } 2972 if err != nil { 2973 return nil, err 2974 } 2975 defer googleapi.CloseBody(res) 2976 if err := googleapi.CheckResponse(res); err != nil { 2977 return nil, err 2978 } 2979 ret := &GetAncestryResponse{ 2980 ServerResponse: googleapi.ServerResponse{ 2981 Header: res.Header, 2982 HTTPStatusCode: res.StatusCode, 2983 }, 2984 } 2985 target := &ret 2986 if err := gensupport.DecodeResponse(target, res); err != nil { 2987 return nil, err 2988 } 2989 return ret, nil 2990 // { 2991 // "description": "Gets a list of ancestors in the resource hierarchy for the Project\nidentified by the specified `project_id` (for example, `my-project-123`).\n\nThe caller must have read permissions for this Project.", 2992 // "flatPath": "v1beta1/projects/{projectId}:getAncestry", 2993 // "httpMethod": "POST", 2994 // "id": "cloudresourcemanager.projects.getAncestry", 2995 // "parameterOrder": [ 2996 // "projectId" 2997 // ], 2998 // "parameters": { 2999 // "projectId": { 3000 // "description": "The Project ID (for example, `my-project-123`).\n\nRequired.", 3001 // "location": "path", 3002 // "required": true, 3003 // "type": "string" 3004 // } 3005 // }, 3006 // "path": "v1beta1/projects/{projectId}:getAncestry", 3007 // "request": { 3008 // "$ref": "GetAncestryRequest" 3009 // }, 3010 // "response": { 3011 // "$ref": "GetAncestryResponse" 3012 // }, 3013 // "scopes": [ 3014 // "https://www.googleapis.com/auth/cloud-platform", 3015 // "https://www.googleapis.com/auth/cloud-platform.read-only" 3016 // ] 3017 // } 3018 3019} 3020 3021// method id "cloudresourcemanager.projects.getIamPolicy": 3022 3023type ProjectsGetIamPolicyCall struct { 3024 s *Service 3025 resource string 3026 getiampolicyrequest *GetIamPolicyRequest 3027 urlParams_ gensupport.URLParams 3028 ctx_ context.Context 3029 header_ http.Header 3030} 3031 3032// GetIamPolicy: Returns the IAM access control policy for the specified 3033// Project. 3034// Permission is denied if the policy or the resource does not 3035// exist. 3036// 3037// For additional information about resource structure and 3038// identification, 3039// see [Resource Names](/apis/design/resource_names). 3040func (r *ProjectsService) GetIamPolicy(resource string, getiampolicyrequest *GetIamPolicyRequest) *ProjectsGetIamPolicyCall { 3041 c := &ProjectsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3042 c.resource = resource 3043 c.getiampolicyrequest = getiampolicyrequest 3044 return c 3045} 3046 3047// Fields allows partial responses to be retrieved. See 3048// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3049// for more information. 3050func (c *ProjectsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsGetIamPolicyCall { 3051 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3052 return c 3053} 3054 3055// Context sets the context to be used in this call's Do method. Any 3056// pending HTTP request will be aborted if the provided context is 3057// canceled. 3058func (c *ProjectsGetIamPolicyCall) Context(ctx context.Context) *ProjectsGetIamPolicyCall { 3059 c.ctx_ = ctx 3060 return c 3061} 3062 3063// Header returns an http.Header that can be modified by the caller to 3064// add HTTP headers to the request. 3065func (c *ProjectsGetIamPolicyCall) Header() http.Header { 3066 if c.header_ == nil { 3067 c.header_ = make(http.Header) 3068 } 3069 return c.header_ 3070} 3071 3072func (c *ProjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 3073 reqHeaders := make(http.Header) 3074 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3075 for k, v := range c.header_ { 3076 reqHeaders[k] = v 3077 } 3078 reqHeaders.Set("User-Agent", c.s.userAgent()) 3079 var body io.Reader = nil 3080 body, err := googleapi.WithoutDataWrapper.JSONReader(c.getiampolicyrequest) 3081 if err != nil { 3082 return nil, err 3083 } 3084 reqHeaders.Set("Content-Type", "application/json") 3085 c.urlParams_.Set("alt", alt) 3086 c.urlParams_.Set("prettyPrint", "false") 3087 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{resource}:getIamPolicy") 3088 urls += "?" + c.urlParams_.Encode() 3089 req, err := http.NewRequest("POST", urls, body) 3090 if err != nil { 3091 return nil, err 3092 } 3093 req.Header = reqHeaders 3094 googleapi.Expand(req.URL, map[string]string{ 3095 "resource": c.resource, 3096 }) 3097 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3098} 3099 3100// Do executes the "cloudresourcemanager.projects.getIamPolicy" call. 3101// Exactly one of *Policy or error will be non-nil. Any non-2xx status 3102// code is an error. Response headers are in either 3103// *Policy.ServerResponse.Header or (if a response was returned at all) 3104// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3105// check whether the returned error was because http.StatusNotModified 3106// was returned. 3107func (c *ProjectsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 3108 gensupport.SetOptions(c.urlParams_, opts...) 3109 res, err := c.doRequest("json") 3110 if res != nil && res.StatusCode == http.StatusNotModified { 3111 if res.Body != nil { 3112 res.Body.Close() 3113 } 3114 return nil, &googleapi.Error{ 3115 Code: res.StatusCode, 3116 Header: res.Header, 3117 } 3118 } 3119 if err != nil { 3120 return nil, err 3121 } 3122 defer googleapi.CloseBody(res) 3123 if err := googleapi.CheckResponse(res); err != nil { 3124 return nil, err 3125 } 3126 ret := &Policy{ 3127 ServerResponse: googleapi.ServerResponse{ 3128 Header: res.Header, 3129 HTTPStatusCode: res.StatusCode, 3130 }, 3131 } 3132 target := &ret 3133 if err := gensupport.DecodeResponse(target, res); err != nil { 3134 return nil, err 3135 } 3136 return ret, nil 3137 // { 3138 // "description": "Returns the IAM access control policy for the specified Project.\nPermission is denied if the policy or the resource does not exist.\n\nFor additional information about resource structure and identification,\nsee [Resource Names](/apis/design/resource_names).", 3139 // "flatPath": "v1beta1/projects/{resource}:getIamPolicy", 3140 // "httpMethod": "POST", 3141 // "id": "cloudresourcemanager.projects.getIamPolicy", 3142 // "parameterOrder": [ 3143 // "resource" 3144 // ], 3145 // "parameters": { 3146 // "resource": { 3147 // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.", 3148 // "location": "path", 3149 // "required": true, 3150 // "type": "string" 3151 // } 3152 // }, 3153 // "path": "v1beta1/projects/{resource}:getIamPolicy", 3154 // "request": { 3155 // "$ref": "GetIamPolicyRequest" 3156 // }, 3157 // "response": { 3158 // "$ref": "Policy" 3159 // }, 3160 // "scopes": [ 3161 // "https://www.googleapis.com/auth/cloud-platform", 3162 // "https://www.googleapis.com/auth/cloud-platform.read-only" 3163 // ] 3164 // } 3165 3166} 3167 3168// method id "cloudresourcemanager.projects.list": 3169 3170type ProjectsListCall struct { 3171 s *Service 3172 urlParams_ gensupport.URLParams 3173 ifNoneMatch_ string 3174 ctx_ context.Context 3175 header_ http.Header 3176} 3177 3178// List: Lists Projects that the caller has the 3179// `resourcemanager.projects.get` 3180// permission on and satisfy the specified filter. 3181// 3182// This method returns Projects in an unspecified order. 3183// This method is eventually consistent with project mutations; this 3184// means 3185// that a newly created project may not appear in the results or 3186// recent 3187// updates to an existing project may not be reflected in the results. 3188// To 3189// retrieve the latest state of a project, use the 3190// GetProject method. 3191// 3192// NOTE: If the request filter contains a `parent.type` and `parent.id` 3193// and 3194// the caller has the `resourcemanager.projects.list` permission on 3195// the 3196// parent, the results will be drawn from an alternate index which 3197// provides 3198// more consistent results. In future versions of this API, this List 3199// method 3200// will be split into List and Search to properly capture the 3201// behavorial 3202// difference. 3203func (r *ProjectsService) List() *ProjectsListCall { 3204 c := &ProjectsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3205 return c 3206} 3207 3208// Filter sets the optional parameter "filter": An expression for 3209// filtering the results of the request. Filter rules are 3210// case insensitive. The fields eligible for filtering are: 3211// 3212// + `name` 3213// + `id` 3214// + `labels.<key>` (where *key* is the name of a label) 3215// + `parent.type` 3216// + `parent.id` 3217// 3218// Some examples of using labels as filters: 3219// 3220// | Filter | Description 3221// 3222// | 3223// |------------------|------------------------------------------------ 3224// -----| 3225// | name:how* | The project's name starts with "how". 3226// | 3227// | name:Howl | The project's name is `Howl` or `howl`. 3228// | 3229// | name:HOWL | Equivalent to above. 3230// | 3231// | NAME:howl | Equivalent to above. 3232// | 3233// | labels.color:* | The project has the label `color`. 3234// | 3235// | labels.color:red | The project's label `color` has the value `red`. 3236// | 3237// | labels.color:red labels.size:big |The project's label `color` 3238// has 3239// the value `red` and its label `size` has the value `big`. 3240// | 3241// 3242// If no filter is specified, the call will return projects for which 3243// the user 3244// has the `resourcemanager.projects.get` permission. 3245// 3246// NOTE: To perform a by-parent query (eg., what projects are directly 3247// in a 3248// Folder), the caller must have the 3249// `resourcemanager.projects.list` 3250// permission on the parent and the filter must contain both a 3251// `parent.type` 3252// and a `parent.id` restriction 3253// (example: "parent.type:folder parent.id:123"). In this case an 3254// alternate 3255// search index is used which provides more consistent results. 3256func (c *ProjectsListCall) Filter(filter string) *ProjectsListCall { 3257 c.urlParams_.Set("filter", filter) 3258 return c 3259} 3260 3261// PageSize sets the optional parameter "pageSize": The maximum number 3262// of Projects to return in the response. 3263// The server can return fewer Projects than requested. 3264// If unspecified, server picks an appropriate default. 3265func (c *ProjectsListCall) PageSize(pageSize int64) *ProjectsListCall { 3266 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3267 return c 3268} 3269 3270// PageToken sets the optional parameter "pageToken": A pagination token 3271// returned from a previous call to ListProjects 3272// that indicates from where listing should continue. 3273func (c *ProjectsListCall) PageToken(pageToken string) *ProjectsListCall { 3274 c.urlParams_.Set("pageToken", pageToken) 3275 return c 3276} 3277 3278// Fields allows partial responses to be retrieved. See 3279// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3280// for more information. 3281func (c *ProjectsListCall) Fields(s ...googleapi.Field) *ProjectsListCall { 3282 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3283 return c 3284} 3285 3286// IfNoneMatch sets the optional parameter which makes the operation 3287// fail if the object's ETag matches the given value. This is useful for 3288// getting updates only after the object has changed since the last 3289// request. Use googleapi.IsNotModified to check whether the response 3290// error from Do is the result of In-None-Match. 3291func (c *ProjectsListCall) IfNoneMatch(entityTag string) *ProjectsListCall { 3292 c.ifNoneMatch_ = entityTag 3293 return c 3294} 3295 3296// Context sets the context to be used in this call's Do method. Any 3297// pending HTTP request will be aborted if the provided context is 3298// canceled. 3299func (c *ProjectsListCall) Context(ctx context.Context) *ProjectsListCall { 3300 c.ctx_ = ctx 3301 return c 3302} 3303 3304// Header returns an http.Header that can be modified by the caller to 3305// add HTTP headers to the request. 3306func (c *ProjectsListCall) Header() http.Header { 3307 if c.header_ == nil { 3308 c.header_ = make(http.Header) 3309 } 3310 return c.header_ 3311} 3312 3313func (c *ProjectsListCall) doRequest(alt string) (*http.Response, error) { 3314 reqHeaders := make(http.Header) 3315 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3316 for k, v := range c.header_ { 3317 reqHeaders[k] = v 3318 } 3319 reqHeaders.Set("User-Agent", c.s.userAgent()) 3320 if c.ifNoneMatch_ != "" { 3321 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3322 } 3323 var body io.Reader = nil 3324 c.urlParams_.Set("alt", alt) 3325 c.urlParams_.Set("prettyPrint", "false") 3326 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects") 3327 urls += "?" + c.urlParams_.Encode() 3328 req, err := http.NewRequest("GET", urls, body) 3329 if err != nil { 3330 return nil, err 3331 } 3332 req.Header = reqHeaders 3333 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3334} 3335 3336// Do executes the "cloudresourcemanager.projects.list" call. 3337// Exactly one of *ListProjectsResponse or error will be non-nil. Any 3338// non-2xx status code is an error. Response headers are in either 3339// *ListProjectsResponse.ServerResponse.Header or (if a response was 3340// returned at all) in error.(*googleapi.Error).Header. Use 3341// googleapi.IsNotModified to check whether the returned error was 3342// because http.StatusNotModified was returned. 3343func (c *ProjectsListCall) Do(opts ...googleapi.CallOption) (*ListProjectsResponse, error) { 3344 gensupport.SetOptions(c.urlParams_, opts...) 3345 res, err := c.doRequest("json") 3346 if res != nil && res.StatusCode == http.StatusNotModified { 3347 if res.Body != nil { 3348 res.Body.Close() 3349 } 3350 return nil, &googleapi.Error{ 3351 Code: res.StatusCode, 3352 Header: res.Header, 3353 } 3354 } 3355 if err != nil { 3356 return nil, err 3357 } 3358 defer googleapi.CloseBody(res) 3359 if err := googleapi.CheckResponse(res); err != nil { 3360 return nil, err 3361 } 3362 ret := &ListProjectsResponse{ 3363 ServerResponse: googleapi.ServerResponse{ 3364 Header: res.Header, 3365 HTTPStatusCode: res.StatusCode, 3366 }, 3367 } 3368 target := &ret 3369 if err := gensupport.DecodeResponse(target, res); err != nil { 3370 return nil, err 3371 } 3372 return ret, nil 3373 // { 3374 // "description": "Lists Projects that the caller has the `resourcemanager.projects.get`\npermission on and satisfy the specified filter.\n\nThis method returns Projects in an unspecified order.\nThis method is eventually consistent with project mutations; this means\nthat a newly created project may not appear in the results or recent\nupdates to an existing project may not be reflected in the results. To\nretrieve the latest state of a project, use the\nGetProject method.\n\nNOTE: If the request filter contains a `parent.type` and `parent.id` and\nthe caller has the `resourcemanager.projects.list` permission on the\nparent, the results will be drawn from an alternate index which provides\nmore consistent results. In future versions of this API, this List method\nwill be split into List and Search to properly capture the behavorial\ndifference.", 3375 // "flatPath": "v1beta1/projects", 3376 // "httpMethod": "GET", 3377 // "id": "cloudresourcemanager.projects.list", 3378 // "parameterOrder": [], 3379 // "parameters": { 3380 // "filter": { 3381 // "description": "An expression for filtering the results of the request. Filter rules are\ncase insensitive. The fields eligible for filtering are:\n\n+ `name`\n+ `id`\n+ `labels.\u003ckey\u003e` (where *key* is the name of a label)\n+ `parent.type`\n+ `parent.id`\n\nSome examples of using labels as filters:\n\n| Filter | Description |\n|------------------|-----------------------------------------------------|\n| name:how* | The project's name starts with \"how\". |\n| name:Howl | The project's name is `Howl` or `howl`. |\n| name:HOWL | Equivalent to above. |\n| NAME:howl | Equivalent to above. |\n| labels.color:* | The project has the label `color`. |\n| labels.color:red | The project's label `color` has the value `red`. |\n| labels.color:red\u0026nbsp;labels.size:big |The project's label `color` has\n the value `red` and its label `size` has the value `big`. |\n\nIf no filter is specified, the call will return projects for which the user\nhas the `resourcemanager.projects.get` permission.\n\nNOTE: To perform a by-parent query (eg., what projects are directly in a\nFolder), the caller must have the `resourcemanager.projects.list`\npermission on the parent and the filter must contain both a `parent.type`\nand a `parent.id` restriction\n(example: \"parent.type:folder parent.id:123\"). In this case an alternate\nsearch index is used which provides more consistent results.\n\nOptional.", 3382 // "location": "query", 3383 // "type": "string" 3384 // }, 3385 // "pageSize": { 3386 // "description": "The maximum number of Projects to return in the response.\nThe server can return fewer Projects than requested.\nIf unspecified, server picks an appropriate default.\n\nOptional.", 3387 // "format": "int32", 3388 // "location": "query", 3389 // "type": "integer" 3390 // }, 3391 // "pageToken": { 3392 // "description": "A pagination token returned from a previous call to ListProjects\nthat indicates from where listing should continue.\n\nOptional.", 3393 // "location": "query", 3394 // "type": "string" 3395 // } 3396 // }, 3397 // "path": "v1beta1/projects", 3398 // "response": { 3399 // "$ref": "ListProjectsResponse" 3400 // }, 3401 // "scopes": [ 3402 // "https://www.googleapis.com/auth/cloud-platform", 3403 // "https://www.googleapis.com/auth/cloud-platform.read-only" 3404 // ] 3405 // } 3406 3407} 3408 3409// Pages invokes f for each page of results. 3410// A non-nil error returned from f will halt the iteration. 3411// The provided context supersedes any context provided to the Context method. 3412func (c *ProjectsListCall) Pages(ctx context.Context, f func(*ListProjectsResponse) error) error { 3413 c.ctx_ = ctx 3414 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3415 for { 3416 x, err := c.Do() 3417 if err != nil { 3418 return err 3419 } 3420 if err := f(x); err != nil { 3421 return err 3422 } 3423 if x.NextPageToken == "" { 3424 return nil 3425 } 3426 c.PageToken(x.NextPageToken) 3427 } 3428} 3429 3430// method id "cloudresourcemanager.projects.setIamPolicy": 3431 3432type ProjectsSetIamPolicyCall struct { 3433 s *Service 3434 resource string 3435 setiampolicyrequest *SetIamPolicyRequest 3436 urlParams_ gensupport.URLParams 3437 ctx_ context.Context 3438 header_ http.Header 3439} 3440 3441// SetIamPolicy: Sets the IAM access control policy for the specified 3442// Project. Overwrites 3443// any existing policy. 3444// 3445// The following constraints apply when using `setIamPolicy()`: 3446// 3447// + Project does not support `allUsers` and `allAuthenticatedUsers` 3448// as 3449// `members` in a `Binding` of a `Policy`. 3450// 3451// + The owner role can be granted to a `user`, `serviceAccount`, or a 3452// group 3453// that is part of an organization. For 3454// example, 3455// group@myownpersonaldomain.com could be added as an owner to a project 3456// in 3457// the myownpersonaldomain.com organization, but not the 3458// examplepetstore.com 3459// organization. 3460// 3461// + Service accounts can be made owners of a project directly 3462// without any restrictions. However, to be added as an owner, a user 3463// must be 3464// invited via Cloud Platform console and must accept the invitation. 3465// 3466// + A user cannot be granted the owner role using `setIamPolicy()`. The 3467// user 3468// must be granted the owner role using the Cloud Platform Console and 3469// must 3470// explicitly accept the invitation. 3471// 3472// + Invitations to grant the owner role cannot be sent 3473// using 3474// `setIamPolicy()`; they must be sent only using the Cloud Platform 3475// Console. 3476// 3477// + Membership changes that leave the project without any owners that 3478// have 3479// accepted the Terms of Service (ToS) will be rejected. 3480// 3481// + If the project is not part of an organization, there must be at 3482// least 3483// one owner who has accepted the Terms of Service (ToS) agreement in 3484// the 3485// policy. Calling `setIamPolicy()` to remove the last ToS-accepted 3486// owner 3487// from the policy will fail. This restriction also applies to 3488// legacy 3489// projects that no longer have owners who have accepted the ToS. Edits 3490// to 3491// IAM policies will be rejected until the lack of a ToS-accepting owner 3492// is 3493// rectified. 3494// 3495// + This method will replace the existing policy, and cannot be used 3496// to 3497// append additional IAM settings. 3498// 3499// Note: Removing service accounts from policies or changing their 3500// roles 3501// can render services completely inoperable. It is important to 3502// understand 3503// how the service account is being used before removing or updating 3504// its 3505// roles. 3506func (r *ProjectsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSetIamPolicyCall { 3507 c := &ProjectsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3508 c.resource = resource 3509 c.setiampolicyrequest = setiampolicyrequest 3510 return c 3511} 3512 3513// Fields allows partial responses to be retrieved. See 3514// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3515// for more information. 3516func (c *ProjectsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSetIamPolicyCall { 3517 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3518 return c 3519} 3520 3521// Context sets the context to be used in this call's Do method. Any 3522// pending HTTP request will be aborted if the provided context is 3523// canceled. 3524func (c *ProjectsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSetIamPolicyCall { 3525 c.ctx_ = ctx 3526 return c 3527} 3528 3529// Header returns an http.Header that can be modified by the caller to 3530// add HTTP headers to the request. 3531func (c *ProjectsSetIamPolicyCall) Header() http.Header { 3532 if c.header_ == nil { 3533 c.header_ = make(http.Header) 3534 } 3535 return c.header_ 3536} 3537 3538func (c *ProjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 3539 reqHeaders := make(http.Header) 3540 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3541 for k, v := range c.header_ { 3542 reqHeaders[k] = v 3543 } 3544 reqHeaders.Set("User-Agent", c.s.userAgent()) 3545 var body io.Reader = nil 3546 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 3547 if err != nil { 3548 return nil, err 3549 } 3550 reqHeaders.Set("Content-Type", "application/json") 3551 c.urlParams_.Set("alt", alt) 3552 c.urlParams_.Set("prettyPrint", "false") 3553 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{resource}:setIamPolicy") 3554 urls += "?" + c.urlParams_.Encode() 3555 req, err := http.NewRequest("POST", urls, body) 3556 if err != nil { 3557 return nil, err 3558 } 3559 req.Header = reqHeaders 3560 googleapi.Expand(req.URL, map[string]string{ 3561 "resource": c.resource, 3562 }) 3563 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3564} 3565 3566// Do executes the "cloudresourcemanager.projects.setIamPolicy" call. 3567// Exactly one of *Policy or error will be non-nil. Any non-2xx status 3568// code is an error. Response headers are in either 3569// *Policy.ServerResponse.Header or (if a response was returned at all) 3570// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3571// check whether the returned error was because http.StatusNotModified 3572// was returned. 3573func (c *ProjectsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 3574 gensupport.SetOptions(c.urlParams_, opts...) 3575 res, err := c.doRequest("json") 3576 if res != nil && res.StatusCode == http.StatusNotModified { 3577 if res.Body != nil { 3578 res.Body.Close() 3579 } 3580 return nil, &googleapi.Error{ 3581 Code: res.StatusCode, 3582 Header: res.Header, 3583 } 3584 } 3585 if err != nil { 3586 return nil, err 3587 } 3588 defer googleapi.CloseBody(res) 3589 if err := googleapi.CheckResponse(res); err != nil { 3590 return nil, err 3591 } 3592 ret := &Policy{ 3593 ServerResponse: googleapi.ServerResponse{ 3594 Header: res.Header, 3595 HTTPStatusCode: res.StatusCode, 3596 }, 3597 } 3598 target := &ret 3599 if err := gensupport.DecodeResponse(target, res); err != nil { 3600 return nil, err 3601 } 3602 return ret, nil 3603 // { 3604 // "description": "Sets the IAM access control policy for the specified Project. Overwrites\nany existing policy.\n\nThe following constraints apply when using `setIamPolicy()`:\n\n+ Project does not support `allUsers` and `allAuthenticatedUsers` as\n`members` in a `Binding` of a `Policy`.\n\n+ The owner role can be granted to a `user`, `serviceAccount`, or a group\nthat is part of an organization. For example,\ngroup@myownpersonaldomain.com could be added as an owner to a project in\nthe myownpersonaldomain.com organization, but not the examplepetstore.com\norganization.\n\n+ Service accounts can be made owners of a project directly\nwithout any restrictions. However, to be added as an owner, a user must be\ninvited via Cloud Platform console and must accept the invitation.\n\n+ A user cannot be granted the owner role using `setIamPolicy()`. The user\nmust be granted the owner role using the Cloud Platform Console and must\nexplicitly accept the invitation.\n\n+ Invitations to grant the owner role cannot be sent using\n`setIamPolicy()`; they must be sent only using the Cloud Platform Console.\n\n+ Membership changes that leave the project without any owners that have\naccepted the Terms of Service (ToS) will be rejected.\n\n+ If the project is not part of an organization, there must be at least\none owner who has accepted the Terms of Service (ToS) agreement in the\npolicy. Calling `setIamPolicy()` to remove the last ToS-accepted owner\nfrom the policy will fail. This restriction also applies to legacy\nprojects that no longer have owners who have accepted the ToS. Edits to\nIAM policies will be rejected until the lack of a ToS-accepting owner is\nrectified.\n\n+ This method will replace the existing policy, and cannot be used to\nappend additional IAM settings.\n\nNote: Removing service accounts from policies or changing their roles\ncan render services completely inoperable. It is important to understand\nhow the service account is being used before removing or updating its\nroles.", 3605 // "flatPath": "v1beta1/projects/{resource}:setIamPolicy", 3606 // "httpMethod": "POST", 3607 // "id": "cloudresourcemanager.projects.setIamPolicy", 3608 // "parameterOrder": [ 3609 // "resource" 3610 // ], 3611 // "parameters": { 3612 // "resource": { 3613 // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.", 3614 // "location": "path", 3615 // "required": true, 3616 // "type": "string" 3617 // } 3618 // }, 3619 // "path": "v1beta1/projects/{resource}:setIamPolicy", 3620 // "request": { 3621 // "$ref": "SetIamPolicyRequest" 3622 // }, 3623 // "response": { 3624 // "$ref": "Policy" 3625 // }, 3626 // "scopes": [ 3627 // "https://www.googleapis.com/auth/cloud-platform" 3628 // ] 3629 // } 3630 3631} 3632 3633// method id "cloudresourcemanager.projects.testIamPermissions": 3634 3635type ProjectsTestIamPermissionsCall struct { 3636 s *Service 3637 resource string 3638 testiampermissionsrequest *TestIamPermissionsRequest 3639 urlParams_ gensupport.URLParams 3640 ctx_ context.Context 3641 header_ http.Header 3642} 3643 3644// TestIamPermissions: Returns permissions that a caller has on the 3645// specified Project. 3646func (r *ProjectsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTestIamPermissionsCall { 3647 c := &ProjectsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3648 c.resource = resource 3649 c.testiampermissionsrequest = testiampermissionsrequest 3650 return c 3651} 3652 3653// Fields allows partial responses to be retrieved. See 3654// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3655// for more information. 3656func (c *ProjectsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTestIamPermissionsCall { 3657 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3658 return c 3659} 3660 3661// Context sets the context to be used in this call's Do method. Any 3662// pending HTTP request will be aborted if the provided context is 3663// canceled. 3664func (c *ProjectsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTestIamPermissionsCall { 3665 c.ctx_ = ctx 3666 return c 3667} 3668 3669// Header returns an http.Header that can be modified by the caller to 3670// add HTTP headers to the request. 3671func (c *ProjectsTestIamPermissionsCall) Header() http.Header { 3672 if c.header_ == nil { 3673 c.header_ = make(http.Header) 3674 } 3675 return c.header_ 3676} 3677 3678func (c *ProjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 3679 reqHeaders := make(http.Header) 3680 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3681 for k, v := range c.header_ { 3682 reqHeaders[k] = v 3683 } 3684 reqHeaders.Set("User-Agent", c.s.userAgent()) 3685 var body io.Reader = nil 3686 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 3687 if err != nil { 3688 return nil, err 3689 } 3690 reqHeaders.Set("Content-Type", "application/json") 3691 c.urlParams_.Set("alt", alt) 3692 c.urlParams_.Set("prettyPrint", "false") 3693 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{resource}:testIamPermissions") 3694 urls += "?" + c.urlParams_.Encode() 3695 req, err := http.NewRequest("POST", urls, body) 3696 if err != nil { 3697 return nil, err 3698 } 3699 req.Header = reqHeaders 3700 googleapi.Expand(req.URL, map[string]string{ 3701 "resource": c.resource, 3702 }) 3703 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3704} 3705 3706// Do executes the "cloudresourcemanager.projects.testIamPermissions" call. 3707// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 3708// Any non-2xx status code is an error. Response headers are in either 3709// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 3710// was returned at all) in error.(*googleapi.Error).Header. Use 3711// googleapi.IsNotModified to check whether the returned error was 3712// because http.StatusNotModified was returned. 3713func (c *ProjectsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 3714 gensupport.SetOptions(c.urlParams_, opts...) 3715 res, err := c.doRequest("json") 3716 if res != nil && res.StatusCode == http.StatusNotModified { 3717 if res.Body != nil { 3718 res.Body.Close() 3719 } 3720 return nil, &googleapi.Error{ 3721 Code: res.StatusCode, 3722 Header: res.Header, 3723 } 3724 } 3725 if err != nil { 3726 return nil, err 3727 } 3728 defer googleapi.CloseBody(res) 3729 if err := googleapi.CheckResponse(res); err != nil { 3730 return nil, err 3731 } 3732 ret := &TestIamPermissionsResponse{ 3733 ServerResponse: googleapi.ServerResponse{ 3734 Header: res.Header, 3735 HTTPStatusCode: res.StatusCode, 3736 }, 3737 } 3738 target := &ret 3739 if err := gensupport.DecodeResponse(target, res); err != nil { 3740 return nil, err 3741 } 3742 return ret, nil 3743 // { 3744 // "description": "Returns permissions that a caller has on the specified Project.", 3745 // "flatPath": "v1beta1/projects/{resource}:testIamPermissions", 3746 // "httpMethod": "POST", 3747 // "id": "cloudresourcemanager.projects.testIamPermissions", 3748 // "parameterOrder": [ 3749 // "resource" 3750 // ], 3751 // "parameters": { 3752 // "resource": { 3753 // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.", 3754 // "location": "path", 3755 // "required": true, 3756 // "type": "string" 3757 // } 3758 // }, 3759 // "path": "v1beta1/projects/{resource}:testIamPermissions", 3760 // "request": { 3761 // "$ref": "TestIamPermissionsRequest" 3762 // }, 3763 // "response": { 3764 // "$ref": "TestIamPermissionsResponse" 3765 // }, 3766 // "scopes": [ 3767 // "https://www.googleapis.com/auth/cloud-platform", 3768 // "https://www.googleapis.com/auth/cloud-platform.read-only" 3769 // ] 3770 // } 3771 3772} 3773 3774// method id "cloudresourcemanager.projects.undelete": 3775 3776type ProjectsUndeleteCall struct { 3777 s *Service 3778 projectId string 3779 undeleteprojectrequest *UndeleteProjectRequest 3780 urlParams_ gensupport.URLParams 3781 ctx_ context.Context 3782 header_ http.Header 3783} 3784 3785// Undelete: Restores the Project identified by the 3786// specified 3787// `project_id` (for example, `my-project-123`). 3788// You can only use this method for a Project that has a lifecycle state 3789// of 3790// DELETE_REQUESTED. 3791// After deletion starts, the Project cannot be restored. 3792// 3793// The caller must have modify permissions for this Project. 3794func (r *ProjectsService) Undelete(projectId string, undeleteprojectrequest *UndeleteProjectRequest) *ProjectsUndeleteCall { 3795 c := &ProjectsUndeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3796 c.projectId = projectId 3797 c.undeleteprojectrequest = undeleteprojectrequest 3798 return c 3799} 3800 3801// Fields allows partial responses to be retrieved. See 3802// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3803// for more information. 3804func (c *ProjectsUndeleteCall) Fields(s ...googleapi.Field) *ProjectsUndeleteCall { 3805 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3806 return c 3807} 3808 3809// Context sets the context to be used in this call's Do method. Any 3810// pending HTTP request will be aborted if the provided context is 3811// canceled. 3812func (c *ProjectsUndeleteCall) Context(ctx context.Context) *ProjectsUndeleteCall { 3813 c.ctx_ = ctx 3814 return c 3815} 3816 3817// Header returns an http.Header that can be modified by the caller to 3818// add HTTP headers to the request. 3819func (c *ProjectsUndeleteCall) Header() http.Header { 3820 if c.header_ == nil { 3821 c.header_ = make(http.Header) 3822 } 3823 return c.header_ 3824} 3825 3826func (c *ProjectsUndeleteCall) doRequest(alt string) (*http.Response, error) { 3827 reqHeaders := make(http.Header) 3828 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3829 for k, v := range c.header_ { 3830 reqHeaders[k] = v 3831 } 3832 reqHeaders.Set("User-Agent", c.s.userAgent()) 3833 var body io.Reader = nil 3834 body, err := googleapi.WithoutDataWrapper.JSONReader(c.undeleteprojectrequest) 3835 if err != nil { 3836 return nil, err 3837 } 3838 reqHeaders.Set("Content-Type", "application/json") 3839 c.urlParams_.Set("alt", alt) 3840 c.urlParams_.Set("prettyPrint", "false") 3841 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}:undelete") 3842 urls += "?" + c.urlParams_.Encode() 3843 req, err := http.NewRequest("POST", urls, body) 3844 if err != nil { 3845 return nil, err 3846 } 3847 req.Header = reqHeaders 3848 googleapi.Expand(req.URL, map[string]string{ 3849 "projectId": c.projectId, 3850 }) 3851 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3852} 3853 3854// Do executes the "cloudresourcemanager.projects.undelete" call. 3855// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3856// code is an error. Response headers are in either 3857// *Empty.ServerResponse.Header or (if a response was returned at all) 3858// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3859// check whether the returned error was because http.StatusNotModified 3860// was returned. 3861func (c *ProjectsUndeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3862 gensupport.SetOptions(c.urlParams_, opts...) 3863 res, err := c.doRequest("json") 3864 if res != nil && res.StatusCode == http.StatusNotModified { 3865 if res.Body != nil { 3866 res.Body.Close() 3867 } 3868 return nil, &googleapi.Error{ 3869 Code: res.StatusCode, 3870 Header: res.Header, 3871 } 3872 } 3873 if err != nil { 3874 return nil, err 3875 } 3876 defer googleapi.CloseBody(res) 3877 if err := googleapi.CheckResponse(res); err != nil { 3878 return nil, err 3879 } 3880 ret := &Empty{ 3881 ServerResponse: googleapi.ServerResponse{ 3882 Header: res.Header, 3883 HTTPStatusCode: res.StatusCode, 3884 }, 3885 } 3886 target := &ret 3887 if err := gensupport.DecodeResponse(target, res); err != nil { 3888 return nil, err 3889 } 3890 return ret, nil 3891 // { 3892 // "description": "Restores the Project identified by the specified\n`project_id` (for example, `my-project-123`).\nYou can only use this method for a Project that has a lifecycle state of\nDELETE_REQUESTED.\nAfter deletion starts, the Project cannot be restored.\n\nThe caller must have modify permissions for this Project.", 3893 // "flatPath": "v1beta1/projects/{projectId}:undelete", 3894 // "httpMethod": "POST", 3895 // "id": "cloudresourcemanager.projects.undelete", 3896 // "parameterOrder": [ 3897 // "projectId" 3898 // ], 3899 // "parameters": { 3900 // "projectId": { 3901 // "description": "The project ID (for example, `foo-bar-123`).\n\nRequired.", 3902 // "location": "path", 3903 // "required": true, 3904 // "type": "string" 3905 // } 3906 // }, 3907 // "path": "v1beta1/projects/{projectId}:undelete", 3908 // "request": { 3909 // "$ref": "UndeleteProjectRequest" 3910 // }, 3911 // "response": { 3912 // "$ref": "Empty" 3913 // }, 3914 // "scopes": [ 3915 // "https://www.googleapis.com/auth/cloud-platform" 3916 // ] 3917 // } 3918 3919} 3920 3921// method id "cloudresourcemanager.projects.update": 3922 3923type ProjectsUpdateCall struct { 3924 s *Service 3925 projectId string 3926 project *Project 3927 urlParams_ gensupport.URLParams 3928 ctx_ context.Context 3929 header_ http.Header 3930} 3931 3932// Update: Updates the attributes of the Project identified by the 3933// specified 3934// `project_id` (for example, `my-project-123`). 3935// 3936// The caller must have modify permissions for this Project. 3937func (r *ProjectsService) Update(projectId string, project *Project) *ProjectsUpdateCall { 3938 c := &ProjectsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3939 c.projectId = projectId 3940 c.project = project 3941 return c 3942} 3943 3944// Fields allows partial responses to be retrieved. See 3945// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3946// for more information. 3947func (c *ProjectsUpdateCall) Fields(s ...googleapi.Field) *ProjectsUpdateCall { 3948 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3949 return c 3950} 3951 3952// Context sets the context to be used in this call's Do method. Any 3953// pending HTTP request will be aborted if the provided context is 3954// canceled. 3955func (c *ProjectsUpdateCall) Context(ctx context.Context) *ProjectsUpdateCall { 3956 c.ctx_ = ctx 3957 return c 3958} 3959 3960// Header returns an http.Header that can be modified by the caller to 3961// add HTTP headers to the request. 3962func (c *ProjectsUpdateCall) Header() http.Header { 3963 if c.header_ == nil { 3964 c.header_ = make(http.Header) 3965 } 3966 return c.header_ 3967} 3968 3969func (c *ProjectsUpdateCall) doRequest(alt string) (*http.Response, error) { 3970 reqHeaders := make(http.Header) 3971 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3972 for k, v := range c.header_ { 3973 reqHeaders[k] = v 3974 } 3975 reqHeaders.Set("User-Agent", c.s.userAgent()) 3976 var body io.Reader = nil 3977 body, err := googleapi.WithoutDataWrapper.JSONReader(c.project) 3978 if err != nil { 3979 return nil, err 3980 } 3981 reqHeaders.Set("Content-Type", "application/json") 3982 c.urlParams_.Set("alt", alt) 3983 c.urlParams_.Set("prettyPrint", "false") 3984 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/projects/{projectId}") 3985 urls += "?" + c.urlParams_.Encode() 3986 req, err := http.NewRequest("PUT", urls, body) 3987 if err != nil { 3988 return nil, err 3989 } 3990 req.Header = reqHeaders 3991 googleapi.Expand(req.URL, map[string]string{ 3992 "projectId": c.projectId, 3993 }) 3994 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3995} 3996 3997// Do executes the "cloudresourcemanager.projects.update" call. 3998// Exactly one of *Project or error will be non-nil. Any non-2xx status 3999// code is an error. Response headers are in either 4000// *Project.ServerResponse.Header or (if a response was returned at all) 4001// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4002// check whether the returned error was because http.StatusNotModified 4003// was returned. 4004func (c *ProjectsUpdateCall) Do(opts ...googleapi.CallOption) (*Project, error) { 4005 gensupport.SetOptions(c.urlParams_, opts...) 4006 res, err := c.doRequest("json") 4007 if res != nil && res.StatusCode == http.StatusNotModified { 4008 if res.Body != nil { 4009 res.Body.Close() 4010 } 4011 return nil, &googleapi.Error{ 4012 Code: res.StatusCode, 4013 Header: res.Header, 4014 } 4015 } 4016 if err != nil { 4017 return nil, err 4018 } 4019 defer googleapi.CloseBody(res) 4020 if err := googleapi.CheckResponse(res); err != nil { 4021 return nil, err 4022 } 4023 ret := &Project{ 4024 ServerResponse: googleapi.ServerResponse{ 4025 Header: res.Header, 4026 HTTPStatusCode: res.StatusCode, 4027 }, 4028 } 4029 target := &ret 4030 if err := gensupport.DecodeResponse(target, res); err != nil { 4031 return nil, err 4032 } 4033 return ret, nil 4034 // { 4035 // "description": "Updates the attributes of the Project identified by the specified\n`project_id` (for example, `my-project-123`).\n\nThe caller must have modify permissions for this Project.", 4036 // "flatPath": "v1beta1/projects/{projectId}", 4037 // "httpMethod": "PUT", 4038 // "id": "cloudresourcemanager.projects.update", 4039 // "parameterOrder": [ 4040 // "projectId" 4041 // ], 4042 // "parameters": { 4043 // "projectId": { 4044 // "description": "The project ID (for example, `my-project-123`).\n\nRequired.", 4045 // "location": "path", 4046 // "required": true, 4047 // "type": "string" 4048 // } 4049 // }, 4050 // "path": "v1beta1/projects/{projectId}", 4051 // "request": { 4052 // "$ref": "Project" 4053 // }, 4054 // "response": { 4055 // "$ref": "Project" 4056 // }, 4057 // "scopes": [ 4058 // "https://www.googleapis.com/auth/cloud-platform" 4059 // ] 4060 // } 4061 4062} 4063