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 cloudasset provides access to the Cloud Asset API. 8// 9// For product documentation, see: https://cloud.google.com/asset-inventory/docs/quickstart 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/cloudasset/v1p1beta1" 16// ... 17// ctx := context.Background() 18// cloudassetService, err := cloudasset.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// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 27// 28// cloudassetService, err := cloudasset.NewService(ctx, option.WithAPIKey("AIza...")) 29// 30// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 31// 32// config := &oauth2.Config{...} 33// // ... 34// token, err := config.Exchange(ctx, ...) 35// cloudassetService, err := cloudasset.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36// 37// See https://godoc.org/google.golang.org/api/option/ for details on options. 38package cloudasset // import "google.golang.org/api/cloudasset/v1p1beta1" 39 40import ( 41 "bytes" 42 "context" 43 "encoding/json" 44 "errors" 45 "fmt" 46 "io" 47 "net/http" 48 "net/url" 49 "strconv" 50 "strings" 51 52 googleapi "google.golang.org/api/googleapi" 53 gensupport "google.golang.org/api/internal/gensupport" 54 option "google.golang.org/api/option" 55 internaloption "google.golang.org/api/option/internaloption" 56 htransport "google.golang.org/api/transport/http" 57) 58 59// Always reference these packages, just in case the auto-generated code 60// below doesn't. 61var _ = bytes.NewBuffer 62var _ = strconv.Itoa 63var _ = fmt.Sprintf 64var _ = json.NewDecoder 65var _ = io.Copy 66var _ = url.Parse 67var _ = gensupport.MarshalJSON 68var _ = googleapi.Version 69var _ = errors.New 70var _ = strings.Replace 71var _ = context.Canceled 72var _ = internaloption.WithDefaultEndpoint 73 74const apiId = "cloudasset:v1p1beta1" 75const apiName = "cloudasset" 76const apiVersion = "v1p1beta1" 77const basePath = "https://cloudasset.googleapis.com/" 78 79// OAuth2 scopes used by this API. 80const ( 81 // View and manage your data across Google Cloud Platform services 82 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 83) 84 85// NewService creates a new Service. 86func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 87 scopesOption := option.WithScopes( 88 "https://www.googleapis.com/auth/cloud-platform", 89 ) 90 // NOTE: prepend, so we don't override user-specified scopes. 91 opts = append([]option.ClientOption{scopesOption}, opts...) 92 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 93 client, endpoint, err := htransport.NewClient(ctx, opts...) 94 if err != nil { 95 return nil, err 96 } 97 s, err := New(client) 98 if err != nil { 99 return nil, err 100 } 101 if endpoint != "" { 102 s.BasePath = endpoint 103 } 104 return s, nil 105} 106 107// New creates a new Service. It uses the provided http.Client for requests. 108// 109// Deprecated: please use NewService instead. 110// To provide a custom HTTP client, use option.WithHTTPClient. 111// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 112func New(client *http.Client) (*Service, error) { 113 if client == nil { 114 return nil, errors.New("client is nil") 115 } 116 s := &Service{client: client, BasePath: basePath} 117 s.IamPolicies = NewIamPoliciesService(s) 118 s.Resources = NewResourcesService(s) 119 return s, nil 120} 121 122type Service struct { 123 client *http.Client 124 BasePath string // API endpoint base URL 125 UserAgent string // optional additional User-Agent fragment 126 127 IamPolicies *IamPoliciesService 128 129 Resources *ResourcesService 130} 131 132func (s *Service) userAgent() string { 133 if s.UserAgent == "" { 134 return googleapi.UserAgent 135 } 136 return googleapi.UserAgent + " " + s.UserAgent 137} 138 139func NewIamPoliciesService(s *Service) *IamPoliciesService { 140 rs := &IamPoliciesService{s: s} 141 return rs 142} 143 144type IamPoliciesService struct { 145 s *Service 146} 147 148func NewResourcesService(s *Service) *ResourcesService { 149 rs := &ResourcesService{s: s} 150 return rs 151} 152 153type ResourcesService struct { 154 s *Service 155} 156 157// AuditConfig: Specifies the audit configuration for a service. 158// The configuration determines which permission types are logged, and 159// what 160// identities, if any, are exempted from logging. 161// An AuditConfig must have one or more AuditLogConfigs. 162// 163// If there are AuditConfigs for both `allServices` and a specific 164// service, 165// the union of the two AuditConfigs is used for that service: the 166// log_types 167// specified in each AuditConfig are enabled, and the exempted_members 168// in each 169// AuditLogConfig are exempted. 170// 171// Example Policy with multiple AuditConfigs: 172// 173// { 174// "audit_configs": [ 175// { 176// "service": "allServices" 177// "audit_log_configs": [ 178// { 179// "log_type": "DATA_READ", 180// "exempted_members": [ 181// "user:jose@example.com" 182// ] 183// }, 184// { 185// "log_type": "DATA_WRITE", 186// }, 187// { 188// "log_type": "ADMIN_READ", 189// } 190// ] 191// }, 192// { 193// "service": "sampleservice.googleapis.com" 194// "audit_log_configs": [ 195// { 196// "log_type": "DATA_READ", 197// }, 198// { 199// "log_type": "DATA_WRITE", 200// "exempted_members": [ 201// "user:aliya@example.com" 202// ] 203// } 204// ] 205// } 206// ] 207// } 208// 209// For sampleservice, this policy enables DATA_READ, DATA_WRITE and 210// ADMIN_READ 211// logging. It also exempts jose@example.com from DATA_READ logging, 212// and 213// aliya@example.com from DATA_WRITE logging. 214type AuditConfig struct { 215 // AuditLogConfigs: The configuration for logging of each type of 216 // permission. 217 AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"` 218 219 // Service: Specifies a service that will be enabled for audit 220 // logging. 221 // For example, `storage.googleapis.com`, 222 // `cloudsql.googleapis.com`. 223 // `allServices` is a special value that covers all services. 224 Service string `json:"service,omitempty"` 225 226 // ForceSendFields is a list of field names (e.g. "AuditLogConfigs") to 227 // unconditionally include in API requests. By default, fields with 228 // empty values are omitted from API requests. However, any non-pointer, 229 // non-interface field appearing in ForceSendFields will be sent to the 230 // server regardless of whether the field is empty or not. This may be 231 // used to include empty fields in Patch requests. 232 ForceSendFields []string `json:"-"` 233 234 // NullFields is a list of field names (e.g. "AuditLogConfigs") to 235 // include in API requests with the JSON null value. By default, fields 236 // with empty values are omitted from API requests. However, any field 237 // with an empty value appearing in NullFields will be sent to the 238 // server as null. It is an error if a field in this list has a 239 // non-empty value. This may be used to include null fields in Patch 240 // requests. 241 NullFields []string `json:"-"` 242} 243 244func (s *AuditConfig) MarshalJSON() ([]byte, error) { 245 type NoMethod AuditConfig 246 raw := NoMethod(*s) 247 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 248} 249 250// AuditLogConfig: Provides the configuration for logging a type of 251// permissions. 252// Example: 253// 254// { 255// "audit_log_configs": [ 256// { 257// "log_type": "DATA_READ", 258// "exempted_members": [ 259// "user:jose@example.com" 260// ] 261// }, 262// { 263// "log_type": "DATA_WRITE", 264// } 265// ] 266// } 267// 268// This enables 'DATA_READ' and 'DATA_WRITE' logging, while 269// exempting 270// jose@example.com from DATA_READ logging. 271type AuditLogConfig struct { 272 // ExemptedMembers: Specifies the identities that do not cause logging 273 // for this type of 274 // permission. 275 // Follows the same format of Binding.members. 276 ExemptedMembers []string `json:"exemptedMembers,omitempty"` 277 278 // LogType: The log type that this config enables. 279 // 280 // Possible values: 281 // "LOG_TYPE_UNSPECIFIED" - Default case. Should never be this. 282 // "ADMIN_READ" - Admin reads. Example: CloudIAM getIamPolicy 283 // "DATA_WRITE" - Data writes. Example: CloudSQL Users create 284 // "DATA_READ" - Data reads. Example: CloudSQL Users list 285 LogType string `json:"logType,omitempty"` 286 287 // ForceSendFields is a list of field names (e.g. "ExemptedMembers") to 288 // unconditionally include in API requests. By default, fields with 289 // empty values are omitted from API requests. However, any non-pointer, 290 // non-interface field appearing in ForceSendFields will be sent to the 291 // server regardless of whether the field is empty or not. This may be 292 // used to include empty fields in Patch requests. 293 ForceSendFields []string `json:"-"` 294 295 // NullFields is a list of field names (e.g. "ExemptedMembers") to 296 // include in API requests with the JSON null value. By default, fields 297 // with empty values are omitted from API requests. However, any field 298 // with an empty value appearing in NullFields will be sent to the 299 // server as null. It is an error if a field in this list has a 300 // non-empty value. This may be used to include null fields in Patch 301 // requests. 302 NullFields []string `json:"-"` 303} 304 305func (s *AuditLogConfig) MarshalJSON() ([]byte, error) { 306 type NoMethod AuditLogConfig 307 raw := NoMethod(*s) 308 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 309} 310 311// Binding: Associates `members` with a `role`. 312type Binding struct { 313 // Condition: The condition that is associated with this binding. 314 // NOTE: An unsatisfied condition will not allow user access via 315 // current 316 // binding. Different bindings, including their conditions, are 317 // examined 318 // independently. 319 Condition *Expr `json:"condition,omitempty"` 320 321 // Members: Specifies the identities requesting access for a Cloud 322 // Platform resource. 323 // `members` can have the following values: 324 // 325 // * `allUsers`: A special identifier that represents anyone who is 326 // on the internet; with or without a Google account. 327 // 328 // * `allAuthenticatedUsers`: A special identifier that represents 329 // anyone 330 // who is authenticated with a Google account or a service 331 // account. 332 // 333 // * `user:{emailid}`: An email address that represents a specific 334 // Google 335 // account. For example, `alice@example.com` . 336 // 337 // 338 // * `serviceAccount:{emailid}`: An email address that represents a 339 // service 340 // account. For example, 341 // `my-other-app@appspot.gserviceaccount.com`. 342 // 343 // * `group:{emailid}`: An email address that represents a Google 344 // group. 345 // For example, `admins@example.com`. 346 // 347 // * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus 348 // unique 349 // identifier) representing a user that has been recently deleted. 350 // For 351 // example, `alice@example.com?uid=123456789012345678901`. If the 352 // user is 353 // recovered, this value reverts to `user:{emailid}` and the 354 // recovered user 355 // retains the role in the binding. 356 // 357 // * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address 358 // (plus 359 // unique identifier) representing a service account that has been 360 // recently 361 // deleted. For example, 362 // 363 // `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. 364 // 365 // If the service account is undeleted, this value reverts to 366 // `serviceAccount:{emailid}` and the undeleted service account 367 // retains the 368 // role in the binding. 369 // 370 // * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus 371 // unique 372 // identifier) representing a Google group that has been recently 373 // deleted. For example, 374 // `admins@example.com?uid=123456789012345678901`. If 375 // the group is recovered, this value reverts to `group:{emailid}` 376 // and the 377 // recovered group retains the role in the binding. 378 // 379 // 380 // * `domain:{domain}`: The G Suite domain (primary) that represents all 381 // the 382 // users of that domain. For example, `google.com` or 383 // `example.com`. 384 // 385 // 386 Members []string `json:"members,omitempty"` 387 388 // Role: Role that is assigned to `members`. 389 // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. 390 Role string `json:"role,omitempty"` 391 392 // ForceSendFields is a list of field names (e.g. "Condition") to 393 // unconditionally include in API requests. By default, fields with 394 // empty values are omitted from API requests. However, any non-pointer, 395 // non-interface field appearing in ForceSendFields will be sent to the 396 // server regardless of whether the field is empty or not. This may be 397 // used to include empty fields in Patch requests. 398 ForceSendFields []string `json:"-"` 399 400 // NullFields is a list of field names (e.g. "Condition") to include in 401 // API requests with the JSON null value. By default, fields with empty 402 // values are omitted from API requests. However, any field with an 403 // empty value appearing in NullFields will be sent to the server as 404 // null. It is an error if a field in this list has a non-empty value. 405 // This may be used to include null fields in Patch requests. 406 NullFields []string `json:"-"` 407} 408 409func (s *Binding) MarshalJSON() ([]byte, error) { 410 type NoMethod Binding 411 raw := NoMethod(*s) 412 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 413} 414 415// Explanation: Explanation about the IAM policy search result. 416type Explanation struct { 417 // MatchedPermissions: The map from roles to their included permission 418 // matching the permission 419 // query (e.g. containing `policy.role.permissions:`). A sample role 420 // string: 421 // "roles/compute.instanceAdmin". The roles can also be found in 422 // the 423 // returned `policy` bindings. Note that the map is populated only 424 // if 425 // requesting with a permission query. 426 MatchedPermissions map[string]Permissions `json:"matchedPermissions,omitempty"` 427 428 // ForceSendFields is a list of field names (e.g. "MatchedPermissions") 429 // to 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. "MatchedPermissions") to 437 // include in API requests with the JSON null value. By default, fields 438 // with empty values are omitted from API requests. However, any field 439 // with an empty value appearing in NullFields will be sent to the 440 // server as null. It is an error if a field in this list has a 441 // non-empty value. This may be used to include null fields in Patch 442 // requests. 443 NullFields []string `json:"-"` 444} 445 446func (s *Explanation) MarshalJSON() ([]byte, error) { 447 type NoMethod Explanation 448 raw := NoMethod(*s) 449 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 450} 451 452// Expr: Represents a textual expression in the Common Expression 453// Language (CEL) 454// syntax. CEL is a C-like expression language. The syntax and semantics 455// of CEL 456// are documented at https://github.com/google/cel-spec. 457// 458// Example (Comparison): 459// 460// title: "Summary size limit" 461// description: "Determines if a summary is less than 100 chars" 462// expression: "document.summary.size() < 100" 463// 464// Example (Equality): 465// 466// title: "Requestor is owner" 467// description: "Determines if requestor is the document owner" 468// expression: "document.owner == 469// request.auth.claims.email" 470// 471// Example (Logic): 472// 473// title: "Public documents" 474// description: "Determine whether the document should be publicly 475// visible" 476// expression: "document.type != 'private' && document.type != 477// 'internal'" 478// 479// Example (Data Manipulation): 480// 481// title: "Notification string" 482// description: "Create a notification string with a timestamp." 483// expression: "'New message received at ' + 484// string(document.create_time)" 485// 486// The exact variables and functions that may be referenced within an 487// expression 488// are determined by the service that evaluates it. See the 489// service 490// documentation for additional information. 491type Expr struct { 492 // Description: Optional. Description of the expression. This is a 493 // longer text which 494 // describes the expression, e.g. when hovered over it in a UI. 495 Description string `json:"description,omitempty"` 496 497 // Expression: Textual representation of an expression in Common 498 // Expression Language 499 // syntax. 500 Expression string `json:"expression,omitempty"` 501 502 // Location: Optional. String indicating the location of the expression 503 // for error 504 // reporting, e.g. a file name and a position in the file. 505 Location string `json:"location,omitempty"` 506 507 // Title: Optional. Title for the expression, i.e. a short string 508 // describing 509 // its purpose. This can be used e.g. in UIs which allow to enter 510 // the 511 // expression. 512 Title string `json:"title,omitempty"` 513 514 // ForceSendFields is a list of field names (e.g. "Description") to 515 // unconditionally include in API requests. By default, fields with 516 // empty values are omitted from API requests. However, any non-pointer, 517 // non-interface field appearing in ForceSendFields will be sent to the 518 // server regardless of whether the field is empty or not. This may be 519 // used to include empty fields in Patch requests. 520 ForceSendFields []string `json:"-"` 521 522 // NullFields is a list of field names (e.g. "Description") to include 523 // in API requests with the JSON null value. By default, fields with 524 // empty values are omitted from API requests. However, any field with 525 // an empty value appearing in NullFields will be sent to the server as 526 // null. It is an error if a field in this list has a non-empty value. 527 // This may be used to include null fields in Patch requests. 528 NullFields []string `json:"-"` 529} 530 531func (s *Expr) MarshalJSON() ([]byte, error) { 532 type NoMethod Expr 533 raw := NoMethod(*s) 534 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 535} 536 537// IamPolicySearchResult: The result for a IAM Policy search. 538type IamPolicySearchResult struct { 539 // Explanation: Explanation about the IAM policy search result. It 540 // contains additional 541 // information to explain why the search result matches the query. 542 Explanation *Explanation `json:"explanation,omitempty"` 543 544 // Policy: The IAM policy directly set on the given resource. Note that 545 // the original 546 // IAM policy can contain multiple bindings. This only contains the 547 // bindings 548 // that match the given query. For queries that don't contain a 549 // constrain on 550 // policies (e.g. an empty query), this contains all the bindings. 551 Policy *Policy `json:"policy,omitempty"` 552 553 // Project: The project that the associated GCP resource belongs to, in 554 // the form of 555 // `projects/{project_number}`. If an IAM policy is set on a resource 556 // (like VM 557 // instance, Cloud Storage bucket), the project field will indicate 558 // the 559 // project that contains the resource. If an IAM policy is set on a 560 // folder or 561 // orgnization, the project field will be empty. 562 Project string `json:"project,omitempty"` 563 564 // Resource: The [full 565 // resource 566 // name](https://cloud.google.com/apis/design/resource_names#ful 567 // l_resource_name) 568 // of the resource associated with this IAM policy. 569 Resource string `json:"resource,omitempty"` 570 571 // ForceSendFields is a list of field names (e.g. "Explanation") to 572 // unconditionally include in API requests. By default, fields with 573 // empty values are omitted from API requests. However, any non-pointer, 574 // non-interface field appearing in ForceSendFields will be sent to the 575 // server regardless of whether the field is empty or not. This may be 576 // used to include empty fields in Patch requests. 577 ForceSendFields []string `json:"-"` 578 579 // NullFields is a list of field names (e.g. "Explanation") to include 580 // in API requests with the JSON null value. By default, fields with 581 // empty values are omitted from API requests. However, any field with 582 // an empty value appearing in NullFields will be sent to the server as 583 // null. It is an error if a field in this list has a non-empty value. 584 // This may be used to include null fields in Patch requests. 585 NullFields []string `json:"-"` 586} 587 588func (s *IamPolicySearchResult) MarshalJSON() ([]byte, error) { 589 type NoMethod IamPolicySearchResult 590 raw := NoMethod(*s) 591 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 592} 593 594// Permissions: IAM permissions 595type Permissions struct { 596 // Permissions: A list of permissions. A sample permission string: 597 // "compute.disk.get". 598 Permissions []string `json:"permissions,omitempty"` 599 600 // ForceSendFields is a list of field names (e.g. "Permissions") to 601 // unconditionally include in API requests. By default, fields with 602 // empty values are omitted from API requests. However, any non-pointer, 603 // non-interface field appearing in ForceSendFields will be sent to the 604 // server regardless of whether the field is empty or not. This may be 605 // used to include empty fields in Patch requests. 606 ForceSendFields []string `json:"-"` 607 608 // NullFields is a list of field names (e.g. "Permissions") to include 609 // in API requests with the JSON null value. By default, fields with 610 // empty values are omitted from API requests. However, any field with 611 // an empty value appearing in NullFields will be sent to the server as 612 // null. It is an error if a field in this list has a non-empty value. 613 // This may be used to include null fields in Patch requests. 614 NullFields []string `json:"-"` 615} 616 617func (s *Permissions) MarshalJSON() ([]byte, error) { 618 type NoMethod Permissions 619 raw := NoMethod(*s) 620 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 621} 622 623// Policy: An Identity and Access Management (IAM) policy, which 624// specifies access 625// controls for Google Cloud resources. 626// 627// 628// A `Policy` is a collection of `bindings`. A `binding` binds one or 629// more 630// `members` to a single `role`. Members can be user accounts, service 631// accounts, 632// Google groups, and domains (such as G Suite). A `role` is a named 633// list of 634// permissions; each `role` can be an IAM predefined role or a 635// user-created 636// custom role. 637// 638// Optionally, a `binding` can specify a `condition`, which is a 639// logical 640// expression that allows access to a resource only if the expression 641// evaluates 642// to `true`. A condition can add constraints based on attributes of 643// the 644// request, the resource, or both. 645// 646// **JSON example:** 647// 648// { 649// "bindings": [ 650// { 651// "role": "roles/resourcemanager.organizationAdmin", 652// "members": [ 653// "user:mike@example.com", 654// "group:admins@example.com", 655// "domain:google.com", 656// 657// "serviceAccount:my-project-id@appspot.gserviceaccount.com" 658// ] 659// }, 660// { 661// "role": "roles/resourcemanager.organizationViewer", 662// "members": ["user:eve@example.com"], 663// "condition": { 664// "title": "expirable access", 665// "description": "Does not grant access after Sep 2020", 666// "expression": "request.time < 667// timestamp('2020-10-01T00:00:00.000Z')", 668// } 669// } 670// ], 671// "etag": "BwWWja0YfJA=", 672// "version": 3 673// } 674// 675// **YAML example:** 676// 677// bindings: 678// - members: 679// - user:mike@example.com 680// - group:admins@example.com 681// - domain:google.com 682// - serviceAccount:my-project-id@appspot.gserviceaccount.com 683// role: roles/resourcemanager.organizationAdmin 684// - members: 685// - user:eve@example.com 686// role: roles/resourcemanager.organizationViewer 687// condition: 688// title: expirable access 689// description: Does not grant access after Sep 2020 690// expression: request.time < 691// timestamp('2020-10-01T00:00:00.000Z') 692// - etag: BwWWja0YfJA= 693// - version: 3 694// 695// For a description of IAM and its features, see the 696// [IAM documentation](https://cloud.google.com/iam/docs/). 697type Policy struct { 698 // AuditConfigs: Specifies cloud audit logging configuration for this 699 // policy. 700 AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"` 701 702 // Bindings: Associates a list of `members` to a `role`. Optionally, may 703 // specify a 704 // `condition` that determines how and when the `bindings` are applied. 705 // Each 706 // of the `bindings` must contain at least one member. 707 Bindings []*Binding `json:"bindings,omitempty"` 708 709 // Etag: `etag` is used for optimistic concurrency control as a way to 710 // help 711 // prevent simultaneous updates of a policy from overwriting each 712 // other. 713 // It is strongly suggested that systems make use of the `etag` in 714 // the 715 // read-modify-write cycle to perform policy updates in order to avoid 716 // race 717 // conditions: An `etag` is returned in the response to `getIamPolicy`, 718 // and 719 // systems are expected to put that etag in the request to 720 // `setIamPolicy` to 721 // ensure that their change will be applied to the same version of the 722 // policy. 723 // 724 // **Important:** If you use IAM Conditions, you must include the `etag` 725 // field 726 // whenever you call `setIamPolicy`. If you omit this field, then IAM 727 // allows 728 // you to overwrite a version `3` policy with a version `1` policy, and 729 // all of 730 // the conditions in the version `3` policy are lost. 731 Etag string `json:"etag,omitempty"` 732 733 // Version: Specifies the format of the policy. 734 // 735 // Valid values are `0`, `1`, and `3`. Requests that specify an invalid 736 // value 737 // are rejected. 738 // 739 // Any operation that affects conditional role bindings must specify 740 // version 741 // `3`. This requirement applies to the following operations: 742 // 743 // * Getting a policy that includes a conditional role binding 744 // * Adding a conditional role binding to a policy 745 // * Changing a conditional role binding in a policy 746 // * Removing any role binding, with or without a condition, from a 747 // policy 748 // that includes conditions 749 // 750 // **Important:** If you use IAM Conditions, you must include the `etag` 751 // field 752 // whenever you call `setIamPolicy`. If you omit this field, then IAM 753 // allows 754 // you to overwrite a version `3` policy with a version `1` policy, and 755 // all of 756 // the conditions in the version `3` policy are lost. 757 // 758 // If a policy does not include any conditions, operations on that 759 // policy may 760 // specify any valid version or leave the field unset. 761 Version int64 `json:"version,omitempty"` 762 763 // ForceSendFields is a list of field names (e.g. "AuditConfigs") to 764 // unconditionally include in API requests. By default, fields with 765 // empty values are omitted from API requests. However, any non-pointer, 766 // non-interface field appearing in ForceSendFields will be sent to the 767 // server regardless of whether the field is empty or not. This may be 768 // used to include empty fields in Patch requests. 769 ForceSendFields []string `json:"-"` 770 771 // NullFields is a list of field names (e.g. "AuditConfigs") to include 772 // in API requests with the JSON null value. By default, fields with 773 // empty values are omitted from API requests. However, any field with 774 // an empty value appearing in NullFields will be sent to the server as 775 // null. It is an error if a field in this list has a non-empty value. 776 // This may be used to include null fields in Patch requests. 777 NullFields []string `json:"-"` 778} 779 780func (s *Policy) MarshalJSON() ([]byte, error) { 781 type NoMethod Policy 782 raw := NoMethod(*s) 783 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 784} 785 786// SearchAllIamPoliciesResponse: Search all IAM policies response. 787type SearchAllIamPoliciesResponse struct { 788 // NextPageToken: Set if there are more results than those appearing in 789 // this response; to get 790 // the next set of results, call this method again, using this value as 791 // the 792 // `page_token`. 793 NextPageToken string `json:"nextPageToken,omitempty"` 794 795 // Results: A list of IamPolicy that match the search query. Related 796 // information such 797 // as the associated resource is returned along with the policy. 798 Results []*IamPolicySearchResult `json:"results,omitempty"` 799 800 // ServerResponse contains the HTTP response code and headers from the 801 // server. 802 googleapi.ServerResponse `json:"-"` 803 804 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 805 // unconditionally include in API requests. By default, fields with 806 // empty values are omitted from API requests. However, any non-pointer, 807 // non-interface field appearing in ForceSendFields will be sent to the 808 // server regardless of whether the field is empty or not. This may be 809 // used to include empty fields in Patch requests. 810 ForceSendFields []string `json:"-"` 811 812 // NullFields is a list of field names (e.g. "NextPageToken") to include 813 // in API requests with the JSON null value. By default, fields with 814 // empty values are omitted from API requests. However, any field with 815 // an empty value appearing in NullFields will be sent to the server as 816 // null. It is an error if a field in this list has a non-empty value. 817 // This may be used to include null fields in Patch requests. 818 NullFields []string `json:"-"` 819} 820 821func (s *SearchAllIamPoliciesResponse) MarshalJSON() ([]byte, error) { 822 type NoMethod SearchAllIamPoliciesResponse 823 raw := NoMethod(*s) 824 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 825} 826 827// SearchAllResourcesResponse: Search all resources response. 828type SearchAllResourcesResponse struct { 829 // NextPageToken: If there are more results than those appearing in this 830 // response, then 831 // `next_page_token` is included. To get the next set of results, call 832 // this 833 // method again using the value of `next_page_token` as `page_token`. 834 NextPageToken string `json:"nextPageToken,omitempty"` 835 836 // Results: A list of resource that match the search query. 837 Results []*StandardResourceMetadata `json:"results,omitempty"` 838 839 // ServerResponse contains the HTTP response code and headers from the 840 // server. 841 googleapi.ServerResponse `json:"-"` 842 843 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 844 // unconditionally include in API requests. By default, fields with 845 // empty values are omitted from API requests. However, any non-pointer, 846 // non-interface field appearing in ForceSendFields will be sent to the 847 // server regardless of whether the field is empty or not. This may be 848 // used to include empty fields in Patch requests. 849 ForceSendFields []string `json:"-"` 850 851 // NullFields is a list of field names (e.g. "NextPageToken") to include 852 // in API requests with the JSON null value. By default, fields with 853 // empty values are omitted from API requests. However, any field with 854 // an empty value appearing in NullFields will be sent to the server as 855 // null. It is an error if a field in this list has a non-empty value. 856 // This may be used to include null fields in Patch requests. 857 NullFields []string `json:"-"` 858} 859 860func (s *SearchAllResourcesResponse) MarshalJSON() ([]byte, error) { 861 type NoMethod SearchAllResourcesResponse 862 raw := NoMethod(*s) 863 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 864} 865 866// StandardResourceMetadata: The standard metadata of a cloud resource. 867type StandardResourceMetadata struct { 868 // AdditionalAttributes: Additional searchable attributes of this 869 // resource. 870 // Informational only. The exact set of attributes is subject to 871 // change. 872 // For example: project id, DNS name etc. 873 AdditionalAttributes []string `json:"additionalAttributes,omitempty"` 874 875 // AssetType: The type of this resource. 876 // For example: "compute.googleapis.com/Disk". 877 AssetType string `json:"assetType,omitempty"` 878 879 // Description: One or more paragraphs of text description of this 880 // resource. Maximum length 881 // could be up to 1M bytes. 882 Description string `json:"description,omitempty"` 883 884 // DisplayName: The display name of this resource. 885 DisplayName string `json:"displayName,omitempty"` 886 887 // Location: Location can be "global", regional like "us-east1", or 888 // zonal like 889 // "us-west1-b". 890 Location string `json:"location,omitempty"` 891 892 // Name: The full resource name. For 893 // example: 894 // `//compute.googleapis.com/projects/my_project_123/zones/zone1 895 // /instances/instance1`. 896 // See 897 // [Resource 898 // Names](https://cloud.google.com/apis/design/resource_names#f 899 // ull_resource_name) 900 // for more information. 901 Name string `json:"name,omitempty"` 902 903 // Project: The project that this resource belongs to, in the form 904 // of 905 // `projects/{project_number}`. 906 Project string `json:"project,omitempty"` 907 908 // ForceSendFields is a list of field names (e.g. 909 // "AdditionalAttributes") to unconditionally include in API requests. 910 // By default, fields with empty values are omitted from API requests. 911 // However, any non-pointer, non-interface field appearing in 912 // ForceSendFields will be sent to the server regardless of whether the 913 // field is empty or not. This may be used to include empty fields in 914 // Patch requests. 915 ForceSendFields []string `json:"-"` 916 917 // NullFields is a list of field names (e.g. "AdditionalAttributes") to 918 // include in API requests with the JSON null value. By default, fields 919 // with empty values are omitted from API requests. However, any field 920 // with an empty value appearing in NullFields will be sent to the 921 // server as null. It is an error if a field in this list has a 922 // non-empty value. This may be used to include null fields in Patch 923 // requests. 924 NullFields []string `json:"-"` 925} 926 927func (s *StandardResourceMetadata) MarshalJSON() ([]byte, error) { 928 type NoMethod StandardResourceMetadata 929 raw := NoMethod(*s) 930 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 931} 932 933// method id "cloudasset.iamPolicies.searchAll": 934 935type IamPoliciesSearchAllCall struct { 936 s *Service 937 scope string 938 urlParams_ gensupport.URLParams 939 ifNoneMatch_ string 940 ctx_ context.Context 941 header_ http.Header 942} 943 944// SearchAll: Searches all the IAM policies under a given accessible CRM 945// scope 946// (project/folder/organization). This RPC gives callers 947// especially admins the ability to search all the IAM policies under a 948// scope, 949// even if they don't have .getIamPolicy permission of all the IAM 950// policies. 951// Callers should have cloud.assets.SearchAllIamPolicies permission on 952// the 953// requested scope, otherwise it will be rejected. 954func (r *IamPoliciesService) SearchAll(scope string) *IamPoliciesSearchAllCall { 955 c := &IamPoliciesSearchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)} 956 c.scope = scope 957 return c 958} 959 960// PageSize sets the optional parameter "pageSize": The page size for 961// search result pagination. Page size is capped at 500 even 962// if a larger value is given. If set to zero, server will pick an 963// appropriate 964// default. Returned results may be fewer than requested. When this 965// happens, 966// there could be more results as long as `next_page_token` is returned. 967func (c *IamPoliciesSearchAllCall) PageSize(pageSize int64) *IamPoliciesSearchAllCall { 968 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 969 return c 970} 971 972// PageToken sets the optional parameter "pageToken": If present, 973// retrieve the next batch of results from the preceding call to 974// this method. `page_token` must be the value of `next_page_token` from 975// the 976// previous response. The values of all other method parameters must 977// be 978// identical to those in the previous call. 979func (c *IamPoliciesSearchAllCall) PageToken(pageToken string) *IamPoliciesSearchAllCall { 980 c.urlParams_.Set("pageToken", pageToken) 981 return c 982} 983 984// Query sets the optional parameter "query": The query 985// statement. 986// Examples: 987// * "policy:myuser@mydomain.com" 988// * "policy:(myuser@mydomain.com viewer)" 989func (c *IamPoliciesSearchAllCall) Query(query string) *IamPoliciesSearchAllCall { 990 c.urlParams_.Set("query", query) 991 return c 992} 993 994// Fields allows partial responses to be retrieved. See 995// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 996// for more information. 997func (c *IamPoliciesSearchAllCall) Fields(s ...googleapi.Field) *IamPoliciesSearchAllCall { 998 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 999 return c 1000} 1001 1002// IfNoneMatch sets the optional parameter which makes the operation 1003// fail if the object's ETag matches the given value. This is useful for 1004// getting updates only after the object has changed since the last 1005// request. Use googleapi.IsNotModified to check whether the response 1006// error from Do is the result of In-None-Match. 1007func (c *IamPoliciesSearchAllCall) IfNoneMatch(entityTag string) *IamPoliciesSearchAllCall { 1008 c.ifNoneMatch_ = entityTag 1009 return c 1010} 1011 1012// Context sets the context to be used in this call's Do method. Any 1013// pending HTTP request will be aborted if the provided context is 1014// canceled. 1015func (c *IamPoliciesSearchAllCall) Context(ctx context.Context) *IamPoliciesSearchAllCall { 1016 c.ctx_ = ctx 1017 return c 1018} 1019 1020// Header returns an http.Header that can be modified by the caller to 1021// add HTTP headers to the request. 1022func (c *IamPoliciesSearchAllCall) Header() http.Header { 1023 if c.header_ == nil { 1024 c.header_ = make(http.Header) 1025 } 1026 return c.header_ 1027} 1028 1029func (c *IamPoliciesSearchAllCall) doRequest(alt string) (*http.Response, error) { 1030 reqHeaders := make(http.Header) 1031 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200503") 1032 for k, v := range c.header_ { 1033 reqHeaders[k] = v 1034 } 1035 reqHeaders.Set("User-Agent", c.s.userAgent()) 1036 if c.ifNoneMatch_ != "" { 1037 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1038 } 1039 var body io.Reader = nil 1040 c.urlParams_.Set("alt", alt) 1041 c.urlParams_.Set("prettyPrint", "false") 1042 urls := googleapi.ResolveRelative(c.s.BasePath, "v1p1beta1/{+scope}/iamPolicies:searchAll") 1043 urls += "?" + c.urlParams_.Encode() 1044 req, err := http.NewRequest("GET", urls, body) 1045 if err != nil { 1046 return nil, err 1047 } 1048 req.Header = reqHeaders 1049 googleapi.Expand(req.URL, map[string]string{ 1050 "scope": c.scope, 1051 }) 1052 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1053} 1054 1055// Do executes the "cloudasset.iamPolicies.searchAll" call. 1056// Exactly one of *SearchAllIamPoliciesResponse or error will be 1057// non-nil. Any non-2xx status code is an error. Response headers are in 1058// either *SearchAllIamPoliciesResponse.ServerResponse.Header or (if a 1059// response was returned at all) in error.(*googleapi.Error).Header. Use 1060// googleapi.IsNotModified to check whether the returned error was 1061// because http.StatusNotModified was returned. 1062func (c *IamPoliciesSearchAllCall) Do(opts ...googleapi.CallOption) (*SearchAllIamPoliciesResponse, error) { 1063 gensupport.SetOptions(c.urlParams_, opts...) 1064 res, err := c.doRequest("json") 1065 if res != nil && res.StatusCode == http.StatusNotModified { 1066 if res.Body != nil { 1067 res.Body.Close() 1068 } 1069 return nil, &googleapi.Error{ 1070 Code: res.StatusCode, 1071 Header: res.Header, 1072 } 1073 } 1074 if err != nil { 1075 return nil, err 1076 } 1077 defer googleapi.CloseBody(res) 1078 if err := googleapi.CheckResponse(res); err != nil { 1079 return nil, err 1080 } 1081 ret := &SearchAllIamPoliciesResponse{ 1082 ServerResponse: googleapi.ServerResponse{ 1083 Header: res.Header, 1084 HTTPStatusCode: res.StatusCode, 1085 }, 1086 } 1087 target := &ret 1088 if err := gensupport.DecodeResponse(target, res); err != nil { 1089 return nil, err 1090 } 1091 return ret, nil 1092 // { 1093 // "description": "Searches all the IAM policies under a given accessible CRM scope\n(project/folder/organization). This RPC gives callers\nespecially admins the ability to search all the IAM policies under a scope,\neven if they don't have .getIamPolicy permission of all the IAM policies.\nCallers should have cloud.assets.SearchAllIamPolicies permission on the\nrequested scope, otherwise it will be rejected.", 1094 // "flatPath": "v1p1beta1/{v1p1beta1Id}/{v1p1beta1Id1}/iamPolicies:searchAll", 1095 // "httpMethod": "GET", 1096 // "id": "cloudasset.iamPolicies.searchAll", 1097 // "parameterOrder": [ 1098 // "scope" 1099 // ], 1100 // "parameters": { 1101 // "pageSize": { 1102 // "description": "Optional. The page size for search result pagination. Page size is capped at 500 even\nif a larger value is given. If set to zero, server will pick an appropriate\ndefault. Returned results may be fewer than requested. When this happens,\nthere could be more results as long as `next_page_token` is returned.", 1103 // "format": "int32", 1104 // "location": "query", 1105 // "type": "integer" 1106 // }, 1107 // "pageToken": { 1108 // "description": "Optional. If present, retrieve the next batch of results from the preceding call to\nthis method. `page_token` must be the value of `next_page_token` from the\nprevious response. The values of all other method parameters must be\nidentical to those in the previous call.", 1109 // "location": "query", 1110 // "type": "string" 1111 // }, 1112 // "query": { 1113 // "description": "Optional. The query statement.\nExamples:\n* \"policy:myuser@mydomain.com\"\n* \"policy:(myuser@mydomain.com viewer)\"", 1114 // "location": "query", 1115 // "type": "string" 1116 // }, 1117 // "scope": { 1118 // "description": "Required. The relative name of an asset. The search is limited to the resources\nwithin the `scope`. The allowed value must be:\n* Organization number (such as \"organizations/123\")\n* Folder number(such as \"folders/1234\")\n* Project number (such as \"projects/12345\")\n* Project id (such as \"projects/abc\")", 1119 // "location": "path", 1120 // "pattern": "^[^/]+/[^/]+$", 1121 // "required": true, 1122 // "type": "string" 1123 // } 1124 // }, 1125 // "path": "v1p1beta1/{+scope}/iamPolicies:searchAll", 1126 // "response": { 1127 // "$ref": "SearchAllIamPoliciesResponse" 1128 // }, 1129 // "scopes": [ 1130 // "https://www.googleapis.com/auth/cloud-platform" 1131 // ] 1132 // } 1133 1134} 1135 1136// Pages invokes f for each page of results. 1137// A non-nil error returned from f will halt the iteration. 1138// The provided context supersedes any context provided to the Context method. 1139func (c *IamPoliciesSearchAllCall) Pages(ctx context.Context, f func(*SearchAllIamPoliciesResponse) error) error { 1140 c.ctx_ = ctx 1141 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1142 for { 1143 x, err := c.Do() 1144 if err != nil { 1145 return err 1146 } 1147 if err := f(x); err != nil { 1148 return err 1149 } 1150 if x.NextPageToken == "" { 1151 return nil 1152 } 1153 c.PageToken(x.NextPageToken) 1154 } 1155} 1156 1157// method id "cloudasset.resources.searchAll": 1158 1159type ResourcesSearchAllCall struct { 1160 s *Service 1161 scope string 1162 urlParams_ gensupport.URLParams 1163 ifNoneMatch_ string 1164 ctx_ context.Context 1165 header_ http.Header 1166} 1167 1168// SearchAll: Searches all the resources under a given accessible CRM 1169// scope 1170// (project/folder/organization). This RPC gives callers 1171// especially admins the ability to search all the resources under a 1172// scope, 1173// even if they don't have .get permission of all the resources. 1174// Callers 1175// should have cloud.assets.SearchAllResources permission on the 1176// requested 1177// scope, otherwise it will be rejected. 1178func (r *ResourcesService) SearchAll(scope string) *ResourcesSearchAllCall { 1179 c := &ResourcesSearchAllCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1180 c.scope = scope 1181 return c 1182} 1183 1184// AssetTypes sets the optional parameter "assetTypes": A list of asset 1185// types that this request searches for. If empty, it will 1186// search all the supported asset types. 1187func (c *ResourcesSearchAllCall) AssetTypes(assetTypes ...string) *ResourcesSearchAllCall { 1188 c.urlParams_.SetMulti("assetTypes", append([]string{}, assetTypes...)) 1189 return c 1190} 1191 1192// OrderBy sets the optional parameter "orderBy": A comma separated list 1193// of fields specifying the sorting order of the 1194// results. The default order is ascending. Add " desc" after the field 1195// name 1196// to indicate descending order. Redundant space characters are ignored. 1197// For 1198// example, " foo , bar desc ". 1199func (c *ResourcesSearchAllCall) OrderBy(orderBy string) *ResourcesSearchAllCall { 1200 c.urlParams_.Set("orderBy", orderBy) 1201 return c 1202} 1203 1204// PageSize sets the optional parameter "pageSize": The page size for 1205// search result pagination. Page size is capped at 500 even 1206// if a larger value is given. If set to zero, server will pick an 1207// appropriate 1208// default. Returned results may be fewer than requested. When this 1209// happens, 1210// there could be more results as long as `next_page_token` is returned. 1211func (c *ResourcesSearchAllCall) PageSize(pageSize int64) *ResourcesSearchAllCall { 1212 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1213 return c 1214} 1215 1216// PageToken sets the optional parameter "pageToken": If present, then 1217// retrieve the next batch of results from the preceding call 1218// to this method. `page_token` must be the value of `next_page_token` 1219// from 1220// the previous response. The values of all other method parameters, 1221// must be 1222// identical to those in the previous call. 1223func (c *ResourcesSearchAllCall) PageToken(pageToken string) *ResourcesSearchAllCall { 1224 c.urlParams_.Set("pageToken", pageToken) 1225 return c 1226} 1227 1228// Query sets the optional parameter "query": The query statement. 1229func (c *ResourcesSearchAllCall) Query(query string) *ResourcesSearchAllCall { 1230 c.urlParams_.Set("query", query) 1231 return c 1232} 1233 1234// Fields allows partial responses to be retrieved. See 1235// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1236// for more information. 1237func (c *ResourcesSearchAllCall) Fields(s ...googleapi.Field) *ResourcesSearchAllCall { 1238 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1239 return c 1240} 1241 1242// IfNoneMatch sets the optional parameter which makes the operation 1243// fail if the object's ETag matches the given value. This is useful for 1244// getting updates only after the object has changed since the last 1245// request. Use googleapi.IsNotModified to check whether the response 1246// error from Do is the result of In-None-Match. 1247func (c *ResourcesSearchAllCall) IfNoneMatch(entityTag string) *ResourcesSearchAllCall { 1248 c.ifNoneMatch_ = entityTag 1249 return c 1250} 1251 1252// Context sets the context to be used in this call's Do method. Any 1253// pending HTTP request will be aborted if the provided context is 1254// canceled. 1255func (c *ResourcesSearchAllCall) Context(ctx context.Context) *ResourcesSearchAllCall { 1256 c.ctx_ = ctx 1257 return c 1258} 1259 1260// Header returns an http.Header that can be modified by the caller to 1261// add HTTP headers to the request. 1262func (c *ResourcesSearchAllCall) Header() http.Header { 1263 if c.header_ == nil { 1264 c.header_ = make(http.Header) 1265 } 1266 return c.header_ 1267} 1268 1269func (c *ResourcesSearchAllCall) doRequest(alt string) (*http.Response, error) { 1270 reqHeaders := make(http.Header) 1271 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200503") 1272 for k, v := range c.header_ { 1273 reqHeaders[k] = v 1274 } 1275 reqHeaders.Set("User-Agent", c.s.userAgent()) 1276 if c.ifNoneMatch_ != "" { 1277 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1278 } 1279 var body io.Reader = nil 1280 c.urlParams_.Set("alt", alt) 1281 c.urlParams_.Set("prettyPrint", "false") 1282 urls := googleapi.ResolveRelative(c.s.BasePath, "v1p1beta1/{+scope}/resources:searchAll") 1283 urls += "?" + c.urlParams_.Encode() 1284 req, err := http.NewRequest("GET", urls, body) 1285 if err != nil { 1286 return nil, err 1287 } 1288 req.Header = reqHeaders 1289 googleapi.Expand(req.URL, map[string]string{ 1290 "scope": c.scope, 1291 }) 1292 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1293} 1294 1295// Do executes the "cloudasset.resources.searchAll" call. 1296// Exactly one of *SearchAllResourcesResponse or error will be non-nil. 1297// Any non-2xx status code is an error. Response headers are in either 1298// *SearchAllResourcesResponse.ServerResponse.Header or (if a response 1299// was returned at all) in error.(*googleapi.Error).Header. Use 1300// googleapi.IsNotModified to check whether the returned error was 1301// because http.StatusNotModified was returned. 1302func (c *ResourcesSearchAllCall) Do(opts ...googleapi.CallOption) (*SearchAllResourcesResponse, error) { 1303 gensupport.SetOptions(c.urlParams_, opts...) 1304 res, err := c.doRequest("json") 1305 if res != nil && res.StatusCode == http.StatusNotModified { 1306 if res.Body != nil { 1307 res.Body.Close() 1308 } 1309 return nil, &googleapi.Error{ 1310 Code: res.StatusCode, 1311 Header: res.Header, 1312 } 1313 } 1314 if err != nil { 1315 return nil, err 1316 } 1317 defer googleapi.CloseBody(res) 1318 if err := googleapi.CheckResponse(res); err != nil { 1319 return nil, err 1320 } 1321 ret := &SearchAllResourcesResponse{ 1322 ServerResponse: googleapi.ServerResponse{ 1323 Header: res.Header, 1324 HTTPStatusCode: res.StatusCode, 1325 }, 1326 } 1327 target := &ret 1328 if err := gensupport.DecodeResponse(target, res); err != nil { 1329 return nil, err 1330 } 1331 return ret, nil 1332 // { 1333 // "description": "Searches all the resources under a given accessible CRM scope\n(project/folder/organization). This RPC gives callers\nespecially admins the ability to search all the resources under a scope,\neven if they don't have .get permission of all the resources. Callers\nshould have cloud.assets.SearchAllResources permission on the requested\nscope, otherwise it will be rejected.", 1334 // "flatPath": "v1p1beta1/{v1p1beta1Id}/{v1p1beta1Id1}/resources:searchAll", 1335 // "httpMethod": "GET", 1336 // "id": "cloudasset.resources.searchAll", 1337 // "parameterOrder": [ 1338 // "scope" 1339 // ], 1340 // "parameters": { 1341 // "assetTypes": { 1342 // "description": "Optional. A list of asset types that this request searches for. If empty, it will\nsearch all the supported asset types.", 1343 // "location": "query", 1344 // "repeated": true, 1345 // "type": "string" 1346 // }, 1347 // "orderBy": { 1348 // "description": "Optional. A comma separated list of fields specifying the sorting order of the\nresults. The default order is ascending. Add \" desc\" after the field name\nto indicate descending order. Redundant space characters are ignored. For\nexample, \" foo , bar desc \".", 1349 // "location": "query", 1350 // "type": "string" 1351 // }, 1352 // "pageSize": { 1353 // "description": "Optional. The page size for search result pagination. Page size is capped at 500 even\nif a larger value is given. If set to zero, server will pick an appropriate\ndefault. Returned results may be fewer than requested. When this happens,\nthere could be more results as long as `next_page_token` is returned.", 1354 // "format": "int32", 1355 // "location": "query", 1356 // "type": "integer" 1357 // }, 1358 // "pageToken": { 1359 // "description": "Optional. If present, then retrieve the next batch of results from the preceding call\nto this method. `page_token` must be the value of `next_page_token` from\nthe previous response. The values of all other method parameters, must be\nidentical to those in the previous call.", 1360 // "location": "query", 1361 // "type": "string" 1362 // }, 1363 // "query": { 1364 // "description": "Optional. The query statement.", 1365 // "location": "query", 1366 // "type": "string" 1367 // }, 1368 // "scope": { 1369 // "description": "Required. The relative name of an asset. The search is limited to the resources\nwithin the `scope`. The allowed value must be:\n* Organization number (such as \"organizations/123\")\n* Folder number(such as \"folders/1234\")\n* Project number (such as \"projects/12345\")\n* Project id (such as \"projects/abc\")", 1370 // "location": "path", 1371 // "pattern": "^[^/]+/[^/]+$", 1372 // "required": true, 1373 // "type": "string" 1374 // } 1375 // }, 1376 // "path": "v1p1beta1/{+scope}/resources:searchAll", 1377 // "response": { 1378 // "$ref": "SearchAllResourcesResponse" 1379 // }, 1380 // "scopes": [ 1381 // "https://www.googleapis.com/auth/cloud-platform" 1382 // ] 1383 // } 1384 1385} 1386 1387// Pages invokes f for each page of results. 1388// A non-nil error returned from f will halt the iteration. 1389// The provided context supersedes any context provided to the Context method. 1390func (c *ResourcesSearchAllCall) Pages(ctx context.Context, f func(*SearchAllResourcesResponse) error) error { 1391 c.ctx_ = ctx 1392 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1393 for { 1394 x, err := c.Do() 1395 if err != nil { 1396 return err 1397 } 1398 if err := f(x); err != nil { 1399 return err 1400 } 1401 if x.NextPageToken == "" { 1402 return nil 1403 } 1404 c.PageToken(x.NextPageToken) 1405 } 1406} 1407