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