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