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 cloudfunctions provides access to the Cloud Functions API. 8 // 9 // For product documentation, see: https://cloud.google.com/functions 10 // 11 // # Creating a client 12 // 13 // Usage example: 14 // 15 // import "google.golang.org/api/cloudfunctions/v1beta2" 16 // ... 17 // ctx := context.Background() 18 // cloudfunctionsService, err := cloudfunctions.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 // cloudfunctionsService, err := cloudfunctions.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 // cloudfunctionsService, err := cloudfunctions.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 cloudfunctions // import "google.golang.org/api/cloudfunctions/v1beta2" 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 = "cloudfunctions:v1beta2" 75 const apiName = "cloudfunctions" 76 const apiVersion = "v1beta2" 77 const basePath = "https://cloudfunctions.googleapis.com/" 78 const mtlsBasePath = "https://cloudfunctions.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.Operations = NewOperationsService(s) 120 s.Projects = NewProjectsService(s) 121 return s, nil 122 } 123 124 type Service struct { 125 client *http.Client 126 BasePath string // API endpoint base URL 127 UserAgent string // optional additional User-Agent fragment 128 129 Operations *OperationsService 130 131 Projects *ProjectsService 132 } 133 134 func (s *Service) userAgent() string { 135 if s.UserAgent == "" { 136 return googleapi.UserAgent 137 } 138 return googleapi.UserAgent + " " + s.UserAgent 139 } 140 141 func NewOperationsService(s *Service) *OperationsService { 142 rs := &OperationsService{s: s} 143 return rs 144 } 145 146 type OperationsService struct { 147 s *Service 148 } 149 150 func NewProjectsService(s *Service) *ProjectsService { 151 rs := &ProjectsService{s: s} 152 rs.Locations = NewProjectsLocationsService(s) 153 return rs 154 } 155 156 type ProjectsService struct { 157 s *Service 158 159 Locations *ProjectsLocationsService 160 } 161 162 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService { 163 rs := &ProjectsLocationsService{s: s} 164 rs.Functions = NewProjectsLocationsFunctionsService(s) 165 return rs 166 } 167 168 type ProjectsLocationsService struct { 169 s *Service 170 171 Functions *ProjectsLocationsFunctionsService 172 } 173 174 func NewProjectsLocationsFunctionsService(s *Service) *ProjectsLocationsFunctionsService { 175 rs := &ProjectsLocationsFunctionsService{s: s} 176 return rs 177 } 178 179 type ProjectsLocationsFunctionsService struct { 180 s *Service 181 } 182 183 // CallFunctionRequest: Request for the `CallFunction` method. 184 type CallFunctionRequest struct { 185 // Data: Required. Input to be passed to the function. 186 Data string `json:"data,omitempty"` 187 188 // ForceSendFields is a list of field names (e.g. "Data") to 189 // unconditionally include in API requests. By default, fields with 190 // empty values are omitted from API requests. However, any non-pointer, 191 // non-interface field appearing in ForceSendFields will be sent to the 192 // server regardless of whether the field is empty or not. This may be 193 // used to include empty fields in Patch requests. 194 ForceSendFields []string `json:"-"` 195 196 // NullFields is a list of field names (e.g. "Data") to include in API 197 // requests with the JSON null value. By default, fields with empty 198 // values are omitted from API requests. However, any field with an 199 // empty value appearing in NullFields will be sent to the server as 200 // null. It is an error if a field in this list has a non-empty value. 201 // This may be used to include null fields in Patch requests. 202 NullFields []string `json:"-"` 203 } 204 205 func (s *CallFunctionRequest) MarshalJSON() ([]byte, error) { 206 type NoMethod CallFunctionRequest 207 raw := NoMethod(*s) 208 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 209 } 210 211 // CallFunctionResponse: Response of `CallFunction` method. 212 type CallFunctionResponse struct { 213 // Error: Either system or user-function generated error. Set if 214 // execution 215 // was not successful. 216 Error string `json:"error,omitempty"` 217 218 // ExecutionId: Execution id of function invocation. 219 ExecutionId string `json:"executionId,omitempty"` 220 221 // Result: Result populated for successful execution of synchronous 222 // function. Will 223 // not be populated if function does not return a result through 224 // context. 225 Result string `json:"result,omitempty"` 226 227 // ServerResponse contains the HTTP response code and headers from the 228 // server. 229 googleapi.ServerResponse `json:"-"` 230 231 // ForceSendFields is a list of field names (e.g. "Error") to 232 // unconditionally include in API requests. By default, fields with 233 // empty values are omitted from API requests. However, any non-pointer, 234 // non-interface field appearing in ForceSendFields will be sent to the 235 // server regardless of whether the field is empty or not. This may be 236 // used to include empty fields in Patch requests. 237 ForceSendFields []string `json:"-"` 238 239 // NullFields is a list of field names (e.g. "Error") to include in API 240 // requests with the JSON null value. By default, fields with empty 241 // values are omitted from API requests. However, any field with an 242 // empty value appearing in NullFields will be sent to the server as 243 // null. It is an error if a field in this list has a non-empty value. 244 // This may be used to include null fields in Patch requests. 245 NullFields []string `json:"-"` 246 } 247 248 func (s *CallFunctionResponse) MarshalJSON() ([]byte, error) { 249 type NoMethod CallFunctionResponse 250 raw := NoMethod(*s) 251 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 252 } 253 254 // CloudFunction: Describes a Cloud Function that contains user 255 // computation executed in 256 // response to an event. It encapsulate function and triggers 257 // configurations. 258 type CloudFunction struct { 259 // AvailableMemoryMb: The amount of memory in MB available for a 260 // function. 261 // Defaults to 256MB. 262 AvailableMemoryMb int64 `json:"availableMemoryMb,omitempty"` 263 264 // EntryPoint: The name of the function (as defined in source code) that 265 // will be 266 // executed. Defaults to the resource name suffix, if not specified. 267 // For 268 // backward compatibility, if function with given name is not found, 269 // then the 270 // system will try to use function named "function". 271 // For Node.js this is name of a function exported by the module 272 // specified 273 // in `source_location`. 274 EntryPoint string `json:"entryPoint,omitempty"` 275 276 // EnvironmentVariables: Environment variables that shall be available 277 // during function execution. 278 EnvironmentVariables map[string]string `json:"environmentVariables,omitempty"` 279 280 // EventTrigger: A source that fires events in response to a condition 281 // in another service. 282 EventTrigger *EventTrigger `json:"eventTrigger,omitempty"` 283 284 // HttpsTrigger: An HTTPS endpoint type of source that can be triggered 285 // via URL. 286 HttpsTrigger *HTTPSTrigger `json:"httpsTrigger,omitempty"` 287 288 // Labels: Labels associated with this Cloud Function. 289 Labels map[string]string `json:"labels,omitempty"` 290 291 // LatestOperation: Output only. Name of the most recent operation 292 // modifying the function. If 293 // the function status is `DEPLOYING` or `DELETING`, then it points to 294 // the 295 // active operation. 296 LatestOperation string `json:"latestOperation,omitempty"` 297 298 // MaxInstances: The limit on the maximum number of function instances 299 // that may coexist at a 300 // given time. 301 MaxInstances int64 `json:"maxInstances,omitempty"` 302 303 // Name: A user-defined name of the function. Function names must be 304 // unique 305 // globally and match pattern `projects/*/locations/*/functions/*` 306 Name string `json:"name,omitempty"` 307 308 // Network: The VPC Network that this cloud function can connect to. It 309 // can be 310 // either the fully-qualified URI, or the short name of the network 311 // resource. 312 // If the short network name is used, the network must belong to the 313 // same 314 // project. Otherwise, it must belong to a project within the 315 // same 316 // organization. The format of this field is 317 // either 318 // `projects/{project}/global/networks/{network}` or `{network}`, 319 // where 320 // {project} is a project id where the network is defined, and {network} 321 // is 322 // the short name of the network. 323 // 324 // This field is mutually exclusive with `vpc_connector` and will be 325 // replaced 326 // by it. 327 // 328 // See [the VPC 329 // documentation](https://cloud.google.com/compute/docs/vpc) for 330 // more information on connecting Cloud projects. 331 Network string `json:"network,omitempty"` 332 333 // Runtime: The runtime in which to run the function. Required when 334 // deploying a new 335 // function, optional when updating an existing function. For a 336 // complete 337 // list of possible choices, see the 338 // [`gcloud` 339 // command 340 // reference](/sdk/gcloud/reference/functions/deploy#--runtime). 341 Runtime string `json:"runtime,omitempty"` 342 343 // ServiceAccount: The email of the function's service account. If 344 // empty, defaults to 345 // `{project_id}@appspot.gserviceaccount.com`. 346 ServiceAccount string `json:"serviceAccount,omitempty"` 347 348 // SourceArchiveUrl: The Google Cloud Storage URL, starting with gs://, 349 // pointing to the zip 350 // archive which contains the function. 351 SourceArchiveUrl string `json:"sourceArchiveUrl,omitempty"` 352 353 // SourceRepository: The hosted repository where the function is 354 // defined. 355 SourceRepository *SourceRepository `json:"sourceRepository,omitempty"` 356 357 // SourceRepositoryUrl: The URL pointing to the hosted repository where 358 // the function is defined. 359 // There are supported Cloud Source Repository URLs in the 360 // following 361 // formats: 362 // 363 // To refer to a specific 364 // commit: 365 // `https://source.developers.google.com/projects/*/repos/*/revis 366 // ions/*/paths/*` 367 // To refer to a moveable alias 368 // (branch): 369 // `https://source.developers.google.com/projects/*/repos/*/mov 370 // eable-aliases/*/paths/*` 371 // In particular, to refer to HEAD use `master` moveable alias. 372 // To refer to a specific fixed alias 373 // (tag): 374 // `https://source.developers.google.com/projects/*/repos/*/fixed- 375 // aliases/*/paths/*` 376 // 377 // You may omit `paths/*` if you want to use the main directory. 378 SourceRepositoryUrl string `json:"sourceRepositoryUrl,omitempty"` 379 380 // SourceUploadUrl: The Google Cloud Storage signed URL used for source 381 // uploading, generated 382 // by google.cloud.functions.v1beta2.GenerateUploadUrl 383 SourceUploadUrl string `json:"sourceUploadUrl,omitempty"` 384 385 // Status: Output only. Status of the function deployment. 386 // 387 // Possible values: 388 // "STATUS_UNSPECIFIED" - Status not specified. 389 // "READY" - Successfully deployed. 390 // "FAILED" - Not deployed correctly - behavior is undefined. The item 391 // should be updated 392 // or deleted to move it out of this state. 393 // "DEPLOYING" - Creation or update in progress. 394 // "DELETING" - Deletion in progress. 395 Status string `json:"status,omitempty"` 396 397 // Timeout: The function execution timeout. Execution is considered 398 // failed and 399 // can be terminated if the function is not completed at the end of 400 // the 401 // timeout period. Defaults to 60 seconds. 402 Timeout string `json:"timeout,omitempty"` 403 404 // UpdateTime: Output only. The last update timestamp of a Cloud 405 // Function. 406 UpdateTime string `json:"updateTime,omitempty"` 407 408 // VersionId: Output only. The version identifier of the Cloud Function. 409 // Each deployment attempt 410 // results in a new version of a function being created. 411 VersionId int64 `json:"versionId,omitempty,string"` 412 413 // VpcConnector: The VPC Network Connector that this cloud function can 414 // connect to. It can 415 // be either the fully-qualified URI, or the short name of the 416 // network 417 // connector resource. The format of this field 418 // is 419 // `projects/*/locations/*/connectors/*` 420 // 421 // This field is mutually exclusive with `network` field and will 422 // eventually 423 // replace it. 424 // 425 // See [the VPC 426 // documentation](https://cloud.google.com/compute/docs/vpc) for 427 // more information on connecting Cloud projects. 428 VpcConnector string `json:"vpcConnector,omitempty"` 429 430 // ServerResponse contains the HTTP response code and headers from the 431 // server. 432 googleapi.ServerResponse `json:"-"` 433 434 // ForceSendFields is a list of field names (e.g. "AvailableMemoryMb") 435 // to unconditionally include in API requests. By default, fields with 436 // empty values are omitted from API requests. However, any non-pointer, 437 // non-interface field appearing in ForceSendFields will be sent to the 438 // server regardless of whether the field is empty or not. This may be 439 // used to include empty fields in Patch requests. 440 ForceSendFields []string `json:"-"` 441 442 // NullFields is a list of field names (e.g. "AvailableMemoryMb") to 443 // include in API requests with the JSON null value. By default, fields 444 // with empty values are omitted from API requests. However, any field 445 // with an empty value appearing in NullFields will be sent to the 446 // server as null. It is an error if a field in this list has a 447 // non-empty value. This may be used to include null fields in Patch 448 // requests. 449 NullFields []string `json:"-"` 450 } 451 452 func (s *CloudFunction) MarshalJSON() ([]byte, error) { 453 type NoMethod CloudFunction 454 raw := NoMethod(*s) 455 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 456 } 457 458 // EventTrigger: Describes EventTrigger, used to request events be sent 459 // from another 460 // service. 461 type EventTrigger struct { 462 // EventType: `event_type` names contain the service that is sending an 463 // event and the 464 // kind of event that was fired. Must be of the 465 // form 466 // `providers/*/eventTypes/*` e.g. Directly handle a Message published 467 // to 468 // Google Cloud Pub/Sub 469 // `providers/cloud.pubsub/eventTypes/topic.publish`. 470 // 471 // Handle an object changing in Google Cloud 472 // Storage: 473 // `providers/cloud.storage/eventTypes/object.change` 474 // 475 // Handle a write to the Firebase Realtime 476 // Database: 477 // `providers/google.firebase.database/eventTypes/ref.write` 478 EventType string `json:"eventType,omitempty"` 479 480 // FailurePolicy: Specifies policy for failed executions. 481 FailurePolicy *FailurePolicy `json:"failurePolicy,omitempty"` 482 483 // Resource: Which instance of the source's service should send events. 484 // E.g. for Pub/Sub 485 // this would be a Pub/Sub topic at `projects/*/topics/*`. For Google 486 // Cloud 487 // Storage this would be a bucket at `projects/*/buckets/*`. For any 488 // source 489 // that only supports one instance per-project, this should be the name 490 // of the 491 // project (`projects/*`) 492 Resource string `json:"resource,omitempty"` 493 494 // Service: The hostname of the service that should be observed. 495 // 496 // If no string is provided, the default service implementing the API 497 // will 498 // be used. For example, `storage.googleapis.com` is the default for 499 // all 500 // event types in the `google.storage` namespace. 501 Service string `json:"service,omitempty"` 502 503 // ForceSendFields is a list of field names (e.g. "EventType") to 504 // unconditionally include in API requests. By default, fields with 505 // empty values are omitted from API requests. However, any non-pointer, 506 // non-interface field appearing in ForceSendFields will be sent to the 507 // server regardless of whether the field is empty or not. This may be 508 // used to include empty fields in Patch requests. 509 ForceSendFields []string `json:"-"` 510 511 // NullFields is a list of field names (e.g. "EventType") to include in 512 // API requests with the JSON null value. By default, fields with empty 513 // values are omitted from API requests. However, any field with an 514 // empty value appearing in NullFields will be sent to the server as 515 // null. It is an error if a field in this list has a non-empty value. 516 // This may be used to include null fields in Patch requests. 517 NullFields []string `json:"-"` 518 } 519 520 func (s *EventTrigger) MarshalJSON() ([]byte, error) { 521 type NoMethod EventTrigger 522 raw := NoMethod(*s) 523 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 524 } 525 526 // FailurePolicy: Describes the policy in case of function's execution 527 // failure. 528 // If empty, then defaults to ignoring failures (i.e. not retrying 529 // them). 530 type FailurePolicy struct { 531 // Retry: If specified, then the function will be retried in case of a 532 // failure. 533 Retry *Retry `json:"retry,omitempty"` 534 535 // ForceSendFields is a list of field names (e.g. "Retry") to 536 // unconditionally include in API requests. By default, fields with 537 // empty values are omitted from API requests. However, any non-pointer, 538 // non-interface field appearing in ForceSendFields will be sent to the 539 // server regardless of whether the field is empty or not. This may be 540 // used to include empty fields in Patch requests. 541 ForceSendFields []string `json:"-"` 542 543 // NullFields is a list of field names (e.g. "Retry") to include in API 544 // requests with the JSON null value. By default, fields with empty 545 // values are omitted from API requests. However, any field with an 546 // empty value appearing in NullFields will be sent to the server as 547 // null. It is an error if a field in this list has a non-empty value. 548 // This may be used to include null fields in Patch requests. 549 NullFields []string `json:"-"` 550 } 551 552 func (s *FailurePolicy) MarshalJSON() ([]byte, error) { 553 type NoMethod FailurePolicy 554 raw := NoMethod(*s) 555 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 556 } 557 558 // GenerateDownloadUrlRequest: Request of `GenerateDownloadUrl` method. 559 type GenerateDownloadUrlRequest struct { 560 // VersionId: The optional version of function. 561 VersionId uint64 `json:"versionId,omitempty,string"` 562 563 // ForceSendFields is a list of field names (e.g. "VersionId") to 564 // unconditionally include in API requests. By default, fields with 565 // empty values are omitted from API requests. However, any non-pointer, 566 // non-interface field appearing in ForceSendFields will be sent to the 567 // server regardless of whether the field is empty or not. This may be 568 // used to include empty fields in Patch requests. 569 ForceSendFields []string `json:"-"` 570 571 // NullFields is a list of field names (e.g. "VersionId") to include in 572 // API requests with the JSON null value. By default, fields with empty 573 // values are omitted from API requests. However, any field with an 574 // empty value appearing in NullFields will be sent to the server as 575 // null. It is an error if a field in this list has a non-empty value. 576 // This may be used to include null fields in Patch requests. 577 NullFields []string `json:"-"` 578 } 579 580 func (s *GenerateDownloadUrlRequest) MarshalJSON() ([]byte, error) { 581 type NoMethod GenerateDownloadUrlRequest 582 raw := NoMethod(*s) 583 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 584 } 585 586 // GenerateDownloadUrlResponse: Response of `GenerateDownloadUrl` 587 // method. 588 type GenerateDownloadUrlResponse struct { 589 // DownloadUrl: The generated Google Cloud Storage signed URL that 590 // should be used for 591 // function source code download. 592 DownloadUrl string `json:"downloadUrl,omitempty"` 593 594 // ServerResponse contains the HTTP response code and headers from the 595 // server. 596 googleapi.ServerResponse `json:"-"` 597 598 // ForceSendFields is a list of field names (e.g. "DownloadUrl") to 599 // unconditionally include in API requests. By default, fields with 600 // empty values are omitted from API requests. However, any non-pointer, 601 // non-interface field appearing in ForceSendFields will be sent to the 602 // server regardless of whether the field is empty or not. This may be 603 // used to include empty fields in Patch requests. 604 ForceSendFields []string `json:"-"` 605 606 // NullFields is a list of field names (e.g. "DownloadUrl") to include 607 // in API requests with the JSON null value. By default, fields with 608 // empty values are omitted from API requests. However, any field with 609 // an empty value appearing in NullFields will be sent to the server as 610 // null. It is an error if a field in this list has a non-empty value. 611 // This may be used to include null fields in Patch requests. 612 NullFields []string `json:"-"` 613 } 614 615 func (s *GenerateDownloadUrlResponse) MarshalJSON() ([]byte, error) { 616 type NoMethod GenerateDownloadUrlResponse 617 raw := NoMethod(*s) 618 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 619 } 620 621 // GenerateUploadUrlRequest: Request of `GenerateUploadUrl` method. 622 type GenerateUploadUrlRequest struct { 623 } 624 625 // GenerateUploadUrlResponse: Response of `GenerateUploadUrl` method. 626 type GenerateUploadUrlResponse struct { 627 // UploadUrl: The generated Google Cloud Storage signed URL that should 628 // be used for a 629 // function source code upload. The uploaded file should be a zip 630 // archive 631 // which contains a function. 632 UploadUrl string `json:"uploadUrl,omitempty"` 633 634 // ServerResponse contains the HTTP response code and headers from the 635 // server. 636 googleapi.ServerResponse `json:"-"` 637 638 // ForceSendFields is a list of field names (e.g. "UploadUrl") to 639 // unconditionally include in API requests. By default, fields with 640 // empty values are omitted from API requests. However, any non-pointer, 641 // non-interface field appearing in ForceSendFields will be sent to the 642 // server regardless of whether the field is empty or not. This may be 643 // used to include empty fields in Patch requests. 644 ForceSendFields []string `json:"-"` 645 646 // NullFields is a list of field names (e.g. "UploadUrl") to include in 647 // API requests with the JSON null value. By default, fields with empty 648 // values are omitted from API requests. However, any field with an 649 // empty value appearing in NullFields will be sent to the server as 650 // null. It is an error if a field in this list has a non-empty value. 651 // This may be used to include null fields in Patch requests. 652 NullFields []string `json:"-"` 653 } 654 655 func (s *GenerateUploadUrlResponse) MarshalJSON() ([]byte, error) { 656 type NoMethod GenerateUploadUrlResponse 657 raw := NoMethod(*s) 658 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 659 } 660 661 // HTTPSTrigger: Describes HTTPSTrigger, could be used to connect web 662 // hooks to function. 663 type HTTPSTrigger struct { 664 // Url: Output only. The deployed url for the function. 665 Url string `json:"url,omitempty"` 666 667 // ForceSendFields is a list of field names (e.g. "Url") to 668 // unconditionally include in API requests. By default, fields with 669 // empty values are omitted from API requests. However, any non-pointer, 670 // non-interface field appearing in ForceSendFields will be sent to the 671 // server regardless of whether the field is empty or not. This may be 672 // used to include empty fields in Patch requests. 673 ForceSendFields []string `json:"-"` 674 675 // NullFields is a list of field names (e.g. "Url") to include in API 676 // requests with the JSON null value. By default, fields with empty 677 // values are omitted from API requests. However, any field with an 678 // empty value appearing in NullFields will be sent to the server as 679 // null. It is an error if a field in this list has a non-empty value. 680 // This may be used to include null fields in Patch requests. 681 NullFields []string `json:"-"` 682 } 683 684 func (s *HTTPSTrigger) MarshalJSON() ([]byte, error) { 685 type NoMethod HTTPSTrigger 686 raw := NoMethod(*s) 687 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 688 } 689 690 // ListFunctionsResponse: Response for the `ListFunctions` method. 691 type ListFunctionsResponse struct { 692 // Functions: The functions that match the request. 693 Functions []*CloudFunction `json:"functions,omitempty"` 694 695 // NextPageToken: If not empty, indicates that there may be more 696 // functions that match 697 // the request; this value should be passed in a 698 // new 699 // google.cloud.functions.v1beta2.ListFunctionsRequest 700 // to get more functions. 701 NextPageToken string `json:"nextPageToken,omitempty"` 702 703 // Unreachable: Locations that could not be reached. The response does 704 // not include any 705 // functions from these locations. 706 Unreachable []string `json:"unreachable,omitempty"` 707 708 // ServerResponse contains the HTTP response code and headers from the 709 // server. 710 googleapi.ServerResponse `json:"-"` 711 712 // ForceSendFields is a list of field names (e.g. "Functions") to 713 // unconditionally include in API requests. By default, fields with 714 // empty values are omitted from API requests. However, any non-pointer, 715 // non-interface field appearing in ForceSendFields will be sent to the 716 // server regardless of whether the field is empty or not. This may be 717 // used to include empty fields in Patch requests. 718 ForceSendFields []string `json:"-"` 719 720 // NullFields is a list of field names (e.g. "Functions") to include in 721 // API requests with the JSON null value. By default, fields with empty 722 // values are omitted from API requests. However, any field with an 723 // empty value appearing in NullFields will be sent to the server as 724 // null. It is an error if a field in this list has a non-empty value. 725 // This may be used to include null fields in Patch requests. 726 NullFields []string `json:"-"` 727 } 728 729 func (s *ListFunctionsResponse) MarshalJSON() ([]byte, error) { 730 type NoMethod ListFunctionsResponse 731 raw := NoMethod(*s) 732 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 733 } 734 735 // ListLocationsResponse: The response message for 736 // Locations.ListLocations. 737 type ListLocationsResponse struct { 738 // Locations: A list of locations that matches the specified filter in 739 // the request. 740 Locations []*Location `json:"locations,omitempty"` 741 742 // NextPageToken: The standard List next-page token. 743 NextPageToken string `json:"nextPageToken,omitempty"` 744 745 // ServerResponse contains the HTTP response code and headers from the 746 // server. 747 googleapi.ServerResponse `json:"-"` 748 749 // ForceSendFields is a list of field names (e.g. "Locations") to 750 // unconditionally include in API requests. By default, fields with 751 // empty values are omitted from API requests. However, any non-pointer, 752 // non-interface field appearing in ForceSendFields will be sent to the 753 // server regardless of whether the field is empty or not. This may be 754 // used to include empty fields in Patch requests. 755 ForceSendFields []string `json:"-"` 756 757 // NullFields is a list of field names (e.g. "Locations") to include in 758 // API requests with the JSON null value. By default, fields with empty 759 // values are omitted from API requests. However, any field with an 760 // empty value appearing in NullFields will be sent to the server as 761 // null. It is an error if a field in this list has a non-empty value. 762 // This may be used to include null fields in Patch requests. 763 NullFields []string `json:"-"` 764 } 765 766 func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) { 767 type NoMethod ListLocationsResponse 768 raw := NoMethod(*s) 769 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 770 } 771 772 // ListOperationsResponse: The response message for 773 // Operations.ListOperations. 774 type ListOperationsResponse struct { 775 // NextPageToken: The standard List next-page token. 776 NextPageToken string `json:"nextPageToken,omitempty"` 777 778 // Operations: A list of operations that matches the specified filter in 779 // the request. 780 Operations []*Operation `json:"operations,omitempty"` 781 782 // ServerResponse contains the HTTP response code and headers from the 783 // server. 784 googleapi.ServerResponse `json:"-"` 785 786 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 787 // unconditionally include in API requests. By default, fields with 788 // empty values are omitted from API requests. However, any non-pointer, 789 // non-interface field appearing in ForceSendFields will be sent to the 790 // server regardless of whether the field is empty or not. This may be 791 // used to include empty fields in Patch requests. 792 ForceSendFields []string `json:"-"` 793 794 // NullFields is a list of field names (e.g. "NextPageToken") to include 795 // in API requests with the JSON null value. By default, fields with 796 // empty values are omitted from API requests. However, any field with 797 // an empty value appearing in NullFields will be sent to the server as 798 // null. It is an error if a field in this list has a non-empty value. 799 // This may be used to include null fields in Patch requests. 800 NullFields []string `json:"-"` 801 } 802 803 func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) { 804 type NoMethod ListOperationsResponse 805 raw := NoMethod(*s) 806 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 807 } 808 809 // Location: A resource that represents Google Cloud Platform location. 810 type Location struct { 811 // DisplayName: The friendly name for this location, typically a nearby 812 // city name. 813 // For example, "Tokyo". 814 DisplayName string `json:"displayName,omitempty"` 815 816 // Labels: Cross-service attributes for the location. For example 817 // 818 // {"cloud.googleapis.com/region": "us-east1"} 819 Labels map[string]string `json:"labels,omitempty"` 820 821 // LocationId: The canonical id for this location. For example: 822 // "us-east1". 823 LocationId string `json:"locationId,omitempty"` 824 825 // Metadata: Service-specific metadata. For example the available 826 // capacity at the given 827 // location. 828 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 829 830 // Name: Resource name for the location, which may vary between 831 // implementations. 832 // For example: "projects/example-project/locations/us-east1" 833 Name string `json:"name,omitempty"` 834 835 // ForceSendFields is a list of field names (e.g. "DisplayName") to 836 // unconditionally include in API requests. By default, fields with 837 // empty values are omitted from API requests. However, any non-pointer, 838 // non-interface field appearing in ForceSendFields will be sent to the 839 // server regardless of whether the field is empty or not. This may be 840 // used to include empty fields in Patch requests. 841 ForceSendFields []string `json:"-"` 842 843 // NullFields is a list of field names (e.g. "DisplayName") to include 844 // in API requests with the JSON null value. By default, fields with 845 // empty values are omitted from API requests. However, any field with 846 // an empty value appearing in NullFields will be sent to the server as 847 // null. It is an error if a field in this list has a non-empty value. 848 // This may be used to include null fields in Patch requests. 849 NullFields []string `json:"-"` 850 } 851 852 func (s *Location) MarshalJSON() ([]byte, error) { 853 type NoMethod Location 854 raw := NoMethod(*s) 855 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 856 } 857 858 // Operation: This resource represents a long-running operation that is 859 // the result of a 860 // network API call. 861 type Operation struct { 862 // Done: If the value is `false`, it means the operation is still in 863 // progress. 864 // If `true`, the operation is completed, and either `error` or 865 // `response` is 866 // available. 867 Done bool `json:"done,omitempty"` 868 869 // Error: The error result of the operation in case of failure or 870 // cancellation. 871 Error *Status `json:"error,omitempty"` 872 873 // Metadata: Service-specific metadata associated with the operation. 874 // It typically 875 // contains progress information and common metadata such as create 876 // time. 877 // Some services might not provide such metadata. Any method that 878 // returns a 879 // long-running operation should document the metadata type, if any. 880 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 881 882 // Name: The server-assigned name, which is only unique within the same 883 // service that 884 // originally returns it. If you use the default HTTP mapping, 885 // the 886 // `name` should be a resource name ending with 887 // `operations/{unique_id}`. 888 Name string `json:"name,omitempty"` 889 890 // Response: The normal response of the operation in case of success. 891 // If the original 892 // method returns no data on success, such as `Delete`, the response 893 // is 894 // `google.protobuf.Empty`. If the original method is 895 // standard 896 // `Get`/`Create`/`Update`, the response should be the resource. For 897 // other 898 // methods, the response should have the type `XxxResponse`, where 899 // `Xxx` 900 // is the original method name. For example, if the original method 901 // name 902 // is `TakeSnapshot()`, the inferred response type 903 // is 904 // `TakeSnapshotResponse`. 905 Response googleapi.RawMessage `json:"response,omitempty"` 906 907 // ServerResponse contains the HTTP response code and headers from the 908 // server. 909 googleapi.ServerResponse `json:"-"` 910 911 // ForceSendFields is a list of field names (e.g. "Done") to 912 // unconditionally include in API requests. By default, fields with 913 // empty values are omitted from API requests. However, any non-pointer, 914 // non-interface field appearing in ForceSendFields will be sent to the 915 // server regardless of whether the field is empty or not. This may be 916 // used to include empty fields in Patch requests. 917 ForceSendFields []string `json:"-"` 918 919 // NullFields is a list of field names (e.g. "Done") to include in API 920 // requests with the JSON null value. By default, fields with empty 921 // values are omitted from API requests. However, any field with an 922 // empty value appearing in NullFields will be sent to the server as 923 // null. It is an error if a field in this list has a non-empty value. 924 // This may be used to include null fields in Patch requests. 925 NullFields []string `json:"-"` 926 } 927 928 func (s *Operation) MarshalJSON() ([]byte, error) { 929 type NoMethod Operation 930 raw := NoMethod(*s) 931 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 932 } 933 934 // OperationMetadataV1: Metadata describing an Operation 935 type OperationMetadataV1 struct { 936 // BuildId: The Cloud Build ID of the function created or updated by an 937 // API call. 938 // This field is only populated for Create and Update operations. 939 BuildId string `json:"buildId,omitempty"` 940 941 // Request: The original request that started the operation. 942 Request googleapi.RawMessage `json:"request,omitempty"` 943 944 // Target: Target of the operation - for 945 // example 946 // projects/project-1/locations/region-1/functions/function-1 947 Target string `json:"target,omitempty"` 948 949 // Type: Type of operation. 950 // 951 // Possible values: 952 // "OPERATION_UNSPECIFIED" - Unknown operation type. 953 // "CREATE_FUNCTION" - Triggered by CreateFunction call 954 // "UPDATE_FUNCTION" - Triggered by UpdateFunction call 955 // "DELETE_FUNCTION" - Triggered by DeleteFunction call. 956 Type string `json:"type,omitempty"` 957 958 // UpdateTime: The last update timestamp of the operation. 959 UpdateTime string `json:"updateTime,omitempty"` 960 961 // VersionId: Version id of the function created or updated by an API 962 // call. 963 // This field is only populated for Create and Update operations. 964 VersionId int64 `json:"versionId,omitempty,string"` 965 966 // ForceSendFields is a list of field names (e.g. "BuildId") to 967 // unconditionally include in API requests. By default, fields with 968 // empty values are omitted from API requests. However, any non-pointer, 969 // non-interface field appearing in ForceSendFields will be sent to the 970 // server regardless of whether the field is empty or not. This may be 971 // used to include empty fields in Patch requests. 972 ForceSendFields []string `json:"-"` 973 974 // NullFields is a list of field names (e.g. "BuildId") to include in 975 // API requests with the JSON null value. By default, fields with empty 976 // values are omitted from API requests. However, any field with an 977 // empty value appearing in NullFields will be sent to the server as 978 // null. It is an error if a field in this list has a non-empty value. 979 // This may be used to include null fields in Patch requests. 980 NullFields []string `json:"-"` 981 } 982 983 func (s *OperationMetadataV1) MarshalJSON() ([]byte, error) { 984 type NoMethod OperationMetadataV1 985 raw := NoMethod(*s) 986 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 987 } 988 989 // OperationMetadataV1Beta2: Metadata describing an Operation 990 type OperationMetadataV1Beta2 struct { 991 // Request: The original request that started the operation. 992 Request googleapi.RawMessage `json:"request,omitempty"` 993 994 // Target: Target of the operation - for 995 // example 996 // projects/project-1/locations/region-1/functions/function-1 997 Target string `json:"target,omitempty"` 998 999 // Type: Type of operation. 1000 // 1001 // Possible values: 1002 // "OPERATION_UNSPECIFIED" - Unknown operation type. 1003 // "CREATE_FUNCTION" - Triggered by CreateFunction call 1004 // "UPDATE_FUNCTION" - Triggered by UpdateFunction call 1005 // "DELETE_FUNCTION" - Triggered by DeleteFunction call. 1006 Type string `json:"type,omitempty"` 1007 1008 // UpdateTime: The last update timestamp of the operation. 1009 UpdateTime string `json:"updateTime,omitempty"` 1010 1011 // VersionId: Version id of the function created or updated by an API 1012 // call. 1013 // This field is only populated for Create and Update operations. 1014 VersionId int64 `json:"versionId,omitempty,string"` 1015 1016 // ForceSendFields is a list of field names (e.g. "Request") to 1017 // unconditionally include in API requests. By default, fields with 1018 // empty values are omitted from API requests. However, any non-pointer, 1019 // non-interface field appearing in ForceSendFields will be sent to the 1020 // server regardless of whether the field is empty or not. This may be 1021 // used to include empty fields in Patch requests. 1022 ForceSendFields []string `json:"-"` 1023 1024 // NullFields is a list of field names (e.g. "Request") to include in 1025 // API requests with the JSON null value. By default, fields with empty 1026 // values are omitted from API requests. However, any field with an 1027 // empty value appearing in NullFields will be sent to the server as 1028 // null. It is an error if a field in this list has a non-empty value. 1029 // This may be used to include null fields in Patch requests. 1030 NullFields []string `json:"-"` 1031 } 1032 1033 func (s *OperationMetadataV1Beta2) MarshalJSON() ([]byte, error) { 1034 type NoMethod OperationMetadataV1Beta2 1035 raw := NoMethod(*s) 1036 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1037 } 1038 1039 // Retry: Describes the retry policy in case of function's execution 1040 // failure. 1041 // A function execution will be retried on any failure. 1042 // A failed execution will be retried up to 7 days with an exponential 1043 // backoff 1044 // (capped at 10 seconds). 1045 // Retried execution is charged as any other execution. 1046 type Retry struct { 1047 } 1048 1049 // SourceRepository: Describes the location of the function source in a 1050 // remote repository. 1051 type SourceRepository struct { 1052 // Branch: The name of the branch from which the function should be 1053 // fetched. 1054 Branch string `json:"branch,omitempty"` 1055 1056 // DeployedRevision: Output only. The id of the revision that was 1057 // resolved at the moment of 1058 // function creation or update. For example when a user deployed from 1059 // a 1060 // branch, it will be the revision id of the latest change on this 1061 // branch at 1062 // that time. If user deployed from revision then this value will be 1063 // always 1064 // equal to the revision specified by the user. 1065 DeployedRevision string `json:"deployedRevision,omitempty"` 1066 1067 // RepositoryUrl: URL to the hosted repository where the function is 1068 // defined. Only paths in 1069 // https://source.developers.google.com domain are supported. The path 1070 // should 1071 // contain the name of the repository. 1072 RepositoryUrl string `json:"repositoryUrl,omitempty"` 1073 1074 // Revision: The id of the revision that captures the state of the 1075 // repository from 1076 // which the function should be fetched. 1077 Revision string `json:"revision,omitempty"` 1078 1079 // SourcePath: The path within the repository where the function is 1080 // defined. The path 1081 // should point to the directory where Cloud Functions files are 1082 // located. Use 1083 // "/" if the function is defined directly in the root directory of 1084 // a 1085 // repository. 1086 SourcePath string `json:"sourcePath,omitempty"` 1087 1088 // Tag: The name of the tag that captures the state of the repository 1089 // from 1090 // which the function should be fetched. 1091 Tag string `json:"tag,omitempty"` 1092 1093 // ForceSendFields is a list of field names (e.g. "Branch") to 1094 // unconditionally include in API requests. By default, fields with 1095 // empty values are omitted from API requests. However, any non-pointer, 1096 // non-interface field appearing in ForceSendFields will be sent to the 1097 // server regardless of whether the field is empty or not. This may be 1098 // used to include empty fields in Patch requests. 1099 ForceSendFields []string `json:"-"` 1100 1101 // NullFields is a list of field names (e.g. "Branch") to include in API 1102 // requests with the JSON null value. By default, fields with empty 1103 // values are omitted from API requests. However, any field with an 1104 // empty value appearing in NullFields will be sent to the server as 1105 // null. It is an error if a field in this list has a non-empty value. 1106 // This may be used to include null fields in Patch requests. 1107 NullFields []string `json:"-"` 1108 } 1109 1110 func (s *SourceRepository) MarshalJSON() ([]byte, error) { 1111 type NoMethod SourceRepository 1112 raw := NoMethod(*s) 1113 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1114 } 1115 1116 // Status: The `Status` type defines a logical error model that is 1117 // suitable for 1118 // different programming environments, including REST APIs and RPC APIs. 1119 // It is 1120 // used by [gRPC](https://github.com/grpc). Each `Status` message 1121 // contains 1122 // three pieces of data: error code, error message, and error 1123 // details. 1124 // 1125 // You can find out more about this error model and how to work with it 1126 // in the 1127 // [API Design Guide](https://cloud.google.com/apis/design/errors). 1128 type Status struct { 1129 // Code: The status code, which should be an enum value of 1130 // google.rpc.Code. 1131 Code int64 `json:"code,omitempty"` 1132 1133 // Details: A list of messages that carry the error details. There is a 1134 // common set of 1135 // message types for APIs to use. 1136 Details []googleapi.RawMessage `json:"details,omitempty"` 1137 1138 // Message: A developer-facing error message, which should be in 1139 // English. Any 1140 // user-facing error message should be localized and sent in 1141 // the 1142 // google.rpc.Status.details field, or localized by the client. 1143 Message string `json:"message,omitempty"` 1144 1145 // ForceSendFields is a list of field names (e.g. "Code") to 1146 // unconditionally include in API requests. By default, fields with 1147 // empty values are omitted from API requests. However, any non-pointer, 1148 // non-interface field appearing in ForceSendFields will be sent to the 1149 // server regardless of whether the field is empty or not. This may be 1150 // used to include empty fields in Patch requests. 1151 ForceSendFields []string `json:"-"` 1152 1153 // NullFields is a list of field names (e.g. "Code") to include in API 1154 // requests with the JSON null value. By default, fields with empty 1155 // values are omitted from API requests. However, any field with an 1156 // empty value appearing in NullFields will be sent to the server as 1157 // null. It is an error if a field in this list has a non-empty value. 1158 // This may be used to include null fields in Patch requests. 1159 NullFields []string `json:"-"` 1160 } 1161 1162 func (s *Status) MarshalJSON() ([]byte, error) { 1163 type NoMethod Status 1164 raw := NoMethod(*s) 1165 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1166 } 1167 1168 // method id "cloudfunctions.operations.get": 1169 1170 type OperationsGetCall struct { 1171 s *Service 1172 name string 1173 urlParams_ gensupport.URLParams 1174 ifNoneMatch_ string 1175 ctx_ context.Context 1176 header_ http.Header 1177 } 1178 1179 // Get: Gets the latest state of a long-running operation. Clients can 1180 // use this 1181 // method to poll the operation result at intervals as recommended by 1182 // the API 1183 // service. 1184 func (r *OperationsService) Get(name string) *OperationsGetCall { 1185 c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1186 c.name = name 1187 return c 1188 } 1189 1190 // Fields allows partial responses to be retrieved. See 1191 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1192 // for more information. 1193 func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall { 1194 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1195 return c 1196 } 1197 1198 // IfNoneMatch sets the optional parameter which makes the operation 1199 // fail if the object's ETag matches the given value. This is useful for 1200 // getting updates only after the object has changed since the last 1201 // request. Use googleapi.IsNotModified to check whether the response 1202 // error from Do is the result of In-None-Match. 1203 func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall { 1204 c.ifNoneMatch_ = entityTag 1205 return c 1206 } 1207 1208 // Context sets the context to be used in this call's Do method. Any 1209 // pending HTTP request will be aborted if the provided context is 1210 // canceled. 1211 func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall { 1212 c.ctx_ = ctx 1213 return c 1214 } 1215 1216 // Header returns an http.Header that can be modified by the caller to 1217 // add HTTP headers to the request. 1218 func (c *OperationsGetCall) Header() http.Header { 1219 if c.header_ == nil { 1220 c.header_ = make(http.Header) 1221 } 1222 return c.header_ 1223 } 1224 1225 func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) { 1226 reqHeaders := make(http.Header) 1227 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 1228 for k, v := range c.header_ { 1229 reqHeaders[k] = v 1230 } 1231 reqHeaders.Set("User-Agent", c.s.userAgent()) 1232 if c.ifNoneMatch_ != "" { 1233 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1234 } 1235 var body io.Reader = nil 1236 c.urlParams_.Set("alt", alt) 1237 c.urlParams_.Set("prettyPrint", "false") 1238 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}") 1239 urls += "?" + c.urlParams_.Encode() 1240 req, err := http.NewRequest("GET", urls, body) 1241 if err != nil { 1242 return nil, err 1243 } 1244 req.Header = reqHeaders 1245 googleapi.Expand(req.URL, map[string]string{ 1246 "name": c.name, 1247 }) 1248 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1249 } 1250 1251 // Do executes the "cloudfunctions.operations.get" call. 1252 // Exactly one of *Operation or error will be non-nil. Any non-2xx 1253 // status code is an error. Response headers are in either 1254 // *Operation.ServerResponse.Header or (if a response was returned at 1255 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1256 // to check whether the returned error was because 1257 // http.StatusNotModified was returned. 1258 func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1259 gensupport.SetOptions(c.urlParams_, opts...) 1260 res, err := c.doRequest("json") 1261 if res != nil && res.StatusCode == http.StatusNotModified { 1262 if res.Body != nil { 1263 res.Body.Close() 1264 } 1265 return nil, &googleapi.Error{ 1266 Code: res.StatusCode, 1267 Header: res.Header, 1268 } 1269 } 1270 if err != nil { 1271 return nil, err 1272 } 1273 defer googleapi.CloseBody(res) 1274 if err := googleapi.CheckResponse(res); err != nil { 1275 return nil, err 1276 } 1277 ret := &Operation{ 1278 ServerResponse: googleapi.ServerResponse{ 1279 Header: res.Header, 1280 HTTPStatusCode: res.StatusCode, 1281 }, 1282 } 1283 target := &ret 1284 if err := gensupport.DecodeResponse(target, res); err != nil { 1285 return nil, err 1286 } 1287 return ret, nil 1288 // { 1289 // "description": "Gets the latest state of a long-running operation. Clients can use this\nmethod to poll the operation result at intervals as recommended by the API\nservice.", 1290 // "flatPath": "v1beta2/operations/{operationsId}", 1291 // "httpMethod": "GET", 1292 // "id": "cloudfunctions.operations.get", 1293 // "parameterOrder": [ 1294 // "name" 1295 // ], 1296 // "parameters": { 1297 // "name": { 1298 // "description": "The name of the operation resource.", 1299 // "location": "path", 1300 // "pattern": "^operations/[^/]+$", 1301 // "required": true, 1302 // "type": "string" 1303 // } 1304 // }, 1305 // "path": "v1beta2/{+name}", 1306 // "response": { 1307 // "$ref": "Operation" 1308 // }, 1309 // "scopes": [ 1310 // "https://www.googleapis.com/auth/cloud-platform" 1311 // ] 1312 // } 1313 1314 } 1315 1316 // method id "cloudfunctions.operations.list": 1317 1318 type OperationsListCall struct { 1319 s *Service 1320 urlParams_ gensupport.URLParams 1321 ifNoneMatch_ string 1322 ctx_ context.Context 1323 header_ http.Header 1324 } 1325 1326 // List: Lists operations that match the specified filter in the 1327 // request. If the 1328 // server doesn't support this method, it returns 1329 // `UNIMPLEMENTED`. 1330 // 1331 // NOTE: the `name` binding allows API services to override the 1332 // binding 1333 // to use different resource name schemes, such as `users/*/operations`. 1334 // To 1335 // override the binding, API services can add a binding such 1336 // as 1337 // "/v1/{name=users/*}/operations" to their service configuration. 1338 // For backwards compatibility, the default name includes the 1339 // operations 1340 // collection id, however overriding users must ensure the name 1341 // binding 1342 // is the parent resource, without the operations collection id. 1343 func (r *OperationsService) List() *OperationsListCall { 1344 c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1345 return c 1346 } 1347 1348 // Filter sets the optional parameter "filter": Required. A filter for 1349 // matching the requested operations.<br><br> The supported formats of 1350 // <b>filter</b> are:<br> To query for a specific function: 1351 // <code>project:*,location:*,function:*</code><br> To query for all of 1352 // the latest operations for a project: 1353 // <code>project:*,latest:true</code> 1354 func (c *OperationsListCall) Filter(filter string) *OperationsListCall { 1355 c.urlParams_.Set("filter", filter) 1356 return c 1357 } 1358 1359 // Name sets the optional parameter "name": Must not be set. 1360 func (c *OperationsListCall) Name(name string) *OperationsListCall { 1361 c.urlParams_.Set("name", name) 1362 return c 1363 } 1364 1365 // PageSize sets the optional parameter "pageSize": The maximum number 1366 // of records that should be returned.<br> Requested page size cannot 1367 // exceed 100. If not set, the default page size is 100.<br><br> 1368 // Pagination is only supported when querying for a specific function. 1369 func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall { 1370 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1371 return c 1372 } 1373 1374 // PageToken sets the optional parameter "pageToken": Token identifying 1375 // which result to start with, which is returned by a previous list 1376 // call.<br><br> Pagination is only supported when querying for a 1377 // specific function. 1378 func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall { 1379 c.urlParams_.Set("pageToken", pageToken) 1380 return c 1381 } 1382 1383 // Fields allows partial responses to be retrieved. See 1384 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1385 // for more information. 1386 func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall { 1387 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1388 return c 1389 } 1390 1391 // IfNoneMatch sets the optional parameter which makes the operation 1392 // fail if the object's ETag matches the given value. This is useful for 1393 // getting updates only after the object has changed since the last 1394 // request. Use googleapi.IsNotModified to check whether the response 1395 // error from Do is the result of In-None-Match. 1396 func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall { 1397 c.ifNoneMatch_ = entityTag 1398 return c 1399 } 1400 1401 // Context sets the context to be used in this call's Do method. Any 1402 // pending HTTP request will be aborted if the provided context is 1403 // canceled. 1404 func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall { 1405 c.ctx_ = ctx 1406 return c 1407 } 1408 1409 // Header returns an http.Header that can be modified by the caller to 1410 // add HTTP headers to the request. 1411 func (c *OperationsListCall) Header() http.Header { 1412 if c.header_ == nil { 1413 c.header_ = make(http.Header) 1414 } 1415 return c.header_ 1416 } 1417 1418 func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) { 1419 reqHeaders := make(http.Header) 1420 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 1421 for k, v := range c.header_ { 1422 reqHeaders[k] = v 1423 } 1424 reqHeaders.Set("User-Agent", c.s.userAgent()) 1425 if c.ifNoneMatch_ != "" { 1426 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1427 } 1428 var body io.Reader = nil 1429 c.urlParams_.Set("alt", alt) 1430 c.urlParams_.Set("prettyPrint", "false") 1431 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/operations") 1432 urls += "?" + c.urlParams_.Encode() 1433 req, err := http.NewRequest("GET", urls, body) 1434 if err != nil { 1435 return nil, err 1436 } 1437 req.Header = reqHeaders 1438 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1439 } 1440 1441 // Do executes the "cloudfunctions.operations.list" call. 1442 // Exactly one of *ListOperationsResponse or error will be non-nil. Any 1443 // non-2xx status code is an error. Response headers are in either 1444 // *ListOperationsResponse.ServerResponse.Header or (if a response was 1445 // returned at all) in error.(*googleapi.Error).Header. Use 1446 // googleapi.IsNotModified to check whether the returned error was 1447 // because http.StatusNotModified was returned. 1448 func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) { 1449 gensupport.SetOptions(c.urlParams_, opts...) 1450 res, err := c.doRequest("json") 1451 if res != nil && res.StatusCode == http.StatusNotModified { 1452 if res.Body != nil { 1453 res.Body.Close() 1454 } 1455 return nil, &googleapi.Error{ 1456 Code: res.StatusCode, 1457 Header: res.Header, 1458 } 1459 } 1460 if err != nil { 1461 return nil, err 1462 } 1463 defer googleapi.CloseBody(res) 1464 if err := googleapi.CheckResponse(res); err != nil { 1465 return nil, err 1466 } 1467 ret := &ListOperationsResponse{ 1468 ServerResponse: googleapi.ServerResponse{ 1469 Header: res.Header, 1470 HTTPStatusCode: res.StatusCode, 1471 }, 1472 } 1473 target := &ret 1474 if err := gensupport.DecodeResponse(target, res); err != nil { 1475 return nil, err 1476 } 1477 return ret, nil 1478 // { 1479 // "description": "Lists operations that match the specified filter in the request. If the\nserver doesn't support this method, it returns `UNIMPLEMENTED`.\n\nNOTE: the `name` binding allows API services to override the binding\nto use different resource name schemes, such as `users/*/operations`. To\noverride the binding, API services can add a binding such as\n`\"/v1/{name=users/*}/operations\"` to their service configuration.\nFor backwards compatibility, the default name includes the operations\ncollection id, however overriding users must ensure the name binding\nis the parent resource, without the operations collection id.", 1480 // "flatPath": "v1beta2/operations", 1481 // "httpMethod": "GET", 1482 // "id": "cloudfunctions.operations.list", 1483 // "parameterOrder": [], 1484 // "parameters": { 1485 // "filter": { 1486 // "description": "Required. A filter for matching the requested operations.\u003cbr\u003e\u003cbr\u003e The supported formats of \u003cb\u003efilter\u003c/b\u003e are:\u003cbr\u003e To query for a specific function: \u003ccode\u003eproject:*,location:*,function:*\u003c/code\u003e\u003cbr\u003e To query for all of the latest operations for a project: \u003ccode\u003eproject:*,latest:true\u003c/code\u003e", 1487 // "location": "query", 1488 // "type": "string" 1489 // }, 1490 // "name": { 1491 // "description": "Must not be set.", 1492 // "location": "query", 1493 // "type": "string" 1494 // }, 1495 // "pageSize": { 1496 // "description": "The maximum number of records that should be returned.\u003cbr\u003e Requested page size cannot exceed 100. If not set, the default page size is 100.\u003cbr\u003e\u003cbr\u003e Pagination is only supported when querying for a specific function.", 1497 // "format": "int32", 1498 // "location": "query", 1499 // "type": "integer" 1500 // }, 1501 // "pageToken": { 1502 // "description": "Token identifying which result to start with, which is returned by a previous list call.\u003cbr\u003e\u003cbr\u003e Pagination is only supported when querying for a specific function.", 1503 // "location": "query", 1504 // "type": "string" 1505 // } 1506 // }, 1507 // "path": "v1beta2/operations", 1508 // "response": { 1509 // "$ref": "ListOperationsResponse" 1510 // }, 1511 // "scopes": [ 1512 // "https://www.googleapis.com/auth/cloud-platform" 1513 // ] 1514 // } 1515 1516 } 1517 1518 // Pages invokes f for each page of results. 1519 // A non-nil error returned from f will halt the iteration. 1520 // The provided context supersedes any context provided to the Context method. 1521 func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error { 1522 c.ctx_ = ctx 1523 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1524 for { 1525 x, err := c.Do() 1526 if err != nil { 1527 return err 1528 } 1529 if err := f(x); err != nil { 1530 return err 1531 } 1532 if x.NextPageToken == "" { 1533 return nil 1534 } 1535 c.PageToken(x.NextPageToken) 1536 } 1537 } 1538 1539 // method id "cloudfunctions.projects.locations.list": 1540 1541 type ProjectsLocationsListCall struct { 1542 s *Service 1543 name string 1544 urlParams_ gensupport.URLParams 1545 ifNoneMatch_ string 1546 ctx_ context.Context 1547 header_ http.Header 1548 } 1549 1550 // List: Lists information about the supported locations for this 1551 // service. 1552 func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall { 1553 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1554 c.name = name 1555 return c 1556 } 1557 1558 // Filter sets the optional parameter "filter": The standard list 1559 // filter. 1560 func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall { 1561 c.urlParams_.Set("filter", filter) 1562 return c 1563 } 1564 1565 // PageSize sets the optional parameter "pageSize": The standard list 1566 // page size. 1567 func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall { 1568 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1569 return c 1570 } 1571 1572 // PageToken sets the optional parameter "pageToken": The standard list 1573 // page token. 1574 func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall { 1575 c.urlParams_.Set("pageToken", pageToken) 1576 return c 1577 } 1578 1579 // Fields allows partial responses to be retrieved. See 1580 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1581 // for more information. 1582 func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall { 1583 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1584 return c 1585 } 1586 1587 // IfNoneMatch sets the optional parameter which makes the operation 1588 // fail if the object's ETag matches the given value. This is useful for 1589 // getting updates only after the object has changed since the last 1590 // request. Use googleapi.IsNotModified to check whether the response 1591 // error from Do is the result of In-None-Match. 1592 func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall { 1593 c.ifNoneMatch_ = entityTag 1594 return c 1595 } 1596 1597 // Context sets the context to be used in this call's Do method. Any 1598 // pending HTTP request will be aborted if the provided context is 1599 // canceled. 1600 func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall { 1601 c.ctx_ = ctx 1602 return c 1603 } 1604 1605 // Header returns an http.Header that can be modified by the caller to 1606 // add HTTP headers to the request. 1607 func (c *ProjectsLocationsListCall) Header() http.Header { 1608 if c.header_ == nil { 1609 c.header_ = make(http.Header) 1610 } 1611 return c.header_ 1612 } 1613 1614 func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) { 1615 reqHeaders := make(http.Header) 1616 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 1617 for k, v := range c.header_ { 1618 reqHeaders[k] = v 1619 } 1620 reqHeaders.Set("User-Agent", c.s.userAgent()) 1621 if c.ifNoneMatch_ != "" { 1622 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1623 } 1624 var body io.Reader = nil 1625 c.urlParams_.Set("alt", alt) 1626 c.urlParams_.Set("prettyPrint", "false") 1627 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}/locations") 1628 urls += "?" + c.urlParams_.Encode() 1629 req, err := http.NewRequest("GET", urls, body) 1630 if err != nil { 1631 return nil, err 1632 } 1633 req.Header = reqHeaders 1634 googleapi.Expand(req.URL, map[string]string{ 1635 "name": c.name, 1636 }) 1637 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1638 } 1639 1640 // Do executes the "cloudfunctions.projects.locations.list" call. 1641 // Exactly one of *ListLocationsResponse or error will be non-nil. Any 1642 // non-2xx status code is an error. Response headers are in either 1643 // *ListLocationsResponse.ServerResponse.Header or (if a response was 1644 // returned at all) in error.(*googleapi.Error).Header. Use 1645 // googleapi.IsNotModified to check whether the returned error was 1646 // because http.StatusNotModified was returned. 1647 func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) { 1648 gensupport.SetOptions(c.urlParams_, opts...) 1649 res, err := c.doRequest("json") 1650 if res != nil && res.StatusCode == http.StatusNotModified { 1651 if res.Body != nil { 1652 res.Body.Close() 1653 } 1654 return nil, &googleapi.Error{ 1655 Code: res.StatusCode, 1656 Header: res.Header, 1657 } 1658 } 1659 if err != nil { 1660 return nil, err 1661 } 1662 defer googleapi.CloseBody(res) 1663 if err := googleapi.CheckResponse(res); err != nil { 1664 return nil, err 1665 } 1666 ret := &ListLocationsResponse{ 1667 ServerResponse: googleapi.ServerResponse{ 1668 Header: res.Header, 1669 HTTPStatusCode: res.StatusCode, 1670 }, 1671 } 1672 target := &ret 1673 if err := gensupport.DecodeResponse(target, res); err != nil { 1674 return nil, err 1675 } 1676 return ret, nil 1677 // { 1678 // "description": "Lists information about the supported locations for this service.", 1679 // "flatPath": "v1beta2/projects/{projectsId}/locations", 1680 // "httpMethod": "GET", 1681 // "id": "cloudfunctions.projects.locations.list", 1682 // "parameterOrder": [ 1683 // "name" 1684 // ], 1685 // "parameters": { 1686 // "filter": { 1687 // "description": "The standard list filter.", 1688 // "location": "query", 1689 // "type": "string" 1690 // }, 1691 // "name": { 1692 // "description": "The resource that owns the locations collection, if applicable.", 1693 // "location": "path", 1694 // "pattern": "^projects/[^/]+$", 1695 // "required": true, 1696 // "type": "string" 1697 // }, 1698 // "pageSize": { 1699 // "description": "The standard list page size.", 1700 // "format": "int32", 1701 // "location": "query", 1702 // "type": "integer" 1703 // }, 1704 // "pageToken": { 1705 // "description": "The standard list page token.", 1706 // "location": "query", 1707 // "type": "string" 1708 // } 1709 // }, 1710 // "path": "v1beta2/{+name}/locations", 1711 // "response": { 1712 // "$ref": "ListLocationsResponse" 1713 // }, 1714 // "scopes": [ 1715 // "https://www.googleapis.com/auth/cloud-platform" 1716 // ] 1717 // } 1718 1719 } 1720 1721 // Pages invokes f for each page of results. 1722 // A non-nil error returned from f will halt the iteration. 1723 // The provided context supersedes any context provided to the Context method. 1724 func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error { 1725 c.ctx_ = ctx 1726 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1727 for { 1728 x, err := c.Do() 1729 if err != nil { 1730 return err 1731 } 1732 if err := f(x); err != nil { 1733 return err 1734 } 1735 if x.NextPageToken == "" { 1736 return nil 1737 } 1738 c.PageToken(x.NextPageToken) 1739 } 1740 } 1741 1742 // method id "cloudfunctions.projects.locations.functions.call": 1743 1744 type ProjectsLocationsFunctionsCallCall struct { 1745 s *Service 1746 name string 1747 callfunctionrequest *CallFunctionRequest 1748 urlParams_ gensupport.URLParams 1749 ctx_ context.Context 1750 header_ http.Header 1751 } 1752 1753 // Call: Synchronously invokes a deployed Cloud Function. To be used for 1754 // testing 1755 // purposes as very limited traffic is allowed. For more information 1756 // on 1757 // the actual limits refer to [API 1758 // Calls]( 1759 // https://cloud.google.com/functions/quotas#rate_limits). 1760 func (r *ProjectsLocationsFunctionsService) Call(name string, callfunctionrequest *CallFunctionRequest) *ProjectsLocationsFunctionsCallCall { 1761 c := &ProjectsLocationsFunctionsCallCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1762 c.name = name 1763 c.callfunctionrequest = callfunctionrequest 1764 return c 1765 } 1766 1767 // Fields allows partial responses to be retrieved. See 1768 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1769 // for more information. 1770 func (c *ProjectsLocationsFunctionsCallCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsCallCall { 1771 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1772 return c 1773 } 1774 1775 // Context sets the context to be used in this call's Do method. Any 1776 // pending HTTP request will be aborted if the provided context is 1777 // canceled. 1778 func (c *ProjectsLocationsFunctionsCallCall) Context(ctx context.Context) *ProjectsLocationsFunctionsCallCall { 1779 c.ctx_ = ctx 1780 return c 1781 } 1782 1783 // Header returns an http.Header that can be modified by the caller to 1784 // add HTTP headers to the request. 1785 func (c *ProjectsLocationsFunctionsCallCall) Header() http.Header { 1786 if c.header_ == nil { 1787 c.header_ = make(http.Header) 1788 } 1789 return c.header_ 1790 } 1791 1792 func (c *ProjectsLocationsFunctionsCallCall) doRequest(alt string) (*http.Response, error) { 1793 reqHeaders := make(http.Header) 1794 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 1795 for k, v := range c.header_ { 1796 reqHeaders[k] = v 1797 } 1798 reqHeaders.Set("User-Agent", c.s.userAgent()) 1799 var body io.Reader = nil 1800 body, err := googleapi.WithoutDataWrapper.JSONReader(c.callfunctionrequest) 1801 if err != nil { 1802 return nil, err 1803 } 1804 reqHeaders.Set("Content-Type", "application/json") 1805 c.urlParams_.Set("alt", alt) 1806 c.urlParams_.Set("prettyPrint", "false") 1807 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}:call") 1808 urls += "?" + c.urlParams_.Encode() 1809 req, err := http.NewRequest("POST", urls, body) 1810 if err != nil { 1811 return nil, err 1812 } 1813 req.Header = reqHeaders 1814 googleapi.Expand(req.URL, map[string]string{ 1815 "name": c.name, 1816 }) 1817 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1818 } 1819 1820 // Do executes the "cloudfunctions.projects.locations.functions.call" call. 1821 // Exactly one of *CallFunctionResponse or error will be non-nil. Any 1822 // non-2xx status code is an error. Response headers are in either 1823 // *CallFunctionResponse.ServerResponse.Header or (if a response was 1824 // returned at all) in error.(*googleapi.Error).Header. Use 1825 // googleapi.IsNotModified to check whether the returned error was 1826 // because http.StatusNotModified was returned. 1827 func (c *ProjectsLocationsFunctionsCallCall) Do(opts ...googleapi.CallOption) (*CallFunctionResponse, error) { 1828 gensupport.SetOptions(c.urlParams_, opts...) 1829 res, err := c.doRequest("json") 1830 if res != nil && res.StatusCode == http.StatusNotModified { 1831 if res.Body != nil { 1832 res.Body.Close() 1833 } 1834 return nil, &googleapi.Error{ 1835 Code: res.StatusCode, 1836 Header: res.Header, 1837 } 1838 } 1839 if err != nil { 1840 return nil, err 1841 } 1842 defer googleapi.CloseBody(res) 1843 if err := googleapi.CheckResponse(res); err != nil { 1844 return nil, err 1845 } 1846 ret := &CallFunctionResponse{ 1847 ServerResponse: googleapi.ServerResponse{ 1848 Header: res.Header, 1849 HTTPStatusCode: res.StatusCode, 1850 }, 1851 } 1852 target := &ret 1853 if err := gensupport.DecodeResponse(target, res); err != nil { 1854 return nil, err 1855 } 1856 return ret, nil 1857 // { 1858 // "description": "Synchronously invokes a deployed Cloud Function. To be used for testing\npurposes as very limited traffic is allowed. For more information on\nthe actual limits refer to [API Calls](\nhttps://cloud.google.com/functions/quotas#rate_limits).", 1859 // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}:call", 1860 // "httpMethod": "POST", 1861 // "id": "cloudfunctions.projects.locations.functions.call", 1862 // "parameterOrder": [ 1863 // "name" 1864 // ], 1865 // "parameters": { 1866 // "name": { 1867 // "description": "Required. The name of the function to be called.", 1868 // "location": "path", 1869 // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$", 1870 // "required": true, 1871 // "type": "string" 1872 // } 1873 // }, 1874 // "path": "v1beta2/{+name}:call", 1875 // "request": { 1876 // "$ref": "CallFunctionRequest" 1877 // }, 1878 // "response": { 1879 // "$ref": "CallFunctionResponse" 1880 // }, 1881 // "scopes": [ 1882 // "https://www.googleapis.com/auth/cloud-platform" 1883 // ] 1884 // } 1885 1886 } 1887 1888 // method id "cloudfunctions.projects.locations.functions.create": 1889 1890 type ProjectsLocationsFunctionsCreateCall struct { 1891 s *Service 1892 location string 1893 cloudfunction *CloudFunction 1894 urlParams_ gensupport.URLParams 1895 ctx_ context.Context 1896 header_ http.Header 1897 } 1898 1899 // Create: Creates a new function. If a function with the given name 1900 // already exists in 1901 // the specified project, the long running operation will 1902 // return 1903 // `ALREADY_EXISTS` error. 1904 func (r *ProjectsLocationsFunctionsService) Create(location string, cloudfunction *CloudFunction) *ProjectsLocationsFunctionsCreateCall { 1905 c := &ProjectsLocationsFunctionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1906 c.location = location 1907 c.cloudfunction = cloudfunction 1908 return c 1909 } 1910 1911 // Fields allows partial responses to be retrieved. See 1912 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1913 // for more information. 1914 func (c *ProjectsLocationsFunctionsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsCreateCall { 1915 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1916 return c 1917 } 1918 1919 // Context sets the context to be used in this call's Do method. Any 1920 // pending HTTP request will be aborted if the provided context is 1921 // canceled. 1922 func (c *ProjectsLocationsFunctionsCreateCall) Context(ctx context.Context) *ProjectsLocationsFunctionsCreateCall { 1923 c.ctx_ = ctx 1924 return c 1925 } 1926 1927 // Header returns an http.Header that can be modified by the caller to 1928 // add HTTP headers to the request. 1929 func (c *ProjectsLocationsFunctionsCreateCall) Header() http.Header { 1930 if c.header_ == nil { 1931 c.header_ = make(http.Header) 1932 } 1933 return c.header_ 1934 } 1935 1936 func (c *ProjectsLocationsFunctionsCreateCall) doRequest(alt string) (*http.Response, error) { 1937 reqHeaders := make(http.Header) 1938 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 1939 for k, v := range c.header_ { 1940 reqHeaders[k] = v 1941 } 1942 reqHeaders.Set("User-Agent", c.s.userAgent()) 1943 var body io.Reader = nil 1944 body, err := googleapi.WithoutDataWrapper.JSONReader(c.cloudfunction) 1945 if err != nil { 1946 return nil, err 1947 } 1948 reqHeaders.Set("Content-Type", "application/json") 1949 c.urlParams_.Set("alt", alt) 1950 c.urlParams_.Set("prettyPrint", "false") 1951 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+location}/functions") 1952 urls += "?" + c.urlParams_.Encode() 1953 req, err := http.NewRequest("POST", urls, body) 1954 if err != nil { 1955 return nil, err 1956 } 1957 req.Header = reqHeaders 1958 googleapi.Expand(req.URL, map[string]string{ 1959 "location": c.location, 1960 }) 1961 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1962 } 1963 1964 // Do executes the "cloudfunctions.projects.locations.functions.create" call. 1965 // Exactly one of *Operation or error will be non-nil. Any non-2xx 1966 // status code is an error. Response headers are in either 1967 // *Operation.ServerResponse.Header or (if a response was returned at 1968 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1969 // to check whether the returned error was because 1970 // http.StatusNotModified was returned. 1971 func (c *ProjectsLocationsFunctionsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 1972 gensupport.SetOptions(c.urlParams_, opts...) 1973 res, err := c.doRequest("json") 1974 if res != nil && res.StatusCode == http.StatusNotModified { 1975 if res.Body != nil { 1976 res.Body.Close() 1977 } 1978 return nil, &googleapi.Error{ 1979 Code: res.StatusCode, 1980 Header: res.Header, 1981 } 1982 } 1983 if err != nil { 1984 return nil, err 1985 } 1986 defer googleapi.CloseBody(res) 1987 if err := googleapi.CheckResponse(res); err != nil { 1988 return nil, err 1989 } 1990 ret := &Operation{ 1991 ServerResponse: googleapi.ServerResponse{ 1992 Header: res.Header, 1993 HTTPStatusCode: res.StatusCode, 1994 }, 1995 } 1996 target := &ret 1997 if err := gensupport.DecodeResponse(target, res); err != nil { 1998 return nil, err 1999 } 2000 return ret, nil 2001 // { 2002 // "description": "Creates a new function. If a function with the given name already exists in\nthe specified project, the long running operation will return\n`ALREADY_EXISTS` error.", 2003 // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions", 2004 // "httpMethod": "POST", 2005 // "id": "cloudfunctions.projects.locations.functions.create", 2006 // "parameterOrder": [ 2007 // "location" 2008 // ], 2009 // "parameters": { 2010 // "location": { 2011 // "description": "Required. The project and location in which the function should be created, specified\nin the format `projects/*/locations/*`", 2012 // "location": "path", 2013 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2014 // "required": true, 2015 // "type": "string" 2016 // } 2017 // }, 2018 // "path": "v1beta2/{+location}/functions", 2019 // "request": { 2020 // "$ref": "CloudFunction" 2021 // }, 2022 // "response": { 2023 // "$ref": "Operation" 2024 // }, 2025 // "scopes": [ 2026 // "https://www.googleapis.com/auth/cloud-platform" 2027 // ] 2028 // } 2029 2030 } 2031 2032 // method id "cloudfunctions.projects.locations.functions.delete": 2033 2034 type ProjectsLocationsFunctionsDeleteCall struct { 2035 s *Service 2036 name string 2037 urlParams_ gensupport.URLParams 2038 ctx_ context.Context 2039 header_ http.Header 2040 } 2041 2042 // Delete: Deletes a function with the given name from the specified 2043 // project. If the 2044 // given function is used by some trigger, the trigger will be updated 2045 // to 2046 // remove this function. 2047 func (r *ProjectsLocationsFunctionsService) Delete(name string) *ProjectsLocationsFunctionsDeleteCall { 2048 c := &ProjectsLocationsFunctionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2049 c.name = name 2050 return c 2051 } 2052 2053 // Fields allows partial responses to be retrieved. See 2054 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2055 // for more information. 2056 func (c *ProjectsLocationsFunctionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsDeleteCall { 2057 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2058 return c 2059 } 2060 2061 // Context sets the context to be used in this call's Do method. Any 2062 // pending HTTP request will be aborted if the provided context is 2063 // canceled. 2064 func (c *ProjectsLocationsFunctionsDeleteCall) Context(ctx context.Context) *ProjectsLocationsFunctionsDeleteCall { 2065 c.ctx_ = ctx 2066 return c 2067 } 2068 2069 // Header returns an http.Header that can be modified by the caller to 2070 // add HTTP headers to the request. 2071 func (c *ProjectsLocationsFunctionsDeleteCall) Header() http.Header { 2072 if c.header_ == nil { 2073 c.header_ = make(http.Header) 2074 } 2075 return c.header_ 2076 } 2077 2078 func (c *ProjectsLocationsFunctionsDeleteCall) doRequest(alt string) (*http.Response, error) { 2079 reqHeaders := make(http.Header) 2080 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 2081 for k, v := range c.header_ { 2082 reqHeaders[k] = v 2083 } 2084 reqHeaders.Set("User-Agent", c.s.userAgent()) 2085 var body io.Reader = nil 2086 c.urlParams_.Set("alt", alt) 2087 c.urlParams_.Set("prettyPrint", "false") 2088 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}") 2089 urls += "?" + c.urlParams_.Encode() 2090 req, err := http.NewRequest("DELETE", urls, body) 2091 if err != nil { 2092 return nil, err 2093 } 2094 req.Header = reqHeaders 2095 googleapi.Expand(req.URL, map[string]string{ 2096 "name": c.name, 2097 }) 2098 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2099 } 2100 2101 // Do executes the "cloudfunctions.projects.locations.functions.delete" call. 2102 // Exactly one of *Operation or error will be non-nil. Any non-2xx 2103 // status code is an error. Response headers are in either 2104 // *Operation.ServerResponse.Header or (if a response was returned at 2105 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2106 // to check whether the returned error was because 2107 // http.StatusNotModified was returned. 2108 func (c *ProjectsLocationsFunctionsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2109 gensupport.SetOptions(c.urlParams_, opts...) 2110 res, err := c.doRequest("json") 2111 if res != nil && res.StatusCode == http.StatusNotModified { 2112 if res.Body != nil { 2113 res.Body.Close() 2114 } 2115 return nil, &googleapi.Error{ 2116 Code: res.StatusCode, 2117 Header: res.Header, 2118 } 2119 } 2120 if err != nil { 2121 return nil, err 2122 } 2123 defer googleapi.CloseBody(res) 2124 if err := googleapi.CheckResponse(res); err != nil { 2125 return nil, err 2126 } 2127 ret := &Operation{ 2128 ServerResponse: googleapi.ServerResponse{ 2129 Header: res.Header, 2130 HTTPStatusCode: res.StatusCode, 2131 }, 2132 } 2133 target := &ret 2134 if err := gensupport.DecodeResponse(target, res); err != nil { 2135 return nil, err 2136 } 2137 return ret, nil 2138 // { 2139 // "description": "Deletes a function with the given name from the specified project. If the\ngiven function is used by some trigger, the trigger will be updated to\nremove this function.", 2140 // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}", 2141 // "httpMethod": "DELETE", 2142 // "id": "cloudfunctions.projects.locations.functions.delete", 2143 // "parameterOrder": [ 2144 // "name" 2145 // ], 2146 // "parameters": { 2147 // "name": { 2148 // "description": "Required. The name of the function which should be deleted.", 2149 // "location": "path", 2150 // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$", 2151 // "required": true, 2152 // "type": "string" 2153 // } 2154 // }, 2155 // "path": "v1beta2/{+name}", 2156 // "response": { 2157 // "$ref": "Operation" 2158 // }, 2159 // "scopes": [ 2160 // "https://www.googleapis.com/auth/cloud-platform" 2161 // ] 2162 // } 2163 2164 } 2165 2166 // method id "cloudfunctions.projects.locations.functions.generateDownloadUrl": 2167 2168 type ProjectsLocationsFunctionsGenerateDownloadUrlCall struct { 2169 s *Service 2170 name string 2171 generatedownloadurlrequest *GenerateDownloadUrlRequest 2172 urlParams_ gensupport.URLParams 2173 ctx_ context.Context 2174 header_ http.Header 2175 } 2176 2177 // GenerateDownloadUrl: Returns a signed URL for downloading deployed 2178 // function source code. 2179 // The URL is only valid for a limited period and should be used 2180 // within 2181 // minutes after generation. 2182 // For more information about the signed URL usage 2183 // see: 2184 // https://cloud.google.com/storage/docs/access-control/signed-urls 2185 func (r *ProjectsLocationsFunctionsService) GenerateDownloadUrl(name string, generatedownloadurlrequest *GenerateDownloadUrlRequest) *ProjectsLocationsFunctionsGenerateDownloadUrlCall { 2186 c := &ProjectsLocationsFunctionsGenerateDownloadUrlCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2187 c.name = name 2188 c.generatedownloadurlrequest = generatedownloadurlrequest 2189 return c 2190 } 2191 2192 // Fields allows partial responses to be retrieved. See 2193 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2194 // for more information. 2195 func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGenerateDownloadUrlCall { 2196 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2197 return c 2198 } 2199 2200 // Context sets the context to be used in this call's Do method. Any 2201 // pending HTTP request will be aborted if the provided context is 2202 // canceled. 2203 func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGenerateDownloadUrlCall { 2204 c.ctx_ = ctx 2205 return c 2206 } 2207 2208 // Header returns an http.Header that can be modified by the caller to 2209 // add HTTP headers to the request. 2210 func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Header() http.Header { 2211 if c.header_ == nil { 2212 c.header_ = make(http.Header) 2213 } 2214 return c.header_ 2215 } 2216 2217 func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) doRequest(alt string) (*http.Response, error) { 2218 reqHeaders := make(http.Header) 2219 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 2220 for k, v := range c.header_ { 2221 reqHeaders[k] = v 2222 } 2223 reqHeaders.Set("User-Agent", c.s.userAgent()) 2224 var body io.Reader = nil 2225 body, err := googleapi.WithoutDataWrapper.JSONReader(c.generatedownloadurlrequest) 2226 if err != nil { 2227 return nil, err 2228 } 2229 reqHeaders.Set("Content-Type", "application/json") 2230 c.urlParams_.Set("alt", alt) 2231 c.urlParams_.Set("prettyPrint", "false") 2232 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}:generateDownloadUrl") 2233 urls += "?" + c.urlParams_.Encode() 2234 req, err := http.NewRequest("POST", urls, body) 2235 if err != nil { 2236 return nil, err 2237 } 2238 req.Header = reqHeaders 2239 googleapi.Expand(req.URL, map[string]string{ 2240 "name": c.name, 2241 }) 2242 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2243 } 2244 2245 // Do executes the "cloudfunctions.projects.locations.functions.generateDownloadUrl" call. 2246 // Exactly one of *GenerateDownloadUrlResponse or error will be non-nil. 2247 // Any non-2xx status code is an error. Response headers are in either 2248 // *GenerateDownloadUrlResponse.ServerResponse.Header or (if a response 2249 // was returned at all) in error.(*googleapi.Error).Header. Use 2250 // googleapi.IsNotModified to check whether the returned error was 2251 // because http.StatusNotModified was returned. 2252 func (c *ProjectsLocationsFunctionsGenerateDownloadUrlCall) Do(opts ...googleapi.CallOption) (*GenerateDownloadUrlResponse, error) { 2253 gensupport.SetOptions(c.urlParams_, opts...) 2254 res, err := c.doRequest("json") 2255 if res != nil && res.StatusCode == http.StatusNotModified { 2256 if res.Body != nil { 2257 res.Body.Close() 2258 } 2259 return nil, &googleapi.Error{ 2260 Code: res.StatusCode, 2261 Header: res.Header, 2262 } 2263 } 2264 if err != nil { 2265 return nil, err 2266 } 2267 defer googleapi.CloseBody(res) 2268 if err := googleapi.CheckResponse(res); err != nil { 2269 return nil, err 2270 } 2271 ret := &GenerateDownloadUrlResponse{ 2272 ServerResponse: googleapi.ServerResponse{ 2273 Header: res.Header, 2274 HTTPStatusCode: res.StatusCode, 2275 }, 2276 } 2277 target := &ret 2278 if err := gensupport.DecodeResponse(target, res); err != nil { 2279 return nil, err 2280 } 2281 return ret, nil 2282 // { 2283 // "description": "Returns a signed URL for downloading deployed function source code.\nThe URL is only valid for a limited period and should be used within\nminutes after generation.\nFor more information about the signed URL usage see:\nhttps://cloud.google.com/storage/docs/access-control/signed-urls", 2284 // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}:generateDownloadUrl", 2285 // "httpMethod": "POST", 2286 // "id": "cloudfunctions.projects.locations.functions.generateDownloadUrl", 2287 // "parameterOrder": [ 2288 // "name" 2289 // ], 2290 // "parameters": { 2291 // "name": { 2292 // "description": "The name of function for which source code Google Cloud Storage signed\nURL should be generated.", 2293 // "location": "path", 2294 // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$", 2295 // "required": true, 2296 // "type": "string" 2297 // } 2298 // }, 2299 // "path": "v1beta2/{+name}:generateDownloadUrl", 2300 // "request": { 2301 // "$ref": "GenerateDownloadUrlRequest" 2302 // }, 2303 // "response": { 2304 // "$ref": "GenerateDownloadUrlResponse" 2305 // }, 2306 // "scopes": [ 2307 // "https://www.googleapis.com/auth/cloud-platform" 2308 // ] 2309 // } 2310 2311 } 2312 2313 // method id "cloudfunctions.projects.locations.functions.generateUploadUrl": 2314 2315 type ProjectsLocationsFunctionsGenerateUploadUrlCall struct { 2316 s *Service 2317 parent string 2318 generateuploadurlrequest *GenerateUploadUrlRequest 2319 urlParams_ gensupport.URLParams 2320 ctx_ context.Context 2321 header_ http.Header 2322 } 2323 2324 // GenerateUploadUrl: Returns a signed URL for uploading a function 2325 // source code. 2326 // For more information about the signed URL usage 2327 // see: 2328 // https://cloud.google.com/storage/docs/access-control/signed-urls 2329 // 2330 // Once the function source code upload is complete, the used signed 2331 // URL should be provided in CreateFunction or UpdateFunction request 2332 // as a reference to the function source code. 2333 // 2334 // When uploading source code to the generated signed URL, please 2335 // follow 2336 // these restrictions: 2337 // 2338 // * Source file type should be a zip file. 2339 // * Source file size should not exceed 100MB limit. 2340 // * No credentials should be attached - the signed URLs provide access 2341 // to the 2342 // 2343 // target bucket using internal service identity; if credentials were 2344 // attached, the identity from the credentials would be used, but 2345 // 2346 // that 2347 // 2348 // identity does not have permissions to upload files to the 2349 // 2350 // URL. 2351 // 2352 // When making a HTTP PUT request, these two headers need to be 2353 // specified: 2354 // 2355 // * `content-type: application/zip` 2356 // * `x-goog-content-length-range: 0,104857600` 2357 // 2358 // And this header SHOULD NOT be specified: 2359 // 2360 // * `Authorization: Bearer YOUR_TOKEN` 2361 func (r *ProjectsLocationsFunctionsService) GenerateUploadUrl(parent string, generateuploadurlrequest *GenerateUploadUrlRequest) *ProjectsLocationsFunctionsGenerateUploadUrlCall { 2362 c := &ProjectsLocationsFunctionsGenerateUploadUrlCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2363 c.parent = parent 2364 c.generateuploadurlrequest = generateuploadurlrequest 2365 return c 2366 } 2367 2368 // Fields allows partial responses to be retrieved. See 2369 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2370 // for more information. 2371 func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGenerateUploadUrlCall { 2372 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2373 return c 2374 } 2375 2376 // Context sets the context to be used in this call's Do method. Any 2377 // pending HTTP request will be aborted if the provided context is 2378 // canceled. 2379 func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGenerateUploadUrlCall { 2380 c.ctx_ = ctx 2381 return c 2382 } 2383 2384 // Header returns an http.Header that can be modified by the caller to 2385 // add HTTP headers to the request. 2386 func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Header() http.Header { 2387 if c.header_ == nil { 2388 c.header_ = make(http.Header) 2389 } 2390 return c.header_ 2391 } 2392 2393 func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) doRequest(alt string) (*http.Response, error) { 2394 reqHeaders := make(http.Header) 2395 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 2396 for k, v := range c.header_ { 2397 reqHeaders[k] = v 2398 } 2399 reqHeaders.Set("User-Agent", c.s.userAgent()) 2400 var body io.Reader = nil 2401 body, err := googleapi.WithoutDataWrapper.JSONReader(c.generateuploadurlrequest) 2402 if err != nil { 2403 return nil, err 2404 } 2405 reqHeaders.Set("Content-Type", "application/json") 2406 c.urlParams_.Set("alt", alt) 2407 c.urlParams_.Set("prettyPrint", "false") 2408 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+parent}/functions:generateUploadUrl") 2409 urls += "?" + c.urlParams_.Encode() 2410 req, err := http.NewRequest("POST", urls, body) 2411 if err != nil { 2412 return nil, err 2413 } 2414 req.Header = reqHeaders 2415 googleapi.Expand(req.URL, map[string]string{ 2416 "parent": c.parent, 2417 }) 2418 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2419 } 2420 2421 // Do executes the "cloudfunctions.projects.locations.functions.generateUploadUrl" call. 2422 // Exactly one of *GenerateUploadUrlResponse or error will be non-nil. 2423 // Any non-2xx status code is an error. Response headers are in either 2424 // *GenerateUploadUrlResponse.ServerResponse.Header or (if a response 2425 // was returned at all) in error.(*googleapi.Error).Header. Use 2426 // googleapi.IsNotModified to check whether the returned error was 2427 // because http.StatusNotModified was returned. 2428 func (c *ProjectsLocationsFunctionsGenerateUploadUrlCall) Do(opts ...googleapi.CallOption) (*GenerateUploadUrlResponse, error) { 2429 gensupport.SetOptions(c.urlParams_, opts...) 2430 res, err := c.doRequest("json") 2431 if res != nil && res.StatusCode == http.StatusNotModified { 2432 if res.Body != nil { 2433 res.Body.Close() 2434 } 2435 return nil, &googleapi.Error{ 2436 Code: res.StatusCode, 2437 Header: res.Header, 2438 } 2439 } 2440 if err != nil { 2441 return nil, err 2442 } 2443 defer googleapi.CloseBody(res) 2444 if err := googleapi.CheckResponse(res); err != nil { 2445 return nil, err 2446 } 2447 ret := &GenerateUploadUrlResponse{ 2448 ServerResponse: googleapi.ServerResponse{ 2449 Header: res.Header, 2450 HTTPStatusCode: res.StatusCode, 2451 }, 2452 } 2453 target := &ret 2454 if err := gensupport.DecodeResponse(target, res); err != nil { 2455 return nil, err 2456 } 2457 return ret, nil 2458 // { 2459 // "description": "Returns a signed URL for uploading a function source code.\nFor more information about the signed URL usage see:\nhttps://cloud.google.com/storage/docs/access-control/signed-urls\nOnce the function source code upload is complete, the used signed\nURL should be provided in CreateFunction or UpdateFunction request\nas a reference to the function source code.\n\nWhen uploading source code to the generated signed URL, please follow\nthese restrictions:\n\n* Source file type should be a zip file.\n* Source file size should not exceed 100MB limit.\n* No credentials should be attached - the signed URLs provide access to the\n target bucket using internal service identity; if credentials were\n attached, the identity from the credentials would be used, but that\n identity does not have permissions to upload files to the URL.\n\nWhen making a HTTP PUT request, these two headers need to be specified:\n\n* `content-type: application/zip`\n* `x-goog-content-length-range: 0,104857600`\n\nAnd this header SHOULD NOT be specified:\n\n* `Authorization: Bearer YOUR_TOKEN`", 2460 // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions:generateUploadUrl", 2461 // "httpMethod": "POST", 2462 // "id": "cloudfunctions.projects.locations.functions.generateUploadUrl", 2463 // "parameterOrder": [ 2464 // "parent" 2465 // ], 2466 // "parameters": { 2467 // "parent": { 2468 // "description": "The project and location in which the Google Cloud Storage signed URL\nshould be generated, specified in the format `projects/*/locations/*`.", 2469 // "location": "path", 2470 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2471 // "required": true, 2472 // "type": "string" 2473 // } 2474 // }, 2475 // "path": "v1beta2/{+parent}/functions:generateUploadUrl", 2476 // "request": { 2477 // "$ref": "GenerateUploadUrlRequest" 2478 // }, 2479 // "response": { 2480 // "$ref": "GenerateUploadUrlResponse" 2481 // }, 2482 // "scopes": [ 2483 // "https://www.googleapis.com/auth/cloud-platform" 2484 // ] 2485 // } 2486 2487 } 2488 2489 // method id "cloudfunctions.projects.locations.functions.get": 2490 2491 type ProjectsLocationsFunctionsGetCall struct { 2492 s *Service 2493 name string 2494 urlParams_ gensupport.URLParams 2495 ifNoneMatch_ string 2496 ctx_ context.Context 2497 header_ http.Header 2498 } 2499 2500 // Get: Returns a function with the given name from the requested 2501 // project. 2502 func (r *ProjectsLocationsFunctionsService) Get(name string) *ProjectsLocationsFunctionsGetCall { 2503 c := &ProjectsLocationsFunctionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2504 c.name = name 2505 return c 2506 } 2507 2508 // Fields allows partial responses to be retrieved. See 2509 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2510 // for more information. 2511 func (c *ProjectsLocationsFunctionsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsGetCall { 2512 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2513 return c 2514 } 2515 2516 // IfNoneMatch sets the optional parameter which makes the operation 2517 // fail if the object's ETag matches the given value. This is useful for 2518 // getting updates only after the object has changed since the last 2519 // request. Use googleapi.IsNotModified to check whether the response 2520 // error from Do is the result of In-None-Match. 2521 func (c *ProjectsLocationsFunctionsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsFunctionsGetCall { 2522 c.ifNoneMatch_ = entityTag 2523 return c 2524 } 2525 2526 // Context sets the context to be used in this call's Do method. Any 2527 // pending HTTP request will be aborted if the provided context is 2528 // canceled. 2529 func (c *ProjectsLocationsFunctionsGetCall) Context(ctx context.Context) *ProjectsLocationsFunctionsGetCall { 2530 c.ctx_ = ctx 2531 return c 2532 } 2533 2534 // Header returns an http.Header that can be modified by the caller to 2535 // add HTTP headers to the request. 2536 func (c *ProjectsLocationsFunctionsGetCall) Header() http.Header { 2537 if c.header_ == nil { 2538 c.header_ = make(http.Header) 2539 } 2540 return c.header_ 2541 } 2542 2543 func (c *ProjectsLocationsFunctionsGetCall) doRequest(alt string) (*http.Response, error) { 2544 reqHeaders := make(http.Header) 2545 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 2546 for k, v := range c.header_ { 2547 reqHeaders[k] = v 2548 } 2549 reqHeaders.Set("User-Agent", c.s.userAgent()) 2550 if c.ifNoneMatch_ != "" { 2551 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2552 } 2553 var body io.Reader = nil 2554 c.urlParams_.Set("alt", alt) 2555 c.urlParams_.Set("prettyPrint", "false") 2556 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}") 2557 urls += "?" + c.urlParams_.Encode() 2558 req, err := http.NewRequest("GET", urls, body) 2559 if err != nil { 2560 return nil, err 2561 } 2562 req.Header = reqHeaders 2563 googleapi.Expand(req.URL, map[string]string{ 2564 "name": c.name, 2565 }) 2566 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2567 } 2568 2569 // Do executes the "cloudfunctions.projects.locations.functions.get" call. 2570 // Exactly one of *CloudFunction or error will be non-nil. Any non-2xx 2571 // status code is an error. Response headers are in either 2572 // *CloudFunction.ServerResponse.Header or (if a response was returned 2573 // at all) in error.(*googleapi.Error).Header. Use 2574 // googleapi.IsNotModified to check whether the returned error was 2575 // because http.StatusNotModified was returned. 2576 func (c *ProjectsLocationsFunctionsGetCall) Do(opts ...googleapi.CallOption) (*CloudFunction, error) { 2577 gensupport.SetOptions(c.urlParams_, opts...) 2578 res, err := c.doRequest("json") 2579 if res != nil && res.StatusCode == http.StatusNotModified { 2580 if res.Body != nil { 2581 res.Body.Close() 2582 } 2583 return nil, &googleapi.Error{ 2584 Code: res.StatusCode, 2585 Header: res.Header, 2586 } 2587 } 2588 if err != nil { 2589 return nil, err 2590 } 2591 defer googleapi.CloseBody(res) 2592 if err := googleapi.CheckResponse(res); err != nil { 2593 return nil, err 2594 } 2595 ret := &CloudFunction{ 2596 ServerResponse: googleapi.ServerResponse{ 2597 Header: res.Header, 2598 HTTPStatusCode: res.StatusCode, 2599 }, 2600 } 2601 target := &ret 2602 if err := gensupport.DecodeResponse(target, res); err != nil { 2603 return nil, err 2604 } 2605 return ret, nil 2606 // { 2607 // "description": "Returns a function with the given name from the requested project.", 2608 // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}", 2609 // "httpMethod": "GET", 2610 // "id": "cloudfunctions.projects.locations.functions.get", 2611 // "parameterOrder": [ 2612 // "name" 2613 // ], 2614 // "parameters": { 2615 // "name": { 2616 // "description": "Required. The name of the function which details should be obtained.", 2617 // "location": "path", 2618 // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$", 2619 // "required": true, 2620 // "type": "string" 2621 // } 2622 // }, 2623 // "path": "v1beta2/{+name}", 2624 // "response": { 2625 // "$ref": "CloudFunction" 2626 // }, 2627 // "scopes": [ 2628 // "https://www.googleapis.com/auth/cloud-platform" 2629 // ] 2630 // } 2631 2632 } 2633 2634 // method id "cloudfunctions.projects.locations.functions.list": 2635 2636 type ProjectsLocationsFunctionsListCall struct { 2637 s *Service 2638 location string 2639 urlParams_ gensupport.URLParams 2640 ifNoneMatch_ string 2641 ctx_ context.Context 2642 header_ http.Header 2643 } 2644 2645 // List: Returns a list of functions that belong to the requested 2646 // project. 2647 func (r *ProjectsLocationsFunctionsService) List(location string) *ProjectsLocationsFunctionsListCall { 2648 c := &ProjectsLocationsFunctionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2649 c.location = location 2650 return c 2651 } 2652 2653 // PageSize sets the optional parameter "pageSize": Maximum number of 2654 // functions to return per call. 2655 func (c *ProjectsLocationsFunctionsListCall) PageSize(pageSize int64) *ProjectsLocationsFunctionsListCall { 2656 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2657 return c 2658 } 2659 2660 // PageToken sets the optional parameter "pageToken": The value returned 2661 // by the last 2662 // `ListFunctionsResponse`; indicates that 2663 // this is a continuation of a prior `ListFunctions` call, and that 2664 // the 2665 // system should return the next page of data. 2666 func (c *ProjectsLocationsFunctionsListCall) PageToken(pageToken string) *ProjectsLocationsFunctionsListCall { 2667 c.urlParams_.Set("pageToken", pageToken) 2668 return c 2669 } 2670 2671 // Fields allows partial responses to be retrieved. See 2672 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2673 // for more information. 2674 func (c *ProjectsLocationsFunctionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsListCall { 2675 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2676 return c 2677 } 2678 2679 // IfNoneMatch sets the optional parameter which makes the operation 2680 // fail if the object's ETag matches the given value. This is useful for 2681 // getting updates only after the object has changed since the last 2682 // request. Use googleapi.IsNotModified to check whether the response 2683 // error from Do is the result of In-None-Match. 2684 func (c *ProjectsLocationsFunctionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsFunctionsListCall { 2685 c.ifNoneMatch_ = entityTag 2686 return c 2687 } 2688 2689 // Context sets the context to be used in this call's Do method. Any 2690 // pending HTTP request will be aborted if the provided context is 2691 // canceled. 2692 func (c *ProjectsLocationsFunctionsListCall) Context(ctx context.Context) *ProjectsLocationsFunctionsListCall { 2693 c.ctx_ = ctx 2694 return c 2695 } 2696 2697 // Header returns an http.Header that can be modified by the caller to 2698 // add HTTP headers to the request. 2699 func (c *ProjectsLocationsFunctionsListCall) Header() http.Header { 2700 if c.header_ == nil { 2701 c.header_ = make(http.Header) 2702 } 2703 return c.header_ 2704 } 2705 2706 func (c *ProjectsLocationsFunctionsListCall) doRequest(alt string) (*http.Response, error) { 2707 reqHeaders := make(http.Header) 2708 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 2709 for k, v := range c.header_ { 2710 reqHeaders[k] = v 2711 } 2712 reqHeaders.Set("User-Agent", c.s.userAgent()) 2713 if c.ifNoneMatch_ != "" { 2714 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2715 } 2716 var body io.Reader = nil 2717 c.urlParams_.Set("alt", alt) 2718 c.urlParams_.Set("prettyPrint", "false") 2719 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+location}/functions") 2720 urls += "?" + c.urlParams_.Encode() 2721 req, err := http.NewRequest("GET", urls, body) 2722 if err != nil { 2723 return nil, err 2724 } 2725 req.Header = reqHeaders 2726 googleapi.Expand(req.URL, map[string]string{ 2727 "location": c.location, 2728 }) 2729 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2730 } 2731 2732 // Do executes the "cloudfunctions.projects.locations.functions.list" call. 2733 // Exactly one of *ListFunctionsResponse or error will be non-nil. Any 2734 // non-2xx status code is an error. Response headers are in either 2735 // *ListFunctionsResponse.ServerResponse.Header or (if a response was 2736 // returned at all) in error.(*googleapi.Error).Header. Use 2737 // googleapi.IsNotModified to check whether the returned error was 2738 // because http.StatusNotModified was returned. 2739 func (c *ProjectsLocationsFunctionsListCall) Do(opts ...googleapi.CallOption) (*ListFunctionsResponse, error) { 2740 gensupport.SetOptions(c.urlParams_, opts...) 2741 res, err := c.doRequest("json") 2742 if res != nil && res.StatusCode == http.StatusNotModified { 2743 if res.Body != nil { 2744 res.Body.Close() 2745 } 2746 return nil, &googleapi.Error{ 2747 Code: res.StatusCode, 2748 Header: res.Header, 2749 } 2750 } 2751 if err != nil { 2752 return nil, err 2753 } 2754 defer googleapi.CloseBody(res) 2755 if err := googleapi.CheckResponse(res); err != nil { 2756 return nil, err 2757 } 2758 ret := &ListFunctionsResponse{ 2759 ServerResponse: googleapi.ServerResponse{ 2760 Header: res.Header, 2761 HTTPStatusCode: res.StatusCode, 2762 }, 2763 } 2764 target := &ret 2765 if err := gensupport.DecodeResponse(target, res); err != nil { 2766 return nil, err 2767 } 2768 return ret, nil 2769 // { 2770 // "description": "Returns a list of functions that belong to the requested project.", 2771 // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions", 2772 // "httpMethod": "GET", 2773 // "id": "cloudfunctions.projects.locations.functions.list", 2774 // "parameterOrder": [ 2775 // "location" 2776 // ], 2777 // "parameters": { 2778 // "location": { 2779 // "description": "Required. The project and location from which the function should be listed,\nspecified in the format `projects/*/locations/*`\nIf you want to list functions in all locations, use \"-\" in place of a\nlocation. When listing functions in all locations, if one or more\nlocation(s) are unreachable, the response will contain functions from all\nreachable locations along with the names of any unreachable locations.", 2780 // "location": "path", 2781 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2782 // "required": true, 2783 // "type": "string" 2784 // }, 2785 // "pageSize": { 2786 // "description": "Maximum number of functions to return per call.", 2787 // "format": "int32", 2788 // "location": "query", 2789 // "type": "integer" 2790 // }, 2791 // "pageToken": { 2792 // "description": "The value returned by the last\n`ListFunctionsResponse`; indicates that\nthis is a continuation of a prior `ListFunctions` call, and that the\nsystem should return the next page of data.", 2793 // "location": "query", 2794 // "type": "string" 2795 // } 2796 // }, 2797 // "path": "v1beta2/{+location}/functions", 2798 // "response": { 2799 // "$ref": "ListFunctionsResponse" 2800 // }, 2801 // "scopes": [ 2802 // "https://www.googleapis.com/auth/cloud-platform" 2803 // ] 2804 // } 2805 2806 } 2807 2808 // Pages invokes f for each page of results. 2809 // A non-nil error returned from f will halt the iteration. 2810 // The provided context supersedes any context provided to the Context method. 2811 func (c *ProjectsLocationsFunctionsListCall) Pages(ctx context.Context, f func(*ListFunctionsResponse) error) error { 2812 c.ctx_ = ctx 2813 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2814 for { 2815 x, err := c.Do() 2816 if err != nil { 2817 return err 2818 } 2819 if err := f(x); err != nil { 2820 return err 2821 } 2822 if x.NextPageToken == "" { 2823 return nil 2824 } 2825 c.PageToken(x.NextPageToken) 2826 } 2827 } 2828 2829 // method id "cloudfunctions.projects.locations.functions.update": 2830 2831 type ProjectsLocationsFunctionsUpdateCall struct { 2832 s *Service 2833 name string 2834 cloudfunction *CloudFunction 2835 urlParams_ gensupport.URLParams 2836 ctx_ context.Context 2837 header_ http.Header 2838 } 2839 2840 // Update: Updates existing function. 2841 func (r *ProjectsLocationsFunctionsService) Update(name string, cloudfunction *CloudFunction) *ProjectsLocationsFunctionsUpdateCall { 2842 c := &ProjectsLocationsFunctionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2843 c.name = name 2844 c.cloudfunction = cloudfunction 2845 return c 2846 } 2847 2848 // Fields allows partial responses to be retrieved. See 2849 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2850 // for more information. 2851 func (c *ProjectsLocationsFunctionsUpdateCall) Fields(s ...googleapi.Field) *ProjectsLocationsFunctionsUpdateCall { 2852 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2853 return c 2854 } 2855 2856 // Context sets the context to be used in this call's Do method. Any 2857 // pending HTTP request will be aborted if the provided context is 2858 // canceled. 2859 func (c *ProjectsLocationsFunctionsUpdateCall) Context(ctx context.Context) *ProjectsLocationsFunctionsUpdateCall { 2860 c.ctx_ = ctx 2861 return c 2862 } 2863 2864 // Header returns an http.Header that can be modified by the caller to 2865 // add HTTP headers to the request. 2866 func (c *ProjectsLocationsFunctionsUpdateCall) Header() http.Header { 2867 if c.header_ == nil { 2868 c.header_ = make(http.Header) 2869 } 2870 return c.header_ 2871 } 2872 2873 func (c *ProjectsLocationsFunctionsUpdateCall) doRequest(alt string) (*http.Response, error) { 2874 reqHeaders := make(http.Header) 2875 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200721") 2876 for k, v := range c.header_ { 2877 reqHeaders[k] = v 2878 } 2879 reqHeaders.Set("User-Agent", c.s.userAgent()) 2880 var body io.Reader = nil 2881 body, err := googleapi.WithoutDataWrapper.JSONReader(c.cloudfunction) 2882 if err != nil { 2883 return nil, err 2884 } 2885 reqHeaders.Set("Content-Type", "application/json") 2886 c.urlParams_.Set("alt", alt) 2887 c.urlParams_.Set("prettyPrint", "false") 2888 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}") 2889 urls += "?" + c.urlParams_.Encode() 2890 req, err := http.NewRequest("PUT", urls, body) 2891 if err != nil { 2892 return nil, err 2893 } 2894 req.Header = reqHeaders 2895 googleapi.Expand(req.URL, map[string]string{ 2896 "name": c.name, 2897 }) 2898 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2899 } 2900 2901 // Do executes the "cloudfunctions.projects.locations.functions.update" call. 2902 // Exactly one of *Operation or error will be non-nil. Any non-2xx 2903 // status code is an error. Response headers are in either 2904 // *Operation.ServerResponse.Header or (if a response was returned at 2905 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2906 // to check whether the returned error was because 2907 // http.StatusNotModified was returned. 2908 func (c *ProjectsLocationsFunctionsUpdateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2909 gensupport.SetOptions(c.urlParams_, opts...) 2910 res, err := c.doRequest("json") 2911 if res != nil && res.StatusCode == http.StatusNotModified { 2912 if res.Body != nil { 2913 res.Body.Close() 2914 } 2915 return nil, &googleapi.Error{ 2916 Code: res.StatusCode, 2917 Header: res.Header, 2918 } 2919 } 2920 if err != nil { 2921 return nil, err 2922 } 2923 defer googleapi.CloseBody(res) 2924 if err := googleapi.CheckResponse(res); err != nil { 2925 return nil, err 2926 } 2927 ret := &Operation{ 2928 ServerResponse: googleapi.ServerResponse{ 2929 Header: res.Header, 2930 HTTPStatusCode: res.StatusCode, 2931 }, 2932 } 2933 target := &ret 2934 if err := gensupport.DecodeResponse(target, res); err != nil { 2935 return nil, err 2936 } 2937 return ret, nil 2938 // { 2939 // "description": "Updates existing function.", 2940 // "flatPath": "v1beta2/projects/{projectsId}/locations/{locationsId}/functions/{functionsId}", 2941 // "httpMethod": "PUT", 2942 // "id": "cloudfunctions.projects.locations.functions.update", 2943 // "parameterOrder": [ 2944 // "name" 2945 // ], 2946 // "parameters": { 2947 // "name": { 2948 // "description": "Required. The name of the function to be updated.", 2949 // "location": "path", 2950 // "pattern": "^projects/[^/]+/locations/[^/]+/functions/[^/]+$", 2951 // "required": true, 2952 // "type": "string" 2953 // } 2954 // }, 2955 // "path": "v1beta2/{+name}", 2956 // "request": { 2957 // "$ref": "CloudFunction" 2958 // }, 2959 // "response": { 2960 // "$ref": "Operation" 2961 // }, 2962 // "scopes": [ 2963 // "https://www.googleapis.com/auth/cloud-platform" 2964 // ] 2965 // } 2966 2967 } 2968