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 cloudbuild provides access to the Cloud Build API. 8// 9// For product documentation, see: https://cloud.google.com/cloud-build/docs/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/cloudbuild/v1" 16// ... 17// ctx := context.Background() 18// cloudbuildService, err := cloudbuild.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// cloudbuildService, err := cloudbuild.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// cloudbuildService, err := cloudbuild.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36// 37// See https://godoc.org/google.golang.org/api/option/ for details on options. 38package cloudbuild // import "google.golang.org/api/cloudbuild/v1" 39 40import ( 41 "bytes" 42 "context" 43 "encoding/json" 44 "errors" 45 "fmt" 46 "io" 47 "net/http" 48 "net/url" 49 "strconv" 50 "strings" 51 52 googleapi "google.golang.org/api/googleapi" 53 gensupport "google.golang.org/api/internal/gensupport" 54 option "google.golang.org/api/option" 55 internaloption "google.golang.org/api/option/internaloption" 56 htransport "google.golang.org/api/transport/http" 57) 58 59// Always reference these packages, just in case the auto-generated code 60// below doesn't. 61var _ = bytes.NewBuffer 62var _ = strconv.Itoa 63var _ = fmt.Sprintf 64var _ = json.NewDecoder 65var _ = io.Copy 66var _ = url.Parse 67var _ = gensupport.MarshalJSON 68var _ = googleapi.Version 69var _ = errors.New 70var _ = strings.Replace 71var _ = context.Canceled 72var _ = internaloption.WithDefaultEndpoint 73 74const apiId = "cloudbuild:v1" 75const apiName = "cloudbuild" 76const apiVersion = "v1" 77const basePath = "https://cloudbuild.googleapis.com/" 78 79// OAuth2 scopes used by this API. 80const ( 81 // View and manage your data across Google Cloud Platform services 82 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 83) 84 85// NewService creates a new Service. 86func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 87 scopesOption := option.WithScopes( 88 "https://www.googleapis.com/auth/cloud-platform", 89 ) 90 // NOTE: prepend, so we don't override user-specified scopes. 91 opts = append([]option.ClientOption{scopesOption}, opts...) 92 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 93 client, endpoint, err := htransport.NewClient(ctx, opts...) 94 if err != nil { 95 return nil, err 96 } 97 s, err := New(client) 98 if err != nil { 99 return nil, err 100 } 101 if endpoint != "" { 102 s.BasePath = endpoint 103 } 104 return s, nil 105} 106 107// New creates a new Service. It uses the provided http.Client for requests. 108// 109// Deprecated: please use NewService instead. 110// To provide a custom HTTP client, use option.WithHTTPClient. 111// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 112func New(client *http.Client) (*Service, error) { 113 if client == nil { 114 return nil, errors.New("client is nil") 115 } 116 s := &Service{client: client, BasePath: basePath} 117 s.Operations = NewOperationsService(s) 118 s.Projects = NewProjectsService(s) 119 return s, nil 120} 121 122type Service struct { 123 client *http.Client 124 BasePath string // API endpoint base URL 125 UserAgent string // optional additional User-Agent fragment 126 127 Operations *OperationsService 128 129 Projects *ProjectsService 130} 131 132func (s *Service) userAgent() string { 133 if s.UserAgent == "" { 134 return googleapi.UserAgent 135 } 136 return googleapi.UserAgent + " " + s.UserAgent 137} 138 139func NewOperationsService(s *Service) *OperationsService { 140 rs := &OperationsService{s: s} 141 return rs 142} 143 144type OperationsService struct { 145 s *Service 146} 147 148func NewProjectsService(s *Service) *ProjectsService { 149 rs := &ProjectsService{s: s} 150 rs.Builds = NewProjectsBuildsService(s) 151 rs.Triggers = NewProjectsTriggersService(s) 152 return rs 153} 154 155type ProjectsService struct { 156 s *Service 157 158 Builds *ProjectsBuildsService 159 160 Triggers *ProjectsTriggersService 161} 162 163func NewProjectsBuildsService(s *Service) *ProjectsBuildsService { 164 rs := &ProjectsBuildsService{s: s} 165 return rs 166} 167 168type ProjectsBuildsService struct { 169 s *Service 170} 171 172func NewProjectsTriggersService(s *Service) *ProjectsTriggersService { 173 rs := &ProjectsTriggersService{s: s} 174 return rs 175} 176 177type ProjectsTriggersService struct { 178 s *Service 179} 180 181// ArtifactObjects: Files in the workspace to upload to Cloud Storage 182// upon successful 183// completion of all build steps. 184type ArtifactObjects struct { 185 // Location: Cloud Storage bucket and optional object path, in the 186 // form 187 // "gs://bucket/path/to/somewhere/". (see [Bucket 188 // Name 189 // Requirements](https://cloud.google.com/storage/docs/bucket-naming 190 // #requirements)). 191 // 192 // Files in the workspace matching any path pattern will be uploaded 193 // to 194 // Cloud Storage with this location as a prefix. 195 Location string `json:"location,omitempty"` 196 197 // Paths: Path globs used to match files in the build's workspace. 198 Paths []string `json:"paths,omitempty"` 199 200 // Timing: Output only. Stores timing information for pushing all 201 // artifact objects. 202 Timing *TimeSpan `json:"timing,omitempty"` 203 204 // ForceSendFields is a list of field names (e.g. "Location") to 205 // unconditionally include in API requests. By default, fields with 206 // empty values are omitted from API requests. However, any non-pointer, 207 // non-interface field appearing in ForceSendFields will be sent to the 208 // server regardless of whether the field is empty or not. This may be 209 // used to include empty fields in Patch requests. 210 ForceSendFields []string `json:"-"` 211 212 // NullFields is a list of field names (e.g. "Location") to include in 213 // API requests with the JSON null value. By default, fields with empty 214 // values are omitted from API requests. However, any field with an 215 // empty value appearing in NullFields will be sent to the server as 216 // null. It is an error if a field in this list has a non-empty value. 217 // This may be used to include null fields in Patch requests. 218 NullFields []string `json:"-"` 219} 220 221func (s *ArtifactObjects) MarshalJSON() ([]byte, error) { 222 type NoMethod ArtifactObjects 223 raw := NoMethod(*s) 224 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 225} 226 227// ArtifactResult: An artifact that was uploaded during a build. This 228// is a single record in the artifact manifest JSON file. 229type ArtifactResult struct { 230 // FileHash: The file hash of the artifact. 231 FileHash []*FileHashes `json:"fileHash,omitempty"` 232 233 // Location: The path of an artifact in a Google Cloud Storage bucket, 234 // with the 235 // generation number. For 236 // example, 237 // `gs://mybucket/path/to/output.jar#generation`. 238 Location string `json:"location,omitempty"` 239 240 // ForceSendFields is a list of field names (e.g. "FileHash") to 241 // unconditionally include in API requests. By default, fields with 242 // empty values are omitted from API requests. However, any non-pointer, 243 // non-interface field appearing in ForceSendFields will be sent to the 244 // server regardless of whether the field is empty or not. This may be 245 // used to include empty fields in Patch requests. 246 ForceSendFields []string `json:"-"` 247 248 // NullFields is a list of field names (e.g. "FileHash") to include in 249 // API requests with the JSON null value. By default, fields with empty 250 // values are omitted from API requests. However, any field with an 251 // empty value appearing in NullFields will be sent to the server as 252 // null. It is an error if a field in this list has a non-empty value. 253 // This may be used to include null fields in Patch requests. 254 NullFields []string `json:"-"` 255} 256 257func (s *ArtifactResult) MarshalJSON() ([]byte, error) { 258 type NoMethod ArtifactResult 259 raw := NoMethod(*s) 260 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 261} 262 263// Artifacts: Artifacts produced by a build that should be uploaded 264// upon 265// successful completion of all build steps. 266type Artifacts struct { 267 // Images: A list of images to be pushed upon the successful completion 268 // of all build 269 // steps. 270 // 271 // The images will be pushed using the builder service account's 272 // credentials. 273 // 274 // The digests of the pushed images will be stored in the Build 275 // resource's 276 // results field. 277 // 278 // If any of the images fail to be pushed, the build is marked FAILURE. 279 Images []string `json:"images,omitempty"` 280 281 // Objects: A list of objects to be uploaded to Cloud Storage upon 282 // successful 283 // completion of all build steps. 284 // 285 // Files in the workspace matching specified paths globs will be 286 // uploaded to 287 // the specified Cloud Storage location using the builder service 288 // account's 289 // credentials. 290 // 291 // The location and generation of the uploaded objects will be stored in 292 // the 293 // Build resource's results field. 294 // 295 // If any objects fail to be pushed, the build is marked FAILURE. 296 Objects *ArtifactObjects `json:"objects,omitempty"` 297 298 // ForceSendFields is a list of field names (e.g. "Images") to 299 // unconditionally include in API requests. By default, fields with 300 // empty values are omitted from API requests. However, any non-pointer, 301 // non-interface field appearing in ForceSendFields will be sent to the 302 // server regardless of whether the field is empty or not. This may be 303 // used to include empty fields in Patch requests. 304 ForceSendFields []string `json:"-"` 305 306 // NullFields is a list of field names (e.g. "Images") to include in API 307 // requests with the JSON null value. By default, fields with empty 308 // values are omitted from API requests. However, any field with an 309 // empty value appearing in NullFields will be sent to the server as 310 // null. It is an error if a field in this list has a non-empty value. 311 // This may be used to include null fields in Patch requests. 312 NullFields []string `json:"-"` 313} 314 315func (s *Artifacts) MarshalJSON() ([]byte, error) { 316 type NoMethod Artifacts 317 raw := NoMethod(*s) 318 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 319} 320 321// Build: A build resource in the Cloud Build API. 322// 323// At a high level, a `Build` describes where to find source code, how 324// to build 325// it (for example, the builder image to run on the source), and where 326// to store 327// the built artifacts. 328// 329// Fields can include the following variables, which will be expanded 330// when the 331// build is created: 332// 333// - $PROJECT_ID: the project ID of the build. 334// - $BUILD_ID: the autogenerated ID of the build. 335// - $REPO_NAME: the source repository name specified by RepoSource. 336// - $BRANCH_NAME: the branch name specified by RepoSource. 337// - $TAG_NAME: the tag name specified by RepoSource. 338// - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource 339// or 340// resolved from the specified branch or tag. 341// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. 342type Build struct { 343 // Artifacts: Artifacts produced by the build that should be uploaded 344 // upon 345 // successful completion of all build steps. 346 Artifacts *Artifacts `json:"artifacts,omitempty"` 347 348 // BuildTriggerId: Output only. The ID of the `BuildTrigger` that 349 // triggered this build, if it 350 // was triggered automatically. 351 BuildTriggerId string `json:"buildTriggerId,omitempty"` 352 353 // CreateTime: Output only. Time at which the request to create the 354 // build was received. 355 CreateTime string `json:"createTime,omitempty"` 356 357 // FinishTime: Output only. Time at which execution of the build was 358 // finished. 359 // 360 // The difference between finish_time and start_time is the duration of 361 // the 362 // build's execution. 363 FinishTime string `json:"finishTime,omitempty"` 364 365 // Id: Output only. Unique identifier of the build. 366 Id string `json:"id,omitempty"` 367 368 // Images: A list of images to be pushed upon the successful completion 369 // of all build 370 // steps. 371 // 372 // The images are pushed using the builder service account's 373 // credentials. 374 // 375 // The digests of the pushed images will be stored in the `Build` 376 // resource's 377 // results field. 378 // 379 // If any of the images fail to be pushed, the build status is 380 // marked 381 // `FAILURE`. 382 Images []string `json:"images,omitempty"` 383 384 // LogUrl: Output only. URL to logs for this build in Google Cloud 385 // Console. 386 LogUrl string `json:"logUrl,omitempty"` 387 388 // LogsBucket: Google Cloud Storage bucket where logs should be written 389 // (see 390 // [Bucket 391 // Name 392 // Requirements](https://cloud.google.com/storage/docs/bucket-naming 393 // #requirements)). 394 // Logs file names will be of the format 395 // `${logs_bucket}/log-${build_id}.txt`. 396 LogsBucket string `json:"logsBucket,omitempty"` 397 398 // Options: Special options for this build. 399 Options *BuildOptions `json:"options,omitempty"` 400 401 // ProjectId: Output only. ID of the project. 402 ProjectId string `json:"projectId,omitempty"` 403 404 // Results: Output only. Results of the build. 405 Results *Results `json:"results,omitempty"` 406 407 // Secrets: Secrets to decrypt using Cloud Key Management Service. 408 Secrets []*Secret `json:"secrets,omitempty"` 409 410 // Source: The location of the source files to build. 411 Source *Source `json:"source,omitempty"` 412 413 // SourceProvenance: Output only. A permanent fixed identifier for 414 // source. 415 SourceProvenance *SourceProvenance `json:"sourceProvenance,omitempty"` 416 417 // StartTime: Output only. Time at which execution of the build was 418 // started. 419 StartTime string `json:"startTime,omitempty"` 420 421 // Status: Output only. Status of the build. 422 // 423 // Possible values: 424 // "STATUS_UNKNOWN" - Status of the build is unknown. 425 // "QUEUED" - Build or step is queued; work has not yet begun. 426 // "WORKING" - Build or step is being executed. 427 // "SUCCESS" - Build or step finished successfully. 428 // "FAILURE" - Build or step failed to complete successfully. 429 // "INTERNAL_ERROR" - Build or step failed due to an internal cause. 430 // "TIMEOUT" - Build or step took longer than was allowed. 431 // "CANCELLED" - Build or step was canceled by a user. 432 Status string `json:"status,omitempty"` 433 434 // StatusDetail: Output only. Customer-readable message about the 435 // current status. 436 StatusDetail string `json:"statusDetail,omitempty"` 437 438 // Steps: Required. The operations to be performed on the workspace. 439 Steps []*BuildStep `json:"steps,omitempty"` 440 441 // Substitutions: Substitutions data for `Build` resource. 442 Substitutions map[string]string `json:"substitutions,omitempty"` 443 444 // Tags: Tags for annotation of a `Build`. These are not docker tags. 445 Tags []string `json:"tags,omitempty"` 446 447 // Timeout: Amount of time that this build should be allowed to run, to 448 // second 449 // granularity. If this amount of time elapses, work on the build will 450 // cease 451 // and the build status will be `TIMEOUT`. 452 // 453 // Default time is ten minutes. 454 Timeout string `json:"timeout,omitempty"` 455 456 // Timing: Output only. Stores timing information for phases of the 457 // build. Valid keys 458 // are: 459 // 460 // * BUILD: time to execute all build steps 461 // * PUSH: time to push all specified images. 462 // * FETCHSOURCE: time to fetch source. 463 // 464 // If the build does not specify source or images, 465 // these keys will not be included. 466 Timing map[string]TimeSpan `json:"timing,omitempty"` 467 468 // ServerResponse contains the HTTP response code and headers from the 469 // server. 470 googleapi.ServerResponse `json:"-"` 471 472 // ForceSendFields is a list of field names (e.g. "Artifacts") to 473 // unconditionally include in API requests. By default, fields with 474 // empty values are omitted from API requests. However, any non-pointer, 475 // non-interface field appearing in ForceSendFields will be sent to the 476 // server regardless of whether the field is empty or not. This may be 477 // used to include empty fields in Patch requests. 478 ForceSendFields []string `json:"-"` 479 480 // NullFields is a list of field names (e.g. "Artifacts") to include in 481 // API requests with the JSON null value. By default, fields with empty 482 // values are omitted from API requests. However, any field with an 483 // empty value appearing in NullFields will be sent to the server as 484 // null. It is an error if a field in this list has a non-empty value. 485 // This may be used to include null fields in Patch requests. 486 NullFields []string `json:"-"` 487} 488 489func (s *Build) MarshalJSON() ([]byte, error) { 490 type NoMethod Build 491 raw := NoMethod(*s) 492 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 493} 494 495// BuildOperationMetadata: Metadata for build operations. 496type BuildOperationMetadata struct { 497 // Build: The build that the operation is tracking. 498 Build *Build `json:"build,omitempty"` 499 500 // ForceSendFields is a list of field names (e.g. "Build") to 501 // unconditionally include in API requests. By default, fields with 502 // empty values are omitted from API requests. However, any non-pointer, 503 // non-interface field appearing in ForceSendFields will be sent to the 504 // server regardless of whether the field is empty or not. This may be 505 // used to include empty fields in Patch requests. 506 ForceSendFields []string `json:"-"` 507 508 // NullFields is a list of field names (e.g. "Build") to include in API 509 // requests with the JSON null value. By default, fields with empty 510 // values are omitted from API requests. However, any field with an 511 // empty value appearing in NullFields will be sent to the server as 512 // null. It is an error if a field in this list has a non-empty value. 513 // This may be used to include null fields in Patch requests. 514 NullFields []string `json:"-"` 515} 516 517func (s *BuildOperationMetadata) MarshalJSON() ([]byte, error) { 518 type NoMethod BuildOperationMetadata 519 raw := NoMethod(*s) 520 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 521} 522 523// BuildOptions: Optional arguments to enable specific features of 524// builds. 525type BuildOptions struct { 526 // DiskSizeGb: Requested disk size for the VM that runs the build. Note 527 // that this is *NOT* 528 // "disk free"; some of the space will be used by the operating system 529 // and 530 // build utilities. Also note that this is the minimum disk size that 531 // will be 532 // allocated for the build -- the build may run with a larger disk 533 // than 534 // requested. At present, the maximum disk size is 1000GB; builds that 535 // request 536 // more than the maximum are rejected with an error. 537 DiskSizeGb int64 `json:"diskSizeGb,omitempty,string"` 538 539 // Env: A list of global environment variable definitions that will 540 // exist for all 541 // build steps in this build. If a variable is defined in both globally 542 // and in 543 // a build step, the variable will use the build step value. 544 // 545 // The elements are of the form "KEY=VALUE" for the environment variable 546 // "KEY" 547 // being given the value "VALUE". 548 Env []string `json:"env,omitempty"` 549 550 // LogStreamingOption: Option to define build log streaming behavior to 551 // Google Cloud 552 // Storage. 553 // 554 // Possible values: 555 // "STREAM_DEFAULT" - Service may automatically determine build log 556 // streaming behavior. 557 // "STREAM_ON" - Build logs should be streamed to Google Cloud 558 // Storage. 559 // "STREAM_OFF" - Build logs should not be streamed to Google Cloud 560 // Storage; they will be 561 // written when the build is completed. 562 LogStreamingOption string `json:"logStreamingOption,omitempty"` 563 564 // Logging: Option to specify the logging mode, which determines where 565 // the logs are 566 // stored. 567 // 568 // Possible values: 569 // "LOGGING_UNSPECIFIED" - The service determines the logging mode. 570 // The default is `LEGACY`. Do not 571 // rely on the default logging behavior as it may change in the future. 572 // "LEGACY" - Stackdriver logging and Cloud Storage logging are 573 // enabled. 574 // "GCS_ONLY" - Only Cloud Storage logging is enabled. 575 Logging string `json:"logging,omitempty"` 576 577 // MachineType: Compute Engine machine type on which to run the build. 578 // 579 // Possible values: 580 // "UNSPECIFIED" - Standard machine type. 581 // "N1_HIGHCPU_8" - Highcpu machine with 8 CPUs. 582 // "N1_HIGHCPU_32" - Highcpu machine with 32 CPUs. 583 MachineType string `json:"machineType,omitempty"` 584 585 // RequestedVerifyOption: Requested verifiability options. 586 // 587 // Possible values: 588 // "NOT_VERIFIED" - Not a verifiable build. (default) 589 // "VERIFIED" - Verified build. 590 RequestedVerifyOption string `json:"requestedVerifyOption,omitempty"` 591 592 // SecretEnv: A list of global environment variables, which are 593 // encrypted using a Cloud 594 // Key Management Service crypto key. These values must be specified in 595 // the 596 // build's `Secret`. These variables will be available to all build 597 // steps 598 // in this build. 599 SecretEnv []string `json:"secretEnv,omitempty"` 600 601 // SourceProvenanceHash: Requested hash for SourceProvenance. 602 // 603 // Possible values: 604 // "NONE" - No hash requested. 605 // "SHA256" - Use a sha256 hash. 606 // "MD5" - Use a md5 hash. 607 SourceProvenanceHash []string `json:"sourceProvenanceHash,omitempty"` 608 609 // SubstitutionOption: Option to specify behavior when there is an error 610 // in the substitution 611 // checks. 612 // 613 // Possible values: 614 // "MUST_MATCH" - Fails the build if error in substitutions checks, 615 // like missing 616 // a substitution in the template or in the map. 617 // "ALLOW_LOOSE" - Do not fail the build if error in substitutions 618 // checks. 619 SubstitutionOption string `json:"substitutionOption,omitempty"` 620 621 // Volumes: Global list of volumes to mount for ALL build steps 622 // 623 // Each volume is created as an empty volume prior to starting the 624 // build 625 // process. Upon completion of the build, volumes and their contents 626 // are 627 // discarded. Global volume names and paths cannot conflict with the 628 // volumes 629 // defined a build step. 630 // 631 // Using a global volume in a build with only one step is not valid 632 // as 633 // it is indicative of a build request with an incorrect configuration. 634 Volumes []*Volume `json:"volumes,omitempty"` 635 636 // WorkerPool: Option to specify a `WorkerPool` for the build. 637 // Format: projects/{project}/workerPools/{workerPool} 638 // 639 // This field is experimental. 640 WorkerPool string `json:"workerPool,omitempty"` 641 642 // ForceSendFields is a list of field names (e.g. "DiskSizeGb") to 643 // unconditionally include in API requests. By default, fields with 644 // empty values are omitted from API requests. However, any non-pointer, 645 // non-interface field appearing in ForceSendFields will be sent to the 646 // server regardless of whether the field is empty or not. This may be 647 // used to include empty fields in Patch requests. 648 ForceSendFields []string `json:"-"` 649 650 // NullFields is a list of field names (e.g. "DiskSizeGb") to include in 651 // API requests with the JSON null value. By default, fields with empty 652 // values are omitted from API requests. However, any field with an 653 // empty value appearing in NullFields will be sent to the server as 654 // null. It is an error if a field in this list has a non-empty value. 655 // This may be used to include null fields in Patch requests. 656 NullFields []string `json:"-"` 657} 658 659func (s *BuildOptions) MarshalJSON() ([]byte, error) { 660 type NoMethod BuildOptions 661 raw := NoMethod(*s) 662 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 663} 664 665// BuildStep: A step in the build pipeline. 666type BuildStep struct { 667 // Args: A list of arguments that will be presented to the step when it 668 // is started. 669 // 670 // If the image used to run the step's container has an entrypoint, the 671 // `args` 672 // are used as arguments to that entrypoint. If the image does not 673 // define 674 // an entrypoint, the first element in args is used as the 675 // entrypoint, 676 // and the remainder will be used as arguments. 677 Args []string `json:"args,omitempty"` 678 679 // Dir: Working directory to use when running this step's container. 680 // 681 // If this value is a relative path, it is relative to the build's 682 // working 683 // directory. If this value is absolute, it may be outside the build's 684 // working 685 // directory, in which case the contents of the path may not be 686 // persisted 687 // across build step executions, unless a `volume` for that path is 688 // specified. 689 // 690 // If the build specifies a `RepoSource` with `dir` and a step with a 691 // `dir`, 692 // which specifies an absolute path, the `RepoSource` `dir` is ignored 693 // for 694 // the step's execution. 695 Dir string `json:"dir,omitempty"` 696 697 // Entrypoint: Entrypoint to be used instead of the build step image's 698 // default entrypoint. 699 // If unset, the image's default entrypoint is used. 700 Entrypoint string `json:"entrypoint,omitempty"` 701 702 // Env: A list of environment variable definitions to be used when 703 // running a step. 704 // 705 // The elements are of the form "KEY=VALUE" for the environment variable 706 // "KEY" 707 // being given the value "VALUE". 708 Env []string `json:"env,omitempty"` 709 710 // Id: Unique identifier for this build step, used in `wait_for` 711 // to 712 // reference this build step as a dependency. 713 Id string `json:"id,omitempty"` 714 715 // Name: Required. The name of the container image that will run this 716 // particular 717 // build step. 718 // 719 // If the image is available in the host's Docker daemon's cache, 720 // it 721 // will be run directly. If not, the host will attempt to pull the 722 // image 723 // first, using the builder service account's credentials if 724 // necessary. 725 // 726 // The Docker daemon's cache will already have the latest versions of 727 // all of 728 // the officially supported build 729 // steps 730 // ([https://github.com/GoogleCloudPlatform/cloud-builders](https:/ 731 // /github.com/GoogleCloudPlatform/cloud-builders)). 732 // The Docker daemon will also have cached many of the layers for some 733 // popular 734 // images, like "ubuntu", "debian", but they will be refreshed at the 735 // time you 736 // attempt to use them. 737 // 738 // If you built an image in a previous build step, it will be stored in 739 // the 740 // host's Docker daemon's cache and is available to use as the name for 741 // a 742 // later build step. 743 Name string `json:"name,omitempty"` 744 745 // PullTiming: Output only. Stores timing information for pulling this 746 // build step's 747 // builder image only. 748 PullTiming *TimeSpan `json:"pullTiming,omitempty"` 749 750 // SecretEnv: A list of environment variables which are encrypted using 751 // a Cloud Key 752 // Management Service crypto key. These values must be specified in 753 // the 754 // build's `Secret`. 755 SecretEnv []string `json:"secretEnv,omitempty"` 756 757 // Status: Output only. Status of the build step. At this time, build 758 // step status is 759 // only updated on build completion; step status is not updated in 760 // real-time 761 // as the build progresses. 762 // 763 // Possible values: 764 // "STATUS_UNKNOWN" - Status of the build is unknown. 765 // "QUEUED" - Build or step is queued; work has not yet begun. 766 // "WORKING" - Build or step is being executed. 767 // "SUCCESS" - Build or step finished successfully. 768 // "FAILURE" - Build or step failed to complete successfully. 769 // "INTERNAL_ERROR" - Build or step failed due to an internal cause. 770 // "TIMEOUT" - Build or step took longer than was allowed. 771 // "CANCELLED" - Build or step was canceled by a user. 772 Status string `json:"status,omitempty"` 773 774 // Timeout: Time limit for executing this build step. If not defined, 775 // the step has no 776 // time limit and will be allowed to continue to run until either it 777 // completes 778 // or the build itself times out. 779 Timeout string `json:"timeout,omitempty"` 780 781 // Timing: Output only. Stores timing information for executing this 782 // build step. 783 Timing *TimeSpan `json:"timing,omitempty"` 784 785 // Volumes: List of volumes to mount into the build step. 786 // 787 // Each volume is created as an empty volume prior to execution of 788 // the 789 // build step. Upon completion of the build, volumes and their contents 790 // are 791 // discarded. 792 // 793 // Using a named volume in only one step is not valid as it is 794 // indicative 795 // of a build request with an incorrect configuration. 796 Volumes []*Volume `json:"volumes,omitempty"` 797 798 // WaitFor: The ID(s) of the step(s) that this build step depends 799 // on. 800 // This build step will not start until all the build steps in 801 // `wait_for` 802 // have completed successfully. If `wait_for` is empty, this build step 803 // will 804 // start when all previous build steps in the `Build.Steps` list 805 // have 806 // completed successfully. 807 WaitFor []string `json:"waitFor,omitempty"` 808 809 // ForceSendFields is a list of field names (e.g. "Args") to 810 // unconditionally include in API requests. By default, fields with 811 // empty values are omitted from API requests. However, any non-pointer, 812 // non-interface field appearing in ForceSendFields will be sent to the 813 // server regardless of whether the field is empty or not. This may be 814 // used to include empty fields in Patch requests. 815 ForceSendFields []string `json:"-"` 816 817 // NullFields is a list of field names (e.g. "Args") to include in API 818 // requests with the JSON null value. By default, fields with empty 819 // values are omitted from API requests. However, any field with an 820 // empty value appearing in NullFields will be sent to the server as 821 // null. It is an error if a field in this list has a non-empty value. 822 // This may be used to include null fields in Patch requests. 823 NullFields []string `json:"-"` 824} 825 826func (s *BuildStep) MarshalJSON() ([]byte, error) { 827 type NoMethod BuildStep 828 raw := NoMethod(*s) 829 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 830} 831 832// BuildTrigger: Configuration for an automated build in response to 833// source repository 834// changes. 835type BuildTrigger struct { 836 // Build: Contents of the build template. 837 Build *Build `json:"build,omitempty"` 838 839 // CreateTime: Output only. Time when the trigger was created. 840 CreateTime string `json:"createTime,omitempty"` 841 842 // Description: Human-readable description of this trigger. 843 Description string `json:"description,omitempty"` 844 845 // Disabled: If true, the trigger will never result in a build. 846 Disabled bool `json:"disabled,omitempty"` 847 848 // Filename: Path, from the source root, to a file whose contents is 849 // used for the 850 // template. 851 Filename string `json:"filename,omitempty"` 852 853 // Github: GitHubEventsConfig describes the configuration of a trigger 854 // that creates 855 // a build whenever a GitHub event is received. 856 // 857 // Mutually exclusive with `trigger_template`. 858 Github *GitHubEventsConfig `json:"github,omitempty"` 859 860 // Id: Output only. Unique identifier of the trigger. 861 Id string `json:"id,omitempty"` 862 863 // IgnoredFiles: ignored_files and included_files are file glob matches 864 // using 865 // https://golang.org/pkg/path/filepath/#Match extended with support for 866 // "**". 867 // 868 // If ignored_files and changed files are both empty, then they are 869 // not used to determine whether or not to trigger a build. 870 // 871 // If ignored_files is not empty, then we ignore any files that 872 // match 873 // any of the ignored_file globs. If the change has no files that 874 // are 875 // outside of the ignored_files globs, then we do not trigger a build. 876 IgnoredFiles []string `json:"ignoredFiles,omitempty"` 877 878 // IncludedFiles: If any of the files altered in the commit pass the 879 // ignored_files 880 // filter and included_files is empty, then as far as this filter 881 // is 882 // concerned, we should trigger the build. 883 // 884 // If any of the files altered in the commit pass the 885 // ignored_files 886 // filter and included_files is not empty, then we make sure that 887 // at 888 // least one of those files matches a included_files glob. If not, 889 // then we do not trigger a build. 890 IncludedFiles []string `json:"includedFiles,omitempty"` 891 892 // Name: User-assigned name of the trigger. Must be unique within the 893 // project. 894 // Trigger names must meet the following requirements: 895 // 896 // + They must contain only alphanumeric characters and dashes. 897 // + They can be 1-64 characters long. 898 // + They must begin and end with an alphanumeric character. 899 Name string `json:"name,omitempty"` 900 901 // Substitutions: Substitutions data for Build resource. 902 Substitutions map[string]string `json:"substitutions,omitempty"` 903 904 // Tags: Tags for annotation of a `BuildTrigger` 905 Tags []string `json:"tags,omitempty"` 906 907 // TriggerTemplate: Template describing the types of source changes to 908 // trigger a build. 909 // 910 // Branch and tag names in trigger templates are interpreted as 911 // regular 912 // expressions. Any branch or tag change that matches that regular 913 // expression 914 // will trigger a build. 915 // 916 // Mutually exclusive with `github`. 917 TriggerTemplate *RepoSource `json:"triggerTemplate,omitempty"` 918 919 // ServerResponse contains the HTTP response code and headers from the 920 // server. 921 googleapi.ServerResponse `json:"-"` 922 923 // ForceSendFields is a list of field names (e.g. "Build") to 924 // unconditionally include in API requests. By default, fields with 925 // empty values are omitted from API requests. However, any non-pointer, 926 // non-interface field appearing in ForceSendFields will be sent to the 927 // server regardless of whether the field is empty or not. This may be 928 // used to include empty fields in Patch requests. 929 ForceSendFields []string `json:"-"` 930 931 // NullFields is a list of field names (e.g. "Build") to include in API 932 // requests with the JSON null value. By default, fields with empty 933 // values are omitted from API requests. However, any field with an 934 // empty value appearing in NullFields will be sent to the server as 935 // null. It is an error if a field in this list has a non-empty value. 936 // This may be used to include null fields in Patch requests. 937 NullFields []string `json:"-"` 938} 939 940func (s *BuildTrigger) MarshalJSON() ([]byte, error) { 941 type NoMethod BuildTrigger 942 raw := NoMethod(*s) 943 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 944} 945 946// BuiltImage: An image built by the pipeline. 947type BuiltImage struct { 948 // Digest: Docker Registry 2.0 digest. 949 Digest string `json:"digest,omitempty"` 950 951 // Name: Name used to push the container image to Google Container 952 // Registry, as 953 // presented to `docker push`. 954 Name string `json:"name,omitempty"` 955 956 // PushTiming: Output only. Stores timing information for pushing the 957 // specified image. 958 PushTiming *TimeSpan `json:"pushTiming,omitempty"` 959 960 // ForceSendFields is a list of field names (e.g. "Digest") to 961 // unconditionally include in API requests. By default, fields with 962 // empty values are omitted from API requests. However, any non-pointer, 963 // non-interface field appearing in ForceSendFields will be sent to the 964 // server regardless of whether the field is empty or not. This may be 965 // used to include empty fields in Patch requests. 966 ForceSendFields []string `json:"-"` 967 968 // NullFields is a list of field names (e.g. "Digest") to include in API 969 // requests with the JSON null value. By default, fields with empty 970 // values are omitted from API requests. However, any field with an 971 // empty value appearing in NullFields will be sent to the server as 972 // null. It is an error if a field in this list has a non-empty value. 973 // This may be used to include null fields in Patch requests. 974 NullFields []string `json:"-"` 975} 976 977func (s *BuiltImage) MarshalJSON() ([]byte, error) { 978 type NoMethod BuiltImage 979 raw := NoMethod(*s) 980 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 981} 982 983// CancelBuildRequest: Request to cancel an ongoing build. 984type CancelBuildRequest struct { 985} 986 987// CancelOperationRequest: The request message for 988// Operations.CancelOperation. 989type CancelOperationRequest struct { 990} 991 992// Empty: A generic empty message that you can re-use to avoid defining 993// duplicated 994// empty messages in your APIs. A typical example is to use it as the 995// request 996// or the response type of an API method. For instance: 997// 998// service Foo { 999// rpc Bar(google.protobuf.Empty) returns 1000// (google.protobuf.Empty); 1001// } 1002// 1003// The JSON representation for `Empty` is empty JSON object `{}`. 1004type Empty struct { 1005 // ServerResponse contains the HTTP response code and headers from the 1006 // server. 1007 googleapi.ServerResponse `json:"-"` 1008} 1009 1010// FileHashes: Container message for hashes of byte content of files, 1011// used in 1012// SourceProvenance messages to verify integrity of source input to the 1013// build. 1014type FileHashes struct { 1015 // FileHash: Collection of file hashes. 1016 FileHash []*Hash `json:"fileHash,omitempty"` 1017 1018 // ForceSendFields is a list of field names (e.g. "FileHash") to 1019 // unconditionally include in API requests. By default, fields with 1020 // empty values are omitted from API requests. However, any non-pointer, 1021 // non-interface field appearing in ForceSendFields will be sent to the 1022 // server regardless of whether the field is empty or not. This may be 1023 // used to include empty fields in Patch requests. 1024 ForceSendFields []string `json:"-"` 1025 1026 // NullFields is a list of field names (e.g. "FileHash") to include in 1027 // API requests with the JSON null value. By default, fields with empty 1028 // values are omitted from API requests. However, any field with an 1029 // empty value appearing in NullFields will be sent to the server as 1030 // null. It is an error if a field in this list has a non-empty value. 1031 // This may be used to include null fields in Patch requests. 1032 NullFields []string `json:"-"` 1033} 1034 1035func (s *FileHashes) MarshalJSON() ([]byte, error) { 1036 type NoMethod FileHashes 1037 raw := NoMethod(*s) 1038 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1039} 1040 1041// GitHubEventsConfig: GitHubEventsConfig describes the configuration of 1042// a trigger that creates a 1043// build whenever a GitHub event is received. 1044// 1045// This message is experimental. 1046type GitHubEventsConfig struct { 1047 // InstallationId: The installationID that emits the GitHub event. 1048 InstallationId int64 `json:"installationId,omitempty,string"` 1049 1050 // Name: Name of the repository. For example: The name 1051 // for 1052 // https://github.com/googlecloudplatform/cloud-builders is 1053 // "cloud-builders". 1054 Name string `json:"name,omitempty"` 1055 1056 // Owner: Owner of the repository. For example: The owner 1057 // for 1058 // https://github.com/googlecloudplatform/cloud-builders 1059 // is 1060 // "googlecloudplatform". 1061 Owner string `json:"owner,omitempty"` 1062 1063 // PullRequest: filter to match changes in pull requests. 1064 PullRequest *PullRequestFilter `json:"pullRequest,omitempty"` 1065 1066 // Push: filter to match changes in refs like branches, tags. 1067 Push *PushFilter `json:"push,omitempty"` 1068 1069 // ForceSendFields is a list of field names (e.g. "InstallationId") to 1070 // unconditionally include in API requests. By default, fields with 1071 // empty values are omitted from API requests. However, any non-pointer, 1072 // non-interface field appearing in ForceSendFields will be sent to the 1073 // server regardless of whether the field is empty or not. This may be 1074 // used to include empty fields in Patch requests. 1075 ForceSendFields []string `json:"-"` 1076 1077 // NullFields is a list of field names (e.g. "InstallationId") to 1078 // include in API requests with the JSON null value. By default, fields 1079 // with empty values are omitted from API requests. However, any field 1080 // with an empty value appearing in NullFields will be sent to the 1081 // server as null. It is an error if a field in this list has a 1082 // non-empty value. This may be used to include null fields in Patch 1083 // requests. 1084 NullFields []string `json:"-"` 1085} 1086 1087func (s *GitHubEventsConfig) MarshalJSON() ([]byte, error) { 1088 type NoMethod GitHubEventsConfig 1089 raw := NoMethod(*s) 1090 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1091} 1092 1093// Hash: Container message for hash values. 1094type Hash struct { 1095 // Type: The type of hash that was performed. 1096 // 1097 // Possible values: 1098 // "NONE" - No hash requested. 1099 // "SHA256" - Use a sha256 hash. 1100 // "MD5" - Use a md5 hash. 1101 Type string `json:"type,omitempty"` 1102 1103 // Value: The hash value. 1104 Value string `json:"value,omitempty"` 1105 1106 // ForceSendFields is a list of field names (e.g. "Type") to 1107 // unconditionally include in API requests. By default, fields with 1108 // empty values are omitted from API requests. However, any non-pointer, 1109 // non-interface field appearing in ForceSendFields will be sent to the 1110 // server regardless of whether the field is empty or not. This may be 1111 // used to include empty fields in Patch requests. 1112 ForceSendFields []string `json:"-"` 1113 1114 // NullFields is a list of field names (e.g. "Type") to include in API 1115 // requests with the JSON null value. By default, fields with empty 1116 // values are omitted from API requests. However, any field with an 1117 // empty value appearing in NullFields will be sent to the server as 1118 // null. It is an error if a field in this list has a non-empty value. 1119 // This may be used to include null fields in Patch requests. 1120 NullFields []string `json:"-"` 1121} 1122 1123func (s *Hash) MarshalJSON() ([]byte, error) { 1124 type NoMethod Hash 1125 raw := NoMethod(*s) 1126 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1127} 1128 1129// ListBuildTriggersResponse: Response containing existing 1130// `BuildTriggers`. 1131type ListBuildTriggersResponse struct { 1132 // NextPageToken: Token to receive the next page of results. 1133 NextPageToken string `json:"nextPageToken,omitempty"` 1134 1135 // Triggers: `BuildTriggers` for the project, sorted by `create_time` 1136 // descending. 1137 Triggers []*BuildTrigger `json:"triggers,omitempty"` 1138 1139 // ServerResponse contains the HTTP response code and headers from the 1140 // server. 1141 googleapi.ServerResponse `json:"-"` 1142 1143 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 1144 // unconditionally include in API requests. By default, fields with 1145 // empty values are omitted from API requests. However, any non-pointer, 1146 // non-interface field appearing in ForceSendFields will be sent to the 1147 // server regardless of whether the field is empty or not. This may be 1148 // used to include empty fields in Patch requests. 1149 ForceSendFields []string `json:"-"` 1150 1151 // NullFields is a list of field names (e.g. "NextPageToken") to include 1152 // in API requests with the JSON null value. By default, fields with 1153 // empty values are omitted from API requests. However, any field with 1154 // an empty value appearing in NullFields will be sent to the server as 1155 // null. It is an error if a field in this list has a non-empty value. 1156 // This may be used to include null fields in Patch requests. 1157 NullFields []string `json:"-"` 1158} 1159 1160func (s *ListBuildTriggersResponse) MarshalJSON() ([]byte, error) { 1161 type NoMethod ListBuildTriggersResponse 1162 raw := NoMethod(*s) 1163 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1164} 1165 1166// ListBuildsResponse: Response including listed builds. 1167type ListBuildsResponse struct { 1168 // Builds: Builds will be sorted by `create_time`, descending. 1169 Builds []*Build `json:"builds,omitempty"` 1170 1171 // NextPageToken: Token to receive the next page of results. 1172 NextPageToken string `json:"nextPageToken,omitempty"` 1173 1174 // ServerResponse contains the HTTP response code and headers from the 1175 // server. 1176 googleapi.ServerResponse `json:"-"` 1177 1178 // ForceSendFields is a list of field names (e.g. "Builds") to 1179 // unconditionally include in API requests. By default, fields with 1180 // empty values are omitted from API requests. However, any non-pointer, 1181 // non-interface field appearing in ForceSendFields will be sent to the 1182 // server regardless of whether the field is empty or not. This may be 1183 // used to include empty fields in Patch requests. 1184 ForceSendFields []string `json:"-"` 1185 1186 // NullFields is a list of field names (e.g. "Builds") to include in API 1187 // requests with the JSON null value. By default, fields with empty 1188 // values are omitted from API requests. However, any field with an 1189 // empty value appearing in NullFields will be sent to the server as 1190 // null. It is an error if a field in this list has a non-empty value. 1191 // This may be used to include null fields in Patch requests. 1192 NullFields []string `json:"-"` 1193} 1194 1195func (s *ListBuildsResponse) MarshalJSON() ([]byte, error) { 1196 type NoMethod ListBuildsResponse 1197 raw := NoMethod(*s) 1198 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1199} 1200 1201// ListOperationsResponse: The response message for 1202// Operations.ListOperations. 1203type ListOperationsResponse struct { 1204 // NextPageToken: The standard List next-page token. 1205 NextPageToken string `json:"nextPageToken,omitempty"` 1206 1207 // Operations: A list of operations that matches the specified filter in 1208 // the request. 1209 Operations []*Operation `json:"operations,omitempty"` 1210 1211 // ServerResponse contains the HTTP response code and headers from the 1212 // server. 1213 googleapi.ServerResponse `json:"-"` 1214 1215 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 1216 // unconditionally include in API requests. By default, fields with 1217 // empty values are omitted from API requests. However, any non-pointer, 1218 // non-interface field appearing in ForceSendFields will be sent to the 1219 // server regardless of whether the field is empty or not. This may be 1220 // used to include empty fields in Patch requests. 1221 ForceSendFields []string `json:"-"` 1222 1223 // NullFields is a list of field names (e.g. "NextPageToken") to include 1224 // in API requests with the JSON null value. By default, fields with 1225 // empty values are omitted from API requests. However, any field with 1226 // an empty value appearing in NullFields will be sent to the server as 1227 // null. It is an error if a field in this list has a non-empty value. 1228 // This may be used to include null fields in Patch requests. 1229 NullFields []string `json:"-"` 1230} 1231 1232func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) { 1233 type NoMethod ListOperationsResponse 1234 raw := NoMethod(*s) 1235 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1236} 1237 1238// Operation: This resource represents a long-running operation that is 1239// the result of a 1240// network API call. 1241type Operation struct { 1242 // Done: If the value is `false`, it means the operation is still in 1243 // progress. 1244 // If `true`, the operation is completed, and either `error` or 1245 // `response` is 1246 // available. 1247 Done bool `json:"done,omitempty"` 1248 1249 // Error: The error result of the operation in case of failure or 1250 // cancellation. 1251 Error *Status `json:"error,omitempty"` 1252 1253 // Metadata: Service-specific metadata associated with the operation. 1254 // It typically 1255 // contains progress information and common metadata such as create 1256 // time. 1257 // Some services might not provide such metadata. Any method that 1258 // returns a 1259 // long-running operation should document the metadata type, if any. 1260 Metadata googleapi.RawMessage `json:"metadata,omitempty"` 1261 1262 // Name: The server-assigned name, which is only unique within the same 1263 // service that 1264 // originally returns it. If you use the default HTTP mapping, 1265 // the 1266 // `name` should be a resource name ending with 1267 // `operations/{unique_id}`. 1268 Name string `json:"name,omitempty"` 1269 1270 // Response: The normal response of the operation in case of success. 1271 // If the original 1272 // method returns no data on success, such as `Delete`, the response 1273 // is 1274 // `google.protobuf.Empty`. If the original method is 1275 // standard 1276 // `Get`/`Create`/`Update`, the response should be the resource. For 1277 // other 1278 // methods, the response should have the type `XxxResponse`, where 1279 // `Xxx` 1280 // is the original method name. For example, if the original method 1281 // name 1282 // is `TakeSnapshot()`, the inferred response type 1283 // is 1284 // `TakeSnapshotResponse`. 1285 Response googleapi.RawMessage `json:"response,omitempty"` 1286 1287 // ServerResponse contains the HTTP response code and headers from the 1288 // server. 1289 googleapi.ServerResponse `json:"-"` 1290 1291 // ForceSendFields is a list of field names (e.g. "Done") to 1292 // unconditionally include in API requests. By default, fields with 1293 // empty values are omitted from API requests. However, any non-pointer, 1294 // non-interface field appearing in ForceSendFields will be sent to the 1295 // server regardless of whether the field is empty or not. This may be 1296 // used to include empty fields in Patch requests. 1297 ForceSendFields []string `json:"-"` 1298 1299 // NullFields is a list of field names (e.g. "Done") to include in API 1300 // requests with the JSON null value. By default, fields with empty 1301 // values are omitted from API requests. However, any field with an 1302 // empty value appearing in NullFields will be sent to the server as 1303 // null. It is an error if a field in this list has a non-empty value. 1304 // This may be used to include null fields in Patch requests. 1305 NullFields []string `json:"-"` 1306} 1307 1308func (s *Operation) MarshalJSON() ([]byte, error) { 1309 type NoMethod Operation 1310 raw := NoMethod(*s) 1311 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1312} 1313 1314// PullRequestFilter: PullRequestFilter contains filter properties for 1315// matching GitHub Pull 1316// Requests. 1317type PullRequestFilter struct { 1318 // Branch: Regex of branches to match. 1319 // 1320 // The syntax of the regular expressions accepted is the syntax accepted 1321 // by 1322 // RE2 and described at https://github.com/google/re2/wiki/Syntax 1323 Branch string `json:"branch,omitempty"` 1324 1325 // CommentControl: Whether to block builds on a "/gcbrun" comment from a 1326 // repository admin or 1327 // collaborator. 1328 // 1329 // Possible values: 1330 // "COMMENTS_DISABLED" - Do not require comments on Pull Requests 1331 // before builds are triggered. 1332 // "COMMENTS_ENABLED" - Enforce that repository owners or 1333 // collaborators must comment on Pull 1334 // Requests before builds are triggered. 1335 CommentControl string `json:"commentControl,omitempty"` 1336 1337 // ForceSendFields is a list of field names (e.g. "Branch") to 1338 // unconditionally include in API requests. By default, fields with 1339 // empty values are omitted from API requests. However, any non-pointer, 1340 // non-interface field appearing in ForceSendFields will be sent to the 1341 // server regardless of whether the field is empty or not. This may be 1342 // used to include empty fields in Patch requests. 1343 ForceSendFields []string `json:"-"` 1344 1345 // NullFields is a list of field names (e.g. "Branch") to include in API 1346 // requests with the JSON null value. By default, fields with empty 1347 // values are omitted from API requests. However, any field with an 1348 // empty value appearing in NullFields will be sent to the server as 1349 // null. It is an error if a field in this list has a non-empty value. 1350 // This may be used to include null fields in Patch requests. 1351 NullFields []string `json:"-"` 1352} 1353 1354func (s *PullRequestFilter) MarshalJSON() ([]byte, error) { 1355 type NoMethod PullRequestFilter 1356 raw := NoMethod(*s) 1357 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1358} 1359 1360// PushFilter: Push contains filter properties for matching GitHub git 1361// pushes. 1362type PushFilter struct { 1363 // Branch: Regexes matching branches to build. 1364 // 1365 // The syntax of the regular expressions accepted is the syntax accepted 1366 // by 1367 // RE2 and described at https://github.com/google/re2/wiki/Syntax 1368 Branch string `json:"branch,omitempty"` 1369 1370 // Tag: Regexes matching tags to build. 1371 // 1372 // The syntax of the regular expressions accepted is the syntax accepted 1373 // by 1374 // RE2 and described at https://github.com/google/re2/wiki/Syntax 1375 Tag string `json:"tag,omitempty"` 1376 1377 // ForceSendFields is a list of field names (e.g. "Branch") to 1378 // unconditionally include in API requests. By default, fields with 1379 // empty values are omitted from API requests. However, any non-pointer, 1380 // non-interface field appearing in ForceSendFields will be sent to the 1381 // server regardless of whether the field is empty or not. This may be 1382 // used to include empty fields in Patch requests. 1383 ForceSendFields []string `json:"-"` 1384 1385 // NullFields is a list of field names (e.g. "Branch") to include in API 1386 // requests with the JSON null value. By default, fields with empty 1387 // values are omitted from API requests. However, any field with an 1388 // empty value appearing in NullFields will be sent to the server as 1389 // null. It is an error if a field in this list has a non-empty value. 1390 // This may be used to include null fields in Patch requests. 1391 NullFields []string `json:"-"` 1392} 1393 1394func (s *PushFilter) MarshalJSON() ([]byte, error) { 1395 type NoMethod PushFilter 1396 raw := NoMethod(*s) 1397 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1398} 1399 1400// RepoSource: Location of the source in a Google Cloud Source 1401// Repository. 1402type RepoSource struct { 1403 // BranchName: Regex matching branches to build. 1404 // 1405 // The syntax of the regular expressions accepted is the syntax accepted 1406 // by 1407 // RE2 and described at https://github.com/google/re2/wiki/Syntax 1408 BranchName string `json:"branchName,omitempty"` 1409 1410 // CommitSha: Explicit commit SHA to build. 1411 CommitSha string `json:"commitSha,omitempty"` 1412 1413 // Dir: Directory, relative to the source root, in which to run the 1414 // build. 1415 // 1416 // This must be a relative path. If a step's `dir` is specified and is 1417 // an 1418 // absolute path, this value is ignored for that step's execution. 1419 Dir string `json:"dir,omitempty"` 1420 1421 // ProjectId: ID of the project that owns the Cloud Source Repository. 1422 // If omitted, the 1423 // project ID requesting the build is assumed. 1424 ProjectId string `json:"projectId,omitempty"` 1425 1426 // RepoName: Required. Name of the Cloud Source Repository. 1427 RepoName string `json:"repoName,omitempty"` 1428 1429 // Substitutions: Substitutions to use in a triggered build. 1430 // Should only be used with RunBuildTrigger 1431 Substitutions map[string]string `json:"substitutions,omitempty"` 1432 1433 // TagName: Regex matching tags to build. 1434 // 1435 // The syntax of the regular expressions accepted is the syntax accepted 1436 // by 1437 // RE2 and described at https://github.com/google/re2/wiki/Syntax 1438 TagName string `json:"tagName,omitempty"` 1439 1440 // ForceSendFields is a list of field names (e.g. "BranchName") to 1441 // unconditionally include in API requests. By default, fields with 1442 // empty values are omitted from API requests. However, any non-pointer, 1443 // non-interface field appearing in ForceSendFields will be sent to the 1444 // server regardless of whether the field is empty or not. This may be 1445 // used to include empty fields in Patch requests. 1446 ForceSendFields []string `json:"-"` 1447 1448 // NullFields is a list of field names (e.g. "BranchName") to include in 1449 // API requests with the JSON null value. By default, fields with empty 1450 // values are omitted from API requests. However, any field with an 1451 // empty value appearing in NullFields will be sent to the server as 1452 // null. It is an error if a field in this list has a non-empty value. 1453 // This may be used to include null fields in Patch requests. 1454 NullFields []string `json:"-"` 1455} 1456 1457func (s *RepoSource) MarshalJSON() ([]byte, error) { 1458 type NoMethod RepoSource 1459 raw := NoMethod(*s) 1460 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1461} 1462 1463// Results: Artifacts created by the build pipeline. 1464type Results struct { 1465 // ArtifactManifest: Path to the artifact manifest. Only populated when 1466 // artifacts are uploaded. 1467 ArtifactManifest string `json:"artifactManifest,omitempty"` 1468 1469 // ArtifactTiming: Time to push all non-container artifacts. 1470 ArtifactTiming *TimeSpan `json:"artifactTiming,omitempty"` 1471 1472 // BuildStepImages: List of build step digests, in the order 1473 // corresponding to build step 1474 // indices. 1475 BuildStepImages []string `json:"buildStepImages,omitempty"` 1476 1477 // BuildStepOutputs: List of build step outputs, produced by builder 1478 // images, in the order 1479 // corresponding to build step indices. 1480 // 1481 // [Cloud 1482 // Builders](https://cloud.google.com/cloud-build/docs/cloud-builders) 1483 // ca 1484 // n produce this output by writing to `$BUILDER_OUTPUT/output`. 1485 // Only the first 4KB of data is stored. 1486 BuildStepOutputs []string `json:"buildStepOutputs,omitempty"` 1487 1488 // Images: Container images that were built as a part of the build. 1489 Images []*BuiltImage `json:"images,omitempty"` 1490 1491 // NumArtifacts: Number of artifacts uploaded. Only populated when 1492 // artifacts are uploaded. 1493 NumArtifacts int64 `json:"numArtifacts,omitempty,string"` 1494 1495 // ForceSendFields is a list of field names (e.g. "ArtifactManifest") to 1496 // unconditionally include in API requests. By default, fields with 1497 // empty values are omitted from API requests. However, any non-pointer, 1498 // non-interface field appearing in ForceSendFields will be sent to the 1499 // server regardless of whether the field is empty or not. This may be 1500 // used to include empty fields in Patch requests. 1501 ForceSendFields []string `json:"-"` 1502 1503 // NullFields is a list of field names (e.g. "ArtifactManifest") to 1504 // include in API requests with the JSON null value. By default, fields 1505 // with empty values are omitted from API requests. However, any field 1506 // with an empty value appearing in NullFields will be sent to the 1507 // server as null. It is an error if a field in this list has a 1508 // non-empty value. This may be used to include null fields in Patch 1509 // requests. 1510 NullFields []string `json:"-"` 1511} 1512 1513func (s *Results) MarshalJSON() ([]byte, error) { 1514 type NoMethod Results 1515 raw := NoMethod(*s) 1516 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1517} 1518 1519// RetryBuildRequest: Specifies a build to retry. 1520type RetryBuildRequest struct { 1521} 1522 1523// Secret: Pairs a set of secret environment variables containing 1524// encrypted 1525// values with the Cloud KMS key to use to decrypt the value. 1526type Secret struct { 1527 // KmsKeyName: Cloud KMS key name to use to decrypt these envs. 1528 KmsKeyName string `json:"kmsKeyName,omitempty"` 1529 1530 // SecretEnv: Map of environment variable name to its encrypted 1531 // value. 1532 // 1533 // Secret environment variables must be unique across all of a 1534 // build's 1535 // secrets, and must be used by at least one build step. Values can be 1536 // at most 1537 // 64 KB in size. There can be at most 100 secret values across all of 1538 // a 1539 // build's secrets. 1540 SecretEnv map[string]string `json:"secretEnv,omitempty"` 1541 1542 // ForceSendFields is a list of field names (e.g. "KmsKeyName") to 1543 // unconditionally include in API requests. By default, fields with 1544 // empty values are omitted from API requests. However, any non-pointer, 1545 // non-interface field appearing in ForceSendFields will be sent to the 1546 // server regardless of whether the field is empty or not. This may be 1547 // used to include empty fields in Patch requests. 1548 ForceSendFields []string `json:"-"` 1549 1550 // NullFields is a list of field names (e.g. "KmsKeyName") to include in 1551 // API requests with the JSON null value. By default, fields with empty 1552 // values are omitted from API requests. However, any field with an 1553 // empty value appearing in NullFields will be sent to the server as 1554 // null. It is an error if a field in this list has a non-empty value. 1555 // This may be used to include null fields in Patch requests. 1556 NullFields []string `json:"-"` 1557} 1558 1559func (s *Secret) MarshalJSON() ([]byte, error) { 1560 type NoMethod Secret 1561 raw := NoMethod(*s) 1562 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1563} 1564 1565// Source: Location of the source in a supported storage service. 1566type Source struct { 1567 // RepoSource: If provided, get the source from this location in a Cloud 1568 // Source 1569 // Repository. 1570 RepoSource *RepoSource `json:"repoSource,omitempty"` 1571 1572 // StorageSource: If provided, get the source from this location in 1573 // Google Cloud Storage. 1574 StorageSource *StorageSource `json:"storageSource,omitempty"` 1575 1576 // ForceSendFields is a list of field names (e.g. "RepoSource") to 1577 // unconditionally include in API requests. By default, fields with 1578 // empty values are omitted from API requests. However, any non-pointer, 1579 // non-interface field appearing in ForceSendFields will be sent to the 1580 // server regardless of whether the field is empty or not. This may be 1581 // used to include empty fields in Patch requests. 1582 ForceSendFields []string `json:"-"` 1583 1584 // NullFields is a list of field names (e.g. "RepoSource") to include in 1585 // API requests with the JSON null value. By default, fields with empty 1586 // values are omitted from API requests. However, any field with an 1587 // empty value appearing in NullFields will be sent to the server as 1588 // null. It is an error if a field in this list has a non-empty value. 1589 // This may be used to include null fields in Patch requests. 1590 NullFields []string `json:"-"` 1591} 1592 1593func (s *Source) MarshalJSON() ([]byte, error) { 1594 type NoMethod Source 1595 raw := NoMethod(*s) 1596 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1597} 1598 1599// SourceProvenance: Provenance of the source. Ways to find the original 1600// source, or verify that 1601// some source was used for this build. 1602type SourceProvenance struct { 1603 // FileHashes: Output only. Hash(es) of the build source, which can be 1604 // used to verify that 1605 // the original source integrity was maintained in the build. Note 1606 // that 1607 // `FileHashes` will only be populated if `BuildOptions` has requested 1608 // a 1609 // `SourceProvenanceHash`. 1610 // 1611 // The keys to this map are file paths used as build source and the 1612 // values 1613 // contain the hash values for those files. 1614 // 1615 // If the build source came in a single package such as a gzipped 1616 // tarfile 1617 // (`.tar.gz`), the `FileHash` will be for the single path to that file. 1618 FileHashes map[string]FileHashes `json:"fileHashes,omitempty"` 1619 1620 // ResolvedRepoSource: A copy of the build's `source.repo_source`, if 1621 // exists, with any 1622 // revisions resolved. 1623 ResolvedRepoSource *RepoSource `json:"resolvedRepoSource,omitempty"` 1624 1625 // ResolvedStorageSource: A copy of the build's `source.storage_source`, 1626 // if exists, with any 1627 // generations resolved. 1628 ResolvedStorageSource *StorageSource `json:"resolvedStorageSource,omitempty"` 1629 1630 // ForceSendFields is a list of field names (e.g. "FileHashes") to 1631 // unconditionally include in API requests. By default, fields with 1632 // empty values are omitted from API requests. However, any non-pointer, 1633 // non-interface field appearing in ForceSendFields will be sent to the 1634 // server regardless of whether the field is empty or not. This may be 1635 // used to include empty fields in Patch requests. 1636 ForceSendFields []string `json:"-"` 1637 1638 // NullFields is a list of field names (e.g. "FileHashes") to include in 1639 // API requests with the JSON null value. By default, fields with empty 1640 // values are omitted from API requests. However, any field with an 1641 // empty value appearing in NullFields will be sent to the server as 1642 // null. It is an error if a field in this list has a non-empty value. 1643 // This may be used to include null fields in Patch requests. 1644 NullFields []string `json:"-"` 1645} 1646 1647func (s *SourceProvenance) MarshalJSON() ([]byte, error) { 1648 type NoMethod SourceProvenance 1649 raw := NoMethod(*s) 1650 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1651} 1652 1653// Status: The `Status` type defines a logical error model that is 1654// suitable for 1655// different programming environments, including REST APIs and RPC APIs. 1656// It is 1657// used by [gRPC](https://github.com/grpc). Each `Status` message 1658// contains 1659// three pieces of data: error code, error message, and error 1660// details. 1661// 1662// You can find out more about this error model and how to work with it 1663// in the 1664// [API Design Guide](https://cloud.google.com/apis/design/errors). 1665type Status struct { 1666 // Code: The status code, which should be an enum value of 1667 // google.rpc.Code. 1668 Code int64 `json:"code,omitempty"` 1669 1670 // Details: A list of messages that carry the error details. There is a 1671 // common set of 1672 // message types for APIs to use. 1673 Details []googleapi.RawMessage `json:"details,omitempty"` 1674 1675 // Message: A developer-facing error message, which should be in 1676 // English. Any 1677 // user-facing error message should be localized and sent in 1678 // the 1679 // google.rpc.Status.details field, or localized by the client. 1680 Message string `json:"message,omitempty"` 1681 1682 // ForceSendFields is a list of field names (e.g. "Code") to 1683 // unconditionally include in API requests. By default, fields with 1684 // empty values are omitted from API requests. However, any non-pointer, 1685 // non-interface field appearing in ForceSendFields will be sent to the 1686 // server regardless of whether the field is empty or not. This may be 1687 // used to include empty fields in Patch requests. 1688 ForceSendFields []string `json:"-"` 1689 1690 // NullFields is a list of field names (e.g. "Code") to include in API 1691 // requests with the JSON null value. By default, fields with empty 1692 // values are omitted from API requests. However, any field with an 1693 // empty value appearing in NullFields will be sent to the server as 1694 // null. It is an error if a field in this list has a non-empty value. 1695 // This may be used to include null fields in Patch requests. 1696 NullFields []string `json:"-"` 1697} 1698 1699func (s *Status) MarshalJSON() ([]byte, error) { 1700 type NoMethod Status 1701 raw := NoMethod(*s) 1702 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1703} 1704 1705// StorageSource: Location of the source in an archive file in Google 1706// Cloud Storage. 1707type StorageSource struct { 1708 // Bucket: Google Cloud Storage bucket containing the source 1709 // (see 1710 // [Bucket 1711 // Name 1712 // Requirements](https://cloud.google.com/storage/docs/bucket-naming 1713 // #requirements)). 1714 Bucket string `json:"bucket,omitempty"` 1715 1716 // Generation: Google Cloud Storage generation for the object. If the 1717 // generation is 1718 // omitted, the latest generation will be used. 1719 Generation int64 `json:"generation,omitempty,string"` 1720 1721 // Object: Google Cloud Storage object containing the source. 1722 // 1723 // This object must be a gzipped archive file (`.tar.gz`) containing 1724 // source to 1725 // build. 1726 Object string `json:"object,omitempty"` 1727 1728 // ForceSendFields is a list of field names (e.g. "Bucket") to 1729 // unconditionally include in API requests. By default, fields with 1730 // empty values are omitted from API requests. However, any non-pointer, 1731 // non-interface field appearing in ForceSendFields will be sent to the 1732 // server regardless of whether the field is empty or not. This may be 1733 // used to include empty fields in Patch requests. 1734 ForceSendFields []string `json:"-"` 1735 1736 // NullFields is a list of field names (e.g. "Bucket") to include in API 1737 // requests with the JSON null value. By default, fields with empty 1738 // values are omitted from API requests. However, any field with an 1739 // empty value appearing in NullFields will be sent to the server as 1740 // null. It is an error if a field in this list has a non-empty value. 1741 // This may be used to include null fields in Patch requests. 1742 NullFields []string `json:"-"` 1743} 1744 1745func (s *StorageSource) MarshalJSON() ([]byte, error) { 1746 type NoMethod StorageSource 1747 raw := NoMethod(*s) 1748 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1749} 1750 1751// TimeSpan: Start and end times for a build execution phase. 1752type TimeSpan struct { 1753 // EndTime: End of time span. 1754 EndTime string `json:"endTime,omitempty"` 1755 1756 // StartTime: Start of time span. 1757 StartTime string `json:"startTime,omitempty"` 1758 1759 // ForceSendFields is a list of field names (e.g. "EndTime") to 1760 // unconditionally include in API requests. By default, fields with 1761 // empty values are omitted from API requests. However, any non-pointer, 1762 // non-interface field appearing in ForceSendFields will be sent to the 1763 // server regardless of whether the field is empty or not. This may be 1764 // used to include empty fields in Patch requests. 1765 ForceSendFields []string `json:"-"` 1766 1767 // NullFields is a list of field names (e.g. "EndTime") to include in 1768 // API requests with the JSON null value. By default, fields with empty 1769 // values are omitted from API requests. However, any field with an 1770 // empty value appearing in NullFields will be sent to the server as 1771 // null. It is an error if a field in this list has a non-empty value. 1772 // This may be used to include null fields in Patch requests. 1773 NullFields []string `json:"-"` 1774} 1775 1776func (s *TimeSpan) MarshalJSON() ([]byte, error) { 1777 type NoMethod TimeSpan 1778 raw := NoMethod(*s) 1779 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1780} 1781 1782// Volume: Volume describes a Docker container volume which is mounted 1783// into build steps 1784// in order to persist files across build step execution. 1785type Volume struct { 1786 // Name: Name of the volume to mount. 1787 // 1788 // Volume names must be unique per build step and must be valid names 1789 // for 1790 // Docker volumes. Each named volume must be used by at least two build 1791 // steps. 1792 Name string `json:"name,omitempty"` 1793 1794 // Path: Path at which to mount the volume. 1795 // 1796 // Paths must be absolute and cannot conflict with other volume paths on 1797 // the 1798 // same build step or with certain reserved volume paths. 1799 Path string `json:"path,omitempty"` 1800 1801 // ForceSendFields is a list of field names (e.g. "Name") to 1802 // unconditionally include in API requests. By default, fields with 1803 // empty values are omitted from API requests. However, any non-pointer, 1804 // non-interface field appearing in ForceSendFields will be sent to the 1805 // server regardless of whether the field is empty or not. This may be 1806 // used to include empty fields in Patch requests. 1807 ForceSendFields []string `json:"-"` 1808 1809 // NullFields is a list of field names (e.g. "Name") to include in API 1810 // requests with the JSON null value. By default, fields with empty 1811 // values are omitted from API requests. However, any field with an 1812 // empty value appearing in NullFields will be sent to the server as 1813 // null. It is an error if a field in this list has a non-empty value. 1814 // This may be used to include null fields in Patch requests. 1815 NullFields []string `json:"-"` 1816} 1817 1818func (s *Volume) MarshalJSON() ([]byte, error) { 1819 type NoMethod Volume 1820 raw := NoMethod(*s) 1821 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1822} 1823 1824// method id "cloudbuild.operations.cancel": 1825 1826type OperationsCancelCall struct { 1827 s *Service 1828 name string 1829 canceloperationrequest *CancelOperationRequest 1830 urlParams_ gensupport.URLParams 1831 ctx_ context.Context 1832 header_ http.Header 1833} 1834 1835// Cancel: Starts asynchronous cancellation on a long-running operation. 1836// The server 1837// makes a best effort to cancel the operation, but success is 1838// not 1839// guaranteed. If the server doesn't support this method, it 1840// returns 1841// `google.rpc.Code.UNIMPLEMENTED`. Clients can 1842// use 1843// Operations.GetOperation or 1844// other methods to check whether the cancellation succeeded or whether 1845// the 1846// operation completed despite cancellation. On successful 1847// cancellation, 1848// the operation is not deleted; instead, it becomes an operation 1849// with 1850// an Operation.error value with a google.rpc.Status.code of 1851// 1, 1852// corresponding to `Code.CANCELLED`. 1853func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall { 1854 c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1855 c.name = name 1856 c.canceloperationrequest = canceloperationrequest 1857 return c 1858} 1859 1860// Fields allows partial responses to be retrieved. See 1861// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1862// for more information. 1863func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall { 1864 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1865 return c 1866} 1867 1868// Context sets the context to be used in this call's Do method. Any 1869// pending HTTP request will be aborted if the provided context is 1870// canceled. 1871func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall { 1872 c.ctx_ = ctx 1873 return c 1874} 1875 1876// Header returns an http.Header that can be modified by the caller to 1877// add HTTP headers to the request. 1878func (c *OperationsCancelCall) Header() http.Header { 1879 if c.header_ == nil { 1880 c.header_ = make(http.Header) 1881 } 1882 return c.header_ 1883} 1884 1885func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) { 1886 reqHeaders := make(http.Header) 1887 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1888 for k, v := range c.header_ { 1889 reqHeaders[k] = v 1890 } 1891 reqHeaders.Set("User-Agent", c.s.userAgent()) 1892 var body io.Reader = nil 1893 body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest) 1894 if err != nil { 1895 return nil, err 1896 } 1897 reqHeaders.Set("Content-Type", "application/json") 1898 c.urlParams_.Set("alt", alt) 1899 c.urlParams_.Set("prettyPrint", "false") 1900 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel") 1901 urls += "?" + c.urlParams_.Encode() 1902 req, err := http.NewRequest("POST", urls, body) 1903 if err != nil { 1904 return nil, err 1905 } 1906 req.Header = reqHeaders 1907 googleapi.Expand(req.URL, map[string]string{ 1908 "name": c.name, 1909 }) 1910 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1911} 1912 1913// Do executes the "cloudbuild.operations.cancel" call. 1914// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1915// code is an error. Response headers are in either 1916// *Empty.ServerResponse.Header or (if a response was returned at all) 1917// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1918// check whether the returned error was because http.StatusNotModified 1919// was returned. 1920func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1921 gensupport.SetOptions(c.urlParams_, opts...) 1922 res, err := c.doRequest("json") 1923 if res != nil && res.StatusCode == http.StatusNotModified { 1924 if res.Body != nil { 1925 res.Body.Close() 1926 } 1927 return nil, &googleapi.Error{ 1928 Code: res.StatusCode, 1929 Header: res.Header, 1930 } 1931 } 1932 if err != nil { 1933 return nil, err 1934 } 1935 defer googleapi.CloseBody(res) 1936 if err := googleapi.CheckResponse(res); err != nil { 1937 return nil, err 1938 } 1939 ret := &Empty{ 1940 ServerResponse: googleapi.ServerResponse{ 1941 Header: res.Header, 1942 HTTPStatusCode: res.StatusCode, 1943 }, 1944 } 1945 target := &ret 1946 if err := gensupport.DecodeResponse(target, res); err != nil { 1947 return nil, err 1948 } 1949 return ret, nil 1950 // { 1951 // "description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.", 1952 // "flatPath": "v1/operations/{operationsId}:cancel", 1953 // "httpMethod": "POST", 1954 // "id": "cloudbuild.operations.cancel", 1955 // "parameterOrder": [ 1956 // "name" 1957 // ], 1958 // "parameters": { 1959 // "name": { 1960 // "description": "The name of the operation resource to be cancelled.", 1961 // "location": "path", 1962 // "pattern": "^operations/.*$", 1963 // "required": true, 1964 // "type": "string" 1965 // } 1966 // }, 1967 // "path": "v1/{+name}:cancel", 1968 // "request": { 1969 // "$ref": "CancelOperationRequest" 1970 // }, 1971 // "response": { 1972 // "$ref": "Empty" 1973 // }, 1974 // "scopes": [ 1975 // "https://www.googleapis.com/auth/cloud-platform" 1976 // ] 1977 // } 1978 1979} 1980 1981// method id "cloudbuild.operations.get": 1982 1983type OperationsGetCall struct { 1984 s *Service 1985 name string 1986 urlParams_ gensupport.URLParams 1987 ifNoneMatch_ string 1988 ctx_ context.Context 1989 header_ http.Header 1990} 1991 1992// Get: Gets the latest state of a long-running operation. Clients can 1993// use this 1994// method to poll the operation result at intervals as recommended by 1995// the API 1996// service. 1997func (r *OperationsService) Get(name string) *OperationsGetCall { 1998 c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1999 c.name = name 2000 return c 2001} 2002 2003// Fields allows partial responses to be retrieved. See 2004// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2005// for more information. 2006func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall { 2007 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2008 return c 2009} 2010 2011// IfNoneMatch sets the optional parameter which makes the operation 2012// fail if the object's ETag matches the given value. This is useful for 2013// getting updates only after the object has changed since the last 2014// request. Use googleapi.IsNotModified to check whether the response 2015// error from Do is the result of In-None-Match. 2016func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall { 2017 c.ifNoneMatch_ = entityTag 2018 return c 2019} 2020 2021// Context sets the context to be used in this call's Do method. Any 2022// pending HTTP request will be aborted if the provided context is 2023// canceled. 2024func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall { 2025 c.ctx_ = ctx 2026 return c 2027} 2028 2029// Header returns an http.Header that can be modified by the caller to 2030// add HTTP headers to the request. 2031func (c *OperationsGetCall) Header() http.Header { 2032 if c.header_ == nil { 2033 c.header_ = make(http.Header) 2034 } 2035 return c.header_ 2036} 2037 2038func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) { 2039 reqHeaders := make(http.Header) 2040 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2041 for k, v := range c.header_ { 2042 reqHeaders[k] = v 2043 } 2044 reqHeaders.Set("User-Agent", c.s.userAgent()) 2045 if c.ifNoneMatch_ != "" { 2046 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2047 } 2048 var body io.Reader = nil 2049 c.urlParams_.Set("alt", alt) 2050 c.urlParams_.Set("prettyPrint", "false") 2051 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2052 urls += "?" + c.urlParams_.Encode() 2053 req, err := http.NewRequest("GET", urls, body) 2054 if err != nil { 2055 return nil, err 2056 } 2057 req.Header = reqHeaders 2058 googleapi.Expand(req.URL, map[string]string{ 2059 "name": c.name, 2060 }) 2061 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2062} 2063 2064// Do executes the "cloudbuild.operations.get" call. 2065// Exactly one of *Operation or error will be non-nil. Any non-2xx 2066// status code is an error. Response headers are in either 2067// *Operation.ServerResponse.Header or (if a response was returned at 2068// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2069// to check whether the returned error was because 2070// http.StatusNotModified was returned. 2071func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2072 gensupport.SetOptions(c.urlParams_, opts...) 2073 res, err := c.doRequest("json") 2074 if res != nil && res.StatusCode == http.StatusNotModified { 2075 if res.Body != nil { 2076 res.Body.Close() 2077 } 2078 return nil, &googleapi.Error{ 2079 Code: res.StatusCode, 2080 Header: res.Header, 2081 } 2082 } 2083 if err != nil { 2084 return nil, err 2085 } 2086 defer googleapi.CloseBody(res) 2087 if err := googleapi.CheckResponse(res); err != nil { 2088 return nil, err 2089 } 2090 ret := &Operation{ 2091 ServerResponse: googleapi.ServerResponse{ 2092 Header: res.Header, 2093 HTTPStatusCode: res.StatusCode, 2094 }, 2095 } 2096 target := &ret 2097 if err := gensupport.DecodeResponse(target, res); err != nil { 2098 return nil, err 2099 } 2100 return ret, nil 2101 // { 2102 // "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.", 2103 // "flatPath": "v1/operations/{operationsId}", 2104 // "httpMethod": "GET", 2105 // "id": "cloudbuild.operations.get", 2106 // "parameterOrder": [ 2107 // "name" 2108 // ], 2109 // "parameters": { 2110 // "name": { 2111 // "description": "The name of the operation resource.", 2112 // "location": "path", 2113 // "pattern": "^operations/.*$", 2114 // "required": true, 2115 // "type": "string" 2116 // } 2117 // }, 2118 // "path": "v1/{+name}", 2119 // "response": { 2120 // "$ref": "Operation" 2121 // }, 2122 // "scopes": [ 2123 // "https://www.googleapis.com/auth/cloud-platform" 2124 // ] 2125 // } 2126 2127} 2128 2129// method id "cloudbuild.operations.list": 2130 2131type OperationsListCall struct { 2132 s *Service 2133 name string 2134 urlParams_ gensupport.URLParams 2135 ifNoneMatch_ string 2136 ctx_ context.Context 2137 header_ http.Header 2138} 2139 2140// List: Lists operations that match the specified filter in the 2141// request. If the 2142// server doesn't support this method, it returns 2143// `UNIMPLEMENTED`. 2144// 2145// NOTE: the `name` binding allows API services to override the 2146// binding 2147// to use different resource name schemes, such as `users/*/operations`. 2148// To 2149// override the binding, API services can add a binding such 2150// as 2151// "/v1/{name=users/*}/operations" to their service configuration. 2152// For backwards compatibility, the default name includes the 2153// operations 2154// collection id, however overriding users must ensure the name 2155// binding 2156// is the parent resource, without the operations collection id. 2157func (r *OperationsService) List(name string) *OperationsListCall { 2158 c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2159 c.name = name 2160 return c 2161} 2162 2163// Filter sets the optional parameter "filter": The standard list 2164// filter. 2165func (c *OperationsListCall) Filter(filter string) *OperationsListCall { 2166 c.urlParams_.Set("filter", filter) 2167 return c 2168} 2169 2170// PageSize sets the optional parameter "pageSize": The standard list 2171// page size. 2172func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall { 2173 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2174 return c 2175} 2176 2177// PageToken sets the optional parameter "pageToken": The standard list 2178// page token. 2179func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall { 2180 c.urlParams_.Set("pageToken", pageToken) 2181 return c 2182} 2183 2184// Fields allows partial responses to be retrieved. See 2185// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2186// for more information. 2187func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall { 2188 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2189 return c 2190} 2191 2192// IfNoneMatch sets the optional parameter which makes the operation 2193// fail if the object's ETag matches the given value. This is useful for 2194// getting updates only after the object has changed since the last 2195// request. Use googleapi.IsNotModified to check whether the response 2196// error from Do is the result of In-None-Match. 2197func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall { 2198 c.ifNoneMatch_ = entityTag 2199 return c 2200} 2201 2202// Context sets the context to be used in this call's Do method. Any 2203// pending HTTP request will be aborted if the provided context is 2204// canceled. 2205func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall { 2206 c.ctx_ = ctx 2207 return c 2208} 2209 2210// Header returns an http.Header that can be modified by the caller to 2211// add HTTP headers to the request. 2212func (c *OperationsListCall) Header() http.Header { 2213 if c.header_ == nil { 2214 c.header_ = make(http.Header) 2215 } 2216 return c.header_ 2217} 2218 2219func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) { 2220 reqHeaders := make(http.Header) 2221 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2222 for k, v := range c.header_ { 2223 reqHeaders[k] = v 2224 } 2225 reqHeaders.Set("User-Agent", c.s.userAgent()) 2226 if c.ifNoneMatch_ != "" { 2227 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2228 } 2229 var body io.Reader = nil 2230 c.urlParams_.Set("alt", alt) 2231 c.urlParams_.Set("prettyPrint", "false") 2232 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2233 urls += "?" + c.urlParams_.Encode() 2234 req, err := http.NewRequest("GET", 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 "cloudbuild.operations.list" call. 2246// Exactly one of *ListOperationsResponse or error will be non-nil. Any 2247// non-2xx status code is an error. Response headers are in either 2248// *ListOperationsResponse.ServerResponse.Header or (if a response was 2249// 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. 2252func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, 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 := &ListOperationsResponse{ 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": "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.", 2284 // "flatPath": "v1/operations", 2285 // "httpMethod": "GET", 2286 // "id": "cloudbuild.operations.list", 2287 // "parameterOrder": [ 2288 // "name" 2289 // ], 2290 // "parameters": { 2291 // "filter": { 2292 // "description": "The standard list filter.", 2293 // "location": "query", 2294 // "type": "string" 2295 // }, 2296 // "name": { 2297 // "description": "The name of the operation's parent resource.", 2298 // "location": "path", 2299 // "pattern": "^operations$", 2300 // "required": true, 2301 // "type": "string" 2302 // }, 2303 // "pageSize": { 2304 // "description": "The standard list page size.", 2305 // "format": "int32", 2306 // "location": "query", 2307 // "type": "integer" 2308 // }, 2309 // "pageToken": { 2310 // "description": "The standard list page token.", 2311 // "location": "query", 2312 // "type": "string" 2313 // } 2314 // }, 2315 // "path": "v1/{+name}", 2316 // "response": { 2317 // "$ref": "ListOperationsResponse" 2318 // }, 2319 // "scopes": [ 2320 // "https://www.googleapis.com/auth/cloud-platform" 2321 // ] 2322 // } 2323 2324} 2325 2326// Pages invokes f for each page of results. 2327// A non-nil error returned from f will halt the iteration. 2328// The provided context supersedes any context provided to the Context method. 2329func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error { 2330 c.ctx_ = ctx 2331 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2332 for { 2333 x, err := c.Do() 2334 if err != nil { 2335 return err 2336 } 2337 if err := f(x); err != nil { 2338 return err 2339 } 2340 if x.NextPageToken == "" { 2341 return nil 2342 } 2343 c.PageToken(x.NextPageToken) 2344 } 2345} 2346 2347// method id "cloudbuild.projects.builds.cancel": 2348 2349type ProjectsBuildsCancelCall struct { 2350 s *Service 2351 projectId string 2352 id string 2353 cancelbuildrequest *CancelBuildRequest 2354 urlParams_ gensupport.URLParams 2355 ctx_ context.Context 2356 header_ http.Header 2357} 2358 2359// Cancel: Cancels a build in progress. 2360func (r *ProjectsBuildsService) Cancel(projectId string, id string, cancelbuildrequest *CancelBuildRequest) *ProjectsBuildsCancelCall { 2361 c := &ProjectsBuildsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2362 c.projectId = projectId 2363 c.id = id 2364 c.cancelbuildrequest = cancelbuildrequest 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. 2371func (c *ProjectsBuildsCancelCall) Fields(s ...googleapi.Field) *ProjectsBuildsCancelCall { 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. 2379func (c *ProjectsBuildsCancelCall) Context(ctx context.Context) *ProjectsBuildsCancelCall { 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. 2386func (c *ProjectsBuildsCancelCall) Header() http.Header { 2387 if c.header_ == nil { 2388 c.header_ = make(http.Header) 2389 } 2390 return c.header_ 2391} 2392 2393func (c *ProjectsBuildsCancelCall) doRequest(alt string) (*http.Response, error) { 2394 reqHeaders := make(http.Header) 2395 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 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.cancelbuildrequest) 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, "v1/projects/{projectId}/builds/{id}:cancel") 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 "projectId": c.projectId, 2417 "id": c.id, 2418 }) 2419 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2420} 2421 2422// Do executes the "cloudbuild.projects.builds.cancel" call. 2423// Exactly one of *Build or error will be non-nil. Any non-2xx status 2424// code is an error. Response headers are in either 2425// *Build.ServerResponse.Header or (if a response was returned at all) 2426// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2427// check whether the returned error was because http.StatusNotModified 2428// was returned. 2429func (c *ProjectsBuildsCancelCall) Do(opts ...googleapi.CallOption) (*Build, error) { 2430 gensupport.SetOptions(c.urlParams_, opts...) 2431 res, err := c.doRequest("json") 2432 if res != nil && res.StatusCode == http.StatusNotModified { 2433 if res.Body != nil { 2434 res.Body.Close() 2435 } 2436 return nil, &googleapi.Error{ 2437 Code: res.StatusCode, 2438 Header: res.Header, 2439 } 2440 } 2441 if err != nil { 2442 return nil, err 2443 } 2444 defer googleapi.CloseBody(res) 2445 if err := googleapi.CheckResponse(res); err != nil { 2446 return nil, err 2447 } 2448 ret := &Build{ 2449 ServerResponse: googleapi.ServerResponse{ 2450 Header: res.Header, 2451 HTTPStatusCode: res.StatusCode, 2452 }, 2453 } 2454 target := &ret 2455 if err := gensupport.DecodeResponse(target, res); err != nil { 2456 return nil, err 2457 } 2458 return ret, nil 2459 // { 2460 // "description": "Cancels a build in progress.", 2461 // "flatPath": "v1/projects/{projectId}/builds/{id}:cancel", 2462 // "httpMethod": "POST", 2463 // "id": "cloudbuild.projects.builds.cancel", 2464 // "parameterOrder": [ 2465 // "projectId", 2466 // "id" 2467 // ], 2468 // "parameters": { 2469 // "id": { 2470 // "description": "Required. ID of the build.", 2471 // "location": "path", 2472 // "required": true, 2473 // "type": "string" 2474 // }, 2475 // "projectId": { 2476 // "description": "Required. ID of the project.", 2477 // "location": "path", 2478 // "required": true, 2479 // "type": "string" 2480 // } 2481 // }, 2482 // "path": "v1/projects/{projectId}/builds/{id}:cancel", 2483 // "request": { 2484 // "$ref": "CancelBuildRequest" 2485 // }, 2486 // "response": { 2487 // "$ref": "Build" 2488 // }, 2489 // "scopes": [ 2490 // "https://www.googleapis.com/auth/cloud-platform" 2491 // ] 2492 // } 2493 2494} 2495 2496// method id "cloudbuild.projects.builds.create": 2497 2498type ProjectsBuildsCreateCall struct { 2499 s *Service 2500 projectId string 2501 build *Build 2502 urlParams_ gensupport.URLParams 2503 ctx_ context.Context 2504 header_ http.Header 2505} 2506 2507// Create: Starts a build with the specified configuration. 2508// 2509// This method returns a long-running `Operation`, which includes the 2510// build 2511// ID. Pass the build ID to `GetBuild` to determine the build status 2512// (such as 2513// `SUCCESS` or `FAILURE`). 2514func (r *ProjectsBuildsService) Create(projectId string, build *Build) *ProjectsBuildsCreateCall { 2515 c := &ProjectsBuildsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2516 c.projectId = projectId 2517 c.build = build 2518 return c 2519} 2520 2521// Fields allows partial responses to be retrieved. See 2522// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2523// for more information. 2524func (c *ProjectsBuildsCreateCall) Fields(s ...googleapi.Field) *ProjectsBuildsCreateCall { 2525 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2526 return c 2527} 2528 2529// Context sets the context to be used in this call's Do method. Any 2530// pending HTTP request will be aborted if the provided context is 2531// canceled. 2532func (c *ProjectsBuildsCreateCall) Context(ctx context.Context) *ProjectsBuildsCreateCall { 2533 c.ctx_ = ctx 2534 return c 2535} 2536 2537// Header returns an http.Header that can be modified by the caller to 2538// add HTTP headers to the request. 2539func (c *ProjectsBuildsCreateCall) Header() http.Header { 2540 if c.header_ == nil { 2541 c.header_ = make(http.Header) 2542 } 2543 return c.header_ 2544} 2545 2546func (c *ProjectsBuildsCreateCall) doRequest(alt string) (*http.Response, error) { 2547 reqHeaders := make(http.Header) 2548 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2549 for k, v := range c.header_ { 2550 reqHeaders[k] = v 2551 } 2552 reqHeaders.Set("User-Agent", c.s.userAgent()) 2553 var body io.Reader = nil 2554 body, err := googleapi.WithoutDataWrapper.JSONReader(c.build) 2555 if err != nil { 2556 return nil, err 2557 } 2558 reqHeaders.Set("Content-Type", "application/json") 2559 c.urlParams_.Set("alt", alt) 2560 c.urlParams_.Set("prettyPrint", "false") 2561 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/builds") 2562 urls += "?" + c.urlParams_.Encode() 2563 req, err := http.NewRequest("POST", urls, body) 2564 if err != nil { 2565 return nil, err 2566 } 2567 req.Header = reqHeaders 2568 googleapi.Expand(req.URL, map[string]string{ 2569 "projectId": c.projectId, 2570 }) 2571 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2572} 2573 2574// Do executes the "cloudbuild.projects.builds.create" call. 2575// Exactly one of *Operation or error will be non-nil. Any non-2xx 2576// status code is an error. Response headers are in either 2577// *Operation.ServerResponse.Header or (if a response was returned at 2578// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2579// to check whether the returned error was because 2580// http.StatusNotModified was returned. 2581func (c *ProjectsBuildsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 2582 gensupport.SetOptions(c.urlParams_, opts...) 2583 res, err := c.doRequest("json") 2584 if res != nil && res.StatusCode == http.StatusNotModified { 2585 if res.Body != nil { 2586 res.Body.Close() 2587 } 2588 return nil, &googleapi.Error{ 2589 Code: res.StatusCode, 2590 Header: res.Header, 2591 } 2592 } 2593 if err != nil { 2594 return nil, err 2595 } 2596 defer googleapi.CloseBody(res) 2597 if err := googleapi.CheckResponse(res); err != nil { 2598 return nil, err 2599 } 2600 ret := &Operation{ 2601 ServerResponse: googleapi.ServerResponse{ 2602 Header: res.Header, 2603 HTTPStatusCode: res.StatusCode, 2604 }, 2605 } 2606 target := &ret 2607 if err := gensupport.DecodeResponse(target, res); err != nil { 2608 return nil, err 2609 } 2610 return ret, nil 2611 // { 2612 // "description": "Starts a build with the specified configuration.\n\nThis method returns a long-running `Operation`, which includes the build\nID. Pass the build ID to `GetBuild` to determine the build status (such as\n`SUCCESS` or `FAILURE`).", 2613 // "flatPath": "v1/projects/{projectId}/builds", 2614 // "httpMethod": "POST", 2615 // "id": "cloudbuild.projects.builds.create", 2616 // "parameterOrder": [ 2617 // "projectId" 2618 // ], 2619 // "parameters": { 2620 // "projectId": { 2621 // "description": "Required. ID of the project.", 2622 // "location": "path", 2623 // "required": true, 2624 // "type": "string" 2625 // } 2626 // }, 2627 // "path": "v1/projects/{projectId}/builds", 2628 // "request": { 2629 // "$ref": "Build" 2630 // }, 2631 // "response": { 2632 // "$ref": "Operation" 2633 // }, 2634 // "scopes": [ 2635 // "https://www.googleapis.com/auth/cloud-platform" 2636 // ] 2637 // } 2638 2639} 2640 2641// method id "cloudbuild.projects.builds.get": 2642 2643type ProjectsBuildsGetCall struct { 2644 s *Service 2645 projectId string 2646 id string 2647 urlParams_ gensupport.URLParams 2648 ifNoneMatch_ string 2649 ctx_ context.Context 2650 header_ http.Header 2651} 2652 2653// Get: Returns information about a previously requested build. 2654// 2655// The `Build` that is returned includes its status (such as 2656// `SUCCESS`, 2657// `FAILURE`, or `WORKING`), and timing information. 2658func (r *ProjectsBuildsService) Get(projectId string, id string) *ProjectsBuildsGetCall { 2659 c := &ProjectsBuildsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2660 c.projectId = projectId 2661 c.id = id 2662 return c 2663} 2664 2665// Fields allows partial responses to be retrieved. See 2666// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2667// for more information. 2668func (c *ProjectsBuildsGetCall) Fields(s ...googleapi.Field) *ProjectsBuildsGetCall { 2669 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2670 return c 2671} 2672 2673// IfNoneMatch sets the optional parameter which makes the operation 2674// fail if the object's ETag matches the given value. This is useful for 2675// getting updates only after the object has changed since the last 2676// request. Use googleapi.IsNotModified to check whether the response 2677// error from Do is the result of In-None-Match. 2678func (c *ProjectsBuildsGetCall) IfNoneMatch(entityTag string) *ProjectsBuildsGetCall { 2679 c.ifNoneMatch_ = entityTag 2680 return c 2681} 2682 2683// Context sets the context to be used in this call's Do method. Any 2684// pending HTTP request will be aborted if the provided context is 2685// canceled. 2686func (c *ProjectsBuildsGetCall) Context(ctx context.Context) *ProjectsBuildsGetCall { 2687 c.ctx_ = ctx 2688 return c 2689} 2690 2691// Header returns an http.Header that can be modified by the caller to 2692// add HTTP headers to the request. 2693func (c *ProjectsBuildsGetCall) Header() http.Header { 2694 if c.header_ == nil { 2695 c.header_ = make(http.Header) 2696 } 2697 return c.header_ 2698} 2699 2700func (c *ProjectsBuildsGetCall) doRequest(alt string) (*http.Response, error) { 2701 reqHeaders := make(http.Header) 2702 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2703 for k, v := range c.header_ { 2704 reqHeaders[k] = v 2705 } 2706 reqHeaders.Set("User-Agent", c.s.userAgent()) 2707 if c.ifNoneMatch_ != "" { 2708 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2709 } 2710 var body io.Reader = nil 2711 c.urlParams_.Set("alt", alt) 2712 c.urlParams_.Set("prettyPrint", "false") 2713 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/builds/{id}") 2714 urls += "?" + c.urlParams_.Encode() 2715 req, err := http.NewRequest("GET", urls, body) 2716 if err != nil { 2717 return nil, err 2718 } 2719 req.Header = reqHeaders 2720 googleapi.Expand(req.URL, map[string]string{ 2721 "projectId": c.projectId, 2722 "id": c.id, 2723 }) 2724 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2725} 2726 2727// Do executes the "cloudbuild.projects.builds.get" call. 2728// Exactly one of *Build or error will be non-nil. Any non-2xx status 2729// code is an error. Response headers are in either 2730// *Build.ServerResponse.Header or (if a response was returned at all) 2731// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2732// check whether the returned error was because http.StatusNotModified 2733// was returned. 2734func (c *ProjectsBuildsGetCall) Do(opts ...googleapi.CallOption) (*Build, error) { 2735 gensupport.SetOptions(c.urlParams_, opts...) 2736 res, err := c.doRequest("json") 2737 if res != nil && res.StatusCode == http.StatusNotModified { 2738 if res.Body != nil { 2739 res.Body.Close() 2740 } 2741 return nil, &googleapi.Error{ 2742 Code: res.StatusCode, 2743 Header: res.Header, 2744 } 2745 } 2746 if err != nil { 2747 return nil, err 2748 } 2749 defer googleapi.CloseBody(res) 2750 if err := googleapi.CheckResponse(res); err != nil { 2751 return nil, err 2752 } 2753 ret := &Build{ 2754 ServerResponse: googleapi.ServerResponse{ 2755 Header: res.Header, 2756 HTTPStatusCode: res.StatusCode, 2757 }, 2758 } 2759 target := &ret 2760 if err := gensupport.DecodeResponse(target, res); err != nil { 2761 return nil, err 2762 } 2763 return ret, nil 2764 // { 2765 // "description": "Returns information about a previously requested build.\n\nThe `Build` that is returned includes its status (such as `SUCCESS`,\n`FAILURE`, or `WORKING`), and timing information.", 2766 // "flatPath": "v1/projects/{projectId}/builds/{id}", 2767 // "httpMethod": "GET", 2768 // "id": "cloudbuild.projects.builds.get", 2769 // "parameterOrder": [ 2770 // "projectId", 2771 // "id" 2772 // ], 2773 // "parameters": { 2774 // "id": { 2775 // "description": "Required. ID of the build.", 2776 // "location": "path", 2777 // "required": true, 2778 // "type": "string" 2779 // }, 2780 // "projectId": { 2781 // "description": "Required. ID of the project.", 2782 // "location": "path", 2783 // "required": true, 2784 // "type": "string" 2785 // } 2786 // }, 2787 // "path": "v1/projects/{projectId}/builds/{id}", 2788 // "response": { 2789 // "$ref": "Build" 2790 // }, 2791 // "scopes": [ 2792 // "https://www.googleapis.com/auth/cloud-platform" 2793 // ] 2794 // } 2795 2796} 2797 2798// method id "cloudbuild.projects.builds.list": 2799 2800type ProjectsBuildsListCall struct { 2801 s *Service 2802 projectId string 2803 urlParams_ gensupport.URLParams 2804 ifNoneMatch_ string 2805 ctx_ context.Context 2806 header_ http.Header 2807} 2808 2809// List: Lists previously requested builds. 2810// 2811// Previously requested builds may still be in-progress, or may have 2812// finished 2813// successfully or unsuccessfully. 2814func (r *ProjectsBuildsService) List(projectId string) *ProjectsBuildsListCall { 2815 c := &ProjectsBuildsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2816 c.projectId = projectId 2817 return c 2818} 2819 2820// Filter sets the optional parameter "filter": The raw filter text to 2821// constrain the results. 2822func (c *ProjectsBuildsListCall) Filter(filter string) *ProjectsBuildsListCall { 2823 c.urlParams_.Set("filter", filter) 2824 return c 2825} 2826 2827// PageSize sets the optional parameter "pageSize": Number of results to 2828// return in the list. 2829func (c *ProjectsBuildsListCall) PageSize(pageSize int64) *ProjectsBuildsListCall { 2830 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2831 return c 2832} 2833 2834// PageToken sets the optional parameter "pageToken": Token to provide 2835// to skip to a particular spot in the list. 2836func (c *ProjectsBuildsListCall) PageToken(pageToken string) *ProjectsBuildsListCall { 2837 c.urlParams_.Set("pageToken", pageToken) 2838 return c 2839} 2840 2841// Fields allows partial responses to be retrieved. See 2842// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2843// for more information. 2844func (c *ProjectsBuildsListCall) Fields(s ...googleapi.Field) *ProjectsBuildsListCall { 2845 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2846 return c 2847} 2848 2849// IfNoneMatch sets the optional parameter which makes the operation 2850// fail if the object's ETag matches the given value. This is useful for 2851// getting updates only after the object has changed since the last 2852// request. Use googleapi.IsNotModified to check whether the response 2853// error from Do is the result of In-None-Match. 2854func (c *ProjectsBuildsListCall) IfNoneMatch(entityTag string) *ProjectsBuildsListCall { 2855 c.ifNoneMatch_ = entityTag 2856 return c 2857} 2858 2859// Context sets the context to be used in this call's Do method. Any 2860// pending HTTP request will be aborted if the provided context is 2861// canceled. 2862func (c *ProjectsBuildsListCall) Context(ctx context.Context) *ProjectsBuildsListCall { 2863 c.ctx_ = ctx 2864 return c 2865} 2866 2867// Header returns an http.Header that can be modified by the caller to 2868// add HTTP headers to the request. 2869func (c *ProjectsBuildsListCall) Header() http.Header { 2870 if c.header_ == nil { 2871 c.header_ = make(http.Header) 2872 } 2873 return c.header_ 2874} 2875 2876func (c *ProjectsBuildsListCall) doRequest(alt string) (*http.Response, error) { 2877 reqHeaders := make(http.Header) 2878 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2879 for k, v := range c.header_ { 2880 reqHeaders[k] = v 2881 } 2882 reqHeaders.Set("User-Agent", c.s.userAgent()) 2883 if c.ifNoneMatch_ != "" { 2884 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2885 } 2886 var body io.Reader = nil 2887 c.urlParams_.Set("alt", alt) 2888 c.urlParams_.Set("prettyPrint", "false") 2889 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/builds") 2890 urls += "?" + c.urlParams_.Encode() 2891 req, err := http.NewRequest("GET", urls, body) 2892 if err != nil { 2893 return nil, err 2894 } 2895 req.Header = reqHeaders 2896 googleapi.Expand(req.URL, map[string]string{ 2897 "projectId": c.projectId, 2898 }) 2899 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2900} 2901 2902// Do executes the "cloudbuild.projects.builds.list" call. 2903// Exactly one of *ListBuildsResponse or error will be non-nil. Any 2904// non-2xx status code is an error. Response headers are in either 2905// *ListBuildsResponse.ServerResponse.Header or (if a response was 2906// returned at all) in error.(*googleapi.Error).Header. Use 2907// googleapi.IsNotModified to check whether the returned error was 2908// because http.StatusNotModified was returned. 2909func (c *ProjectsBuildsListCall) Do(opts ...googleapi.CallOption) (*ListBuildsResponse, error) { 2910 gensupport.SetOptions(c.urlParams_, opts...) 2911 res, err := c.doRequest("json") 2912 if res != nil && res.StatusCode == http.StatusNotModified { 2913 if res.Body != nil { 2914 res.Body.Close() 2915 } 2916 return nil, &googleapi.Error{ 2917 Code: res.StatusCode, 2918 Header: res.Header, 2919 } 2920 } 2921 if err != nil { 2922 return nil, err 2923 } 2924 defer googleapi.CloseBody(res) 2925 if err := googleapi.CheckResponse(res); err != nil { 2926 return nil, err 2927 } 2928 ret := &ListBuildsResponse{ 2929 ServerResponse: googleapi.ServerResponse{ 2930 Header: res.Header, 2931 HTTPStatusCode: res.StatusCode, 2932 }, 2933 } 2934 target := &ret 2935 if err := gensupport.DecodeResponse(target, res); err != nil { 2936 return nil, err 2937 } 2938 return ret, nil 2939 // { 2940 // "description": "Lists previously requested builds.\n\nPreviously requested builds may still be in-progress, or may have finished\nsuccessfully or unsuccessfully.", 2941 // "flatPath": "v1/projects/{projectId}/builds", 2942 // "httpMethod": "GET", 2943 // "id": "cloudbuild.projects.builds.list", 2944 // "parameterOrder": [ 2945 // "projectId" 2946 // ], 2947 // "parameters": { 2948 // "filter": { 2949 // "description": "The raw filter text to constrain the results.", 2950 // "location": "query", 2951 // "type": "string" 2952 // }, 2953 // "pageSize": { 2954 // "description": "Number of results to return in the list.", 2955 // "format": "int32", 2956 // "location": "query", 2957 // "type": "integer" 2958 // }, 2959 // "pageToken": { 2960 // "description": "Token to provide to skip to a particular spot in the list.", 2961 // "location": "query", 2962 // "type": "string" 2963 // }, 2964 // "projectId": { 2965 // "description": "Required. ID of the project.", 2966 // "location": "path", 2967 // "required": true, 2968 // "type": "string" 2969 // } 2970 // }, 2971 // "path": "v1/projects/{projectId}/builds", 2972 // "response": { 2973 // "$ref": "ListBuildsResponse" 2974 // }, 2975 // "scopes": [ 2976 // "https://www.googleapis.com/auth/cloud-platform" 2977 // ] 2978 // } 2979 2980} 2981 2982// Pages invokes f for each page of results. 2983// A non-nil error returned from f will halt the iteration. 2984// The provided context supersedes any context provided to the Context method. 2985func (c *ProjectsBuildsListCall) Pages(ctx context.Context, f func(*ListBuildsResponse) error) error { 2986 c.ctx_ = ctx 2987 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2988 for { 2989 x, err := c.Do() 2990 if err != nil { 2991 return err 2992 } 2993 if err := f(x); err != nil { 2994 return err 2995 } 2996 if x.NextPageToken == "" { 2997 return nil 2998 } 2999 c.PageToken(x.NextPageToken) 3000 } 3001} 3002 3003// method id "cloudbuild.projects.builds.retry": 3004 3005type ProjectsBuildsRetryCall struct { 3006 s *Service 3007 projectId string 3008 id string 3009 retrybuildrequest *RetryBuildRequest 3010 urlParams_ gensupport.URLParams 3011 ctx_ context.Context 3012 header_ http.Header 3013} 3014 3015// Retry: Creates a new build based on the specified build. 3016// 3017// This method creates a new build using the original build request, 3018// which may 3019// or may not result in an identical build. 3020// 3021// For triggered builds: 3022// 3023// * Triggered builds resolve to a precise revision; therefore a retry 3024// of a 3025// triggered build will result in a build that uses the same 3026// revision. 3027// 3028// For non-triggered builds that specify `RepoSource`: 3029// 3030// * If the original build built from the tip of a branch, the retried 3031// build 3032// will build from the tip of that branch, which may not be the same 3033// revision 3034// as the original build. 3035// * If the original build specified a commit sha or revision ID, the 3036// retried 3037// build will use the identical source. 3038// 3039// For builds that specify `StorageSource`: 3040// 3041// * If the original build pulled source from Google Cloud Storage 3042// without 3043// specifying the generation of the object, the new build will use the 3044// current 3045// object, which may be different from the original build source. 3046// * If the original build pulled source from Cloud Storage and 3047// specified the 3048// generation of the object, the new build will attempt to use the 3049// same 3050// object, which may or may not be available depending on the 3051// bucket's 3052// lifecycle management settings. 3053func (r *ProjectsBuildsService) Retry(projectId string, id string, retrybuildrequest *RetryBuildRequest) *ProjectsBuildsRetryCall { 3054 c := &ProjectsBuildsRetryCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3055 c.projectId = projectId 3056 c.id = id 3057 c.retrybuildrequest = retrybuildrequest 3058 return c 3059} 3060 3061// Fields allows partial responses to be retrieved. See 3062// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3063// for more information. 3064func (c *ProjectsBuildsRetryCall) Fields(s ...googleapi.Field) *ProjectsBuildsRetryCall { 3065 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3066 return c 3067} 3068 3069// Context sets the context to be used in this call's Do method. Any 3070// pending HTTP request will be aborted if the provided context is 3071// canceled. 3072func (c *ProjectsBuildsRetryCall) Context(ctx context.Context) *ProjectsBuildsRetryCall { 3073 c.ctx_ = ctx 3074 return c 3075} 3076 3077// Header returns an http.Header that can be modified by the caller to 3078// add HTTP headers to the request. 3079func (c *ProjectsBuildsRetryCall) Header() http.Header { 3080 if c.header_ == nil { 3081 c.header_ = make(http.Header) 3082 } 3083 return c.header_ 3084} 3085 3086func (c *ProjectsBuildsRetryCall) doRequest(alt string) (*http.Response, error) { 3087 reqHeaders := make(http.Header) 3088 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3089 for k, v := range c.header_ { 3090 reqHeaders[k] = v 3091 } 3092 reqHeaders.Set("User-Agent", c.s.userAgent()) 3093 var body io.Reader = nil 3094 body, err := googleapi.WithoutDataWrapper.JSONReader(c.retrybuildrequest) 3095 if err != nil { 3096 return nil, err 3097 } 3098 reqHeaders.Set("Content-Type", "application/json") 3099 c.urlParams_.Set("alt", alt) 3100 c.urlParams_.Set("prettyPrint", "false") 3101 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/builds/{id}:retry") 3102 urls += "?" + c.urlParams_.Encode() 3103 req, err := http.NewRequest("POST", urls, body) 3104 if err != nil { 3105 return nil, err 3106 } 3107 req.Header = reqHeaders 3108 googleapi.Expand(req.URL, map[string]string{ 3109 "projectId": c.projectId, 3110 "id": c.id, 3111 }) 3112 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3113} 3114 3115// Do executes the "cloudbuild.projects.builds.retry" call. 3116// Exactly one of *Operation or error will be non-nil. Any non-2xx 3117// status code is an error. Response headers are in either 3118// *Operation.ServerResponse.Header or (if a response was returned at 3119// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3120// to check whether the returned error was because 3121// http.StatusNotModified was returned. 3122func (c *ProjectsBuildsRetryCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 3123 gensupport.SetOptions(c.urlParams_, opts...) 3124 res, err := c.doRequest("json") 3125 if res != nil && res.StatusCode == http.StatusNotModified { 3126 if res.Body != nil { 3127 res.Body.Close() 3128 } 3129 return nil, &googleapi.Error{ 3130 Code: res.StatusCode, 3131 Header: res.Header, 3132 } 3133 } 3134 if err != nil { 3135 return nil, err 3136 } 3137 defer googleapi.CloseBody(res) 3138 if err := googleapi.CheckResponse(res); err != nil { 3139 return nil, err 3140 } 3141 ret := &Operation{ 3142 ServerResponse: googleapi.ServerResponse{ 3143 Header: res.Header, 3144 HTTPStatusCode: res.StatusCode, 3145 }, 3146 } 3147 target := &ret 3148 if err := gensupport.DecodeResponse(target, res); err != nil { 3149 return nil, err 3150 } 3151 return ret, nil 3152 // { 3153 // "description": "Creates a new build based on the specified build.\n\nThis method creates a new build using the original build request, which may\nor may not result in an identical build.\n\nFor triggered builds:\n\n* Triggered builds resolve to a precise revision; therefore a retry of a\ntriggered build will result in a build that uses the same revision.\n\nFor non-triggered builds that specify `RepoSource`:\n\n* If the original build built from the tip of a branch, the retried build\nwill build from the tip of that branch, which may not be the same revision\nas the original build.\n* If the original build specified a commit sha or revision ID, the retried\nbuild will use the identical source.\n\nFor builds that specify `StorageSource`:\n\n* If the original build pulled source from Google Cloud Storage without\nspecifying the generation of the object, the new build will use the current\nobject, which may be different from the original build source.\n* If the original build pulled source from Cloud Storage and specified the\ngeneration of the object, the new build will attempt to use the same\nobject, which may or may not be available depending on the bucket's\nlifecycle management settings.", 3154 // "flatPath": "v1/projects/{projectId}/builds/{id}:retry", 3155 // "httpMethod": "POST", 3156 // "id": "cloudbuild.projects.builds.retry", 3157 // "parameterOrder": [ 3158 // "projectId", 3159 // "id" 3160 // ], 3161 // "parameters": { 3162 // "id": { 3163 // "description": "Required. Build ID of the original build.", 3164 // "location": "path", 3165 // "required": true, 3166 // "type": "string" 3167 // }, 3168 // "projectId": { 3169 // "description": "Required. ID of the project.", 3170 // "location": "path", 3171 // "required": true, 3172 // "type": "string" 3173 // } 3174 // }, 3175 // "path": "v1/projects/{projectId}/builds/{id}:retry", 3176 // "request": { 3177 // "$ref": "RetryBuildRequest" 3178 // }, 3179 // "response": { 3180 // "$ref": "Operation" 3181 // }, 3182 // "scopes": [ 3183 // "https://www.googleapis.com/auth/cloud-platform" 3184 // ] 3185 // } 3186 3187} 3188 3189// method id "cloudbuild.projects.triggers.create": 3190 3191type ProjectsTriggersCreateCall struct { 3192 s *Service 3193 projectId string 3194 buildtrigger *BuildTrigger 3195 urlParams_ gensupport.URLParams 3196 ctx_ context.Context 3197 header_ http.Header 3198} 3199 3200// Create: Creates a new `BuildTrigger`. 3201// 3202// This API is experimental. 3203func (r *ProjectsTriggersService) Create(projectId string, buildtrigger *BuildTrigger) *ProjectsTriggersCreateCall { 3204 c := &ProjectsTriggersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3205 c.projectId = projectId 3206 c.buildtrigger = buildtrigger 3207 return c 3208} 3209 3210// Fields allows partial responses to be retrieved. See 3211// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3212// for more information. 3213func (c *ProjectsTriggersCreateCall) Fields(s ...googleapi.Field) *ProjectsTriggersCreateCall { 3214 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3215 return c 3216} 3217 3218// Context sets the context to be used in this call's Do method. Any 3219// pending HTTP request will be aborted if the provided context is 3220// canceled. 3221func (c *ProjectsTriggersCreateCall) Context(ctx context.Context) *ProjectsTriggersCreateCall { 3222 c.ctx_ = ctx 3223 return c 3224} 3225 3226// Header returns an http.Header that can be modified by the caller to 3227// add HTTP headers to the request. 3228func (c *ProjectsTriggersCreateCall) Header() http.Header { 3229 if c.header_ == nil { 3230 c.header_ = make(http.Header) 3231 } 3232 return c.header_ 3233} 3234 3235func (c *ProjectsTriggersCreateCall) doRequest(alt string) (*http.Response, error) { 3236 reqHeaders := make(http.Header) 3237 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3238 for k, v := range c.header_ { 3239 reqHeaders[k] = v 3240 } 3241 reqHeaders.Set("User-Agent", c.s.userAgent()) 3242 var body io.Reader = nil 3243 body, err := googleapi.WithoutDataWrapper.JSONReader(c.buildtrigger) 3244 if err != nil { 3245 return nil, err 3246 } 3247 reqHeaders.Set("Content-Type", "application/json") 3248 c.urlParams_.Set("alt", alt) 3249 c.urlParams_.Set("prettyPrint", "false") 3250 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/triggers") 3251 urls += "?" + c.urlParams_.Encode() 3252 req, err := http.NewRequest("POST", urls, body) 3253 if err != nil { 3254 return nil, err 3255 } 3256 req.Header = reqHeaders 3257 googleapi.Expand(req.URL, map[string]string{ 3258 "projectId": c.projectId, 3259 }) 3260 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3261} 3262 3263// Do executes the "cloudbuild.projects.triggers.create" call. 3264// Exactly one of *BuildTrigger or error will be non-nil. Any non-2xx 3265// status code is an error. Response headers are in either 3266// *BuildTrigger.ServerResponse.Header or (if a response was returned at 3267// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3268// to check whether the returned error was because 3269// http.StatusNotModified was returned. 3270func (c *ProjectsTriggersCreateCall) Do(opts ...googleapi.CallOption) (*BuildTrigger, error) { 3271 gensupport.SetOptions(c.urlParams_, opts...) 3272 res, err := c.doRequest("json") 3273 if res != nil && res.StatusCode == http.StatusNotModified { 3274 if res.Body != nil { 3275 res.Body.Close() 3276 } 3277 return nil, &googleapi.Error{ 3278 Code: res.StatusCode, 3279 Header: res.Header, 3280 } 3281 } 3282 if err != nil { 3283 return nil, err 3284 } 3285 defer googleapi.CloseBody(res) 3286 if err := googleapi.CheckResponse(res); err != nil { 3287 return nil, err 3288 } 3289 ret := &BuildTrigger{ 3290 ServerResponse: googleapi.ServerResponse{ 3291 Header: res.Header, 3292 HTTPStatusCode: res.StatusCode, 3293 }, 3294 } 3295 target := &ret 3296 if err := gensupport.DecodeResponse(target, res); err != nil { 3297 return nil, err 3298 } 3299 return ret, nil 3300 // { 3301 // "description": "Creates a new `BuildTrigger`.\n\nThis API is experimental.", 3302 // "flatPath": "v1/projects/{projectId}/triggers", 3303 // "httpMethod": "POST", 3304 // "id": "cloudbuild.projects.triggers.create", 3305 // "parameterOrder": [ 3306 // "projectId" 3307 // ], 3308 // "parameters": { 3309 // "projectId": { 3310 // "description": "Required. ID of the project for which to configure automatic builds.", 3311 // "location": "path", 3312 // "required": true, 3313 // "type": "string" 3314 // } 3315 // }, 3316 // "path": "v1/projects/{projectId}/triggers", 3317 // "request": { 3318 // "$ref": "BuildTrigger" 3319 // }, 3320 // "response": { 3321 // "$ref": "BuildTrigger" 3322 // }, 3323 // "scopes": [ 3324 // "https://www.googleapis.com/auth/cloud-platform" 3325 // ] 3326 // } 3327 3328} 3329 3330// method id "cloudbuild.projects.triggers.delete": 3331 3332type ProjectsTriggersDeleteCall struct { 3333 s *Service 3334 projectId string 3335 triggerId string 3336 urlParams_ gensupport.URLParams 3337 ctx_ context.Context 3338 header_ http.Header 3339} 3340 3341// Delete: Deletes a `BuildTrigger` by its project ID and trigger 3342// ID. 3343// 3344// This API is experimental. 3345func (r *ProjectsTriggersService) Delete(projectId string, triggerId string) *ProjectsTriggersDeleteCall { 3346 c := &ProjectsTriggersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3347 c.projectId = projectId 3348 c.triggerId = triggerId 3349 return c 3350} 3351 3352// Fields allows partial responses to be retrieved. See 3353// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3354// for more information. 3355func (c *ProjectsTriggersDeleteCall) Fields(s ...googleapi.Field) *ProjectsTriggersDeleteCall { 3356 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3357 return c 3358} 3359 3360// Context sets the context to be used in this call's Do method. Any 3361// pending HTTP request will be aborted if the provided context is 3362// canceled. 3363func (c *ProjectsTriggersDeleteCall) Context(ctx context.Context) *ProjectsTriggersDeleteCall { 3364 c.ctx_ = ctx 3365 return c 3366} 3367 3368// Header returns an http.Header that can be modified by the caller to 3369// add HTTP headers to the request. 3370func (c *ProjectsTriggersDeleteCall) Header() http.Header { 3371 if c.header_ == nil { 3372 c.header_ = make(http.Header) 3373 } 3374 return c.header_ 3375} 3376 3377func (c *ProjectsTriggersDeleteCall) doRequest(alt string) (*http.Response, error) { 3378 reqHeaders := make(http.Header) 3379 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3380 for k, v := range c.header_ { 3381 reqHeaders[k] = v 3382 } 3383 reqHeaders.Set("User-Agent", c.s.userAgent()) 3384 var body io.Reader = nil 3385 c.urlParams_.Set("alt", alt) 3386 c.urlParams_.Set("prettyPrint", "false") 3387 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/triggers/{triggerId}") 3388 urls += "?" + c.urlParams_.Encode() 3389 req, err := http.NewRequest("DELETE", urls, body) 3390 if err != nil { 3391 return nil, err 3392 } 3393 req.Header = reqHeaders 3394 googleapi.Expand(req.URL, map[string]string{ 3395 "projectId": c.projectId, 3396 "triggerId": c.triggerId, 3397 }) 3398 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3399} 3400 3401// Do executes the "cloudbuild.projects.triggers.delete" call. 3402// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3403// code is an error. Response headers are in either 3404// *Empty.ServerResponse.Header or (if a response was returned at all) 3405// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3406// check whether the returned error was because http.StatusNotModified 3407// was returned. 3408func (c *ProjectsTriggersDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3409 gensupport.SetOptions(c.urlParams_, opts...) 3410 res, err := c.doRequest("json") 3411 if res != nil && res.StatusCode == http.StatusNotModified { 3412 if res.Body != nil { 3413 res.Body.Close() 3414 } 3415 return nil, &googleapi.Error{ 3416 Code: res.StatusCode, 3417 Header: res.Header, 3418 } 3419 } 3420 if err != nil { 3421 return nil, err 3422 } 3423 defer googleapi.CloseBody(res) 3424 if err := googleapi.CheckResponse(res); err != nil { 3425 return nil, err 3426 } 3427 ret := &Empty{ 3428 ServerResponse: googleapi.ServerResponse{ 3429 Header: res.Header, 3430 HTTPStatusCode: res.StatusCode, 3431 }, 3432 } 3433 target := &ret 3434 if err := gensupport.DecodeResponse(target, res); err != nil { 3435 return nil, err 3436 } 3437 return ret, nil 3438 // { 3439 // "description": "Deletes a `BuildTrigger` by its project ID and trigger ID.\n\nThis API is experimental.", 3440 // "flatPath": "v1/projects/{projectId}/triggers/{triggerId}", 3441 // "httpMethod": "DELETE", 3442 // "id": "cloudbuild.projects.triggers.delete", 3443 // "parameterOrder": [ 3444 // "projectId", 3445 // "triggerId" 3446 // ], 3447 // "parameters": { 3448 // "projectId": { 3449 // "description": "Required. ID of the project that owns the trigger.", 3450 // "location": "path", 3451 // "required": true, 3452 // "type": "string" 3453 // }, 3454 // "triggerId": { 3455 // "description": "Required. ID of the `BuildTrigger` to delete.", 3456 // "location": "path", 3457 // "required": true, 3458 // "type": "string" 3459 // } 3460 // }, 3461 // "path": "v1/projects/{projectId}/triggers/{triggerId}", 3462 // "response": { 3463 // "$ref": "Empty" 3464 // }, 3465 // "scopes": [ 3466 // "https://www.googleapis.com/auth/cloud-platform" 3467 // ] 3468 // } 3469 3470} 3471 3472// method id "cloudbuild.projects.triggers.get": 3473 3474type ProjectsTriggersGetCall struct { 3475 s *Service 3476 projectId string 3477 triggerId string 3478 urlParams_ gensupport.URLParams 3479 ifNoneMatch_ string 3480 ctx_ context.Context 3481 header_ http.Header 3482} 3483 3484// Get: Returns information about a `BuildTrigger`. 3485// 3486// This API is experimental. 3487func (r *ProjectsTriggersService) Get(projectId string, triggerId string) *ProjectsTriggersGetCall { 3488 c := &ProjectsTriggersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3489 c.projectId = projectId 3490 c.triggerId = triggerId 3491 return c 3492} 3493 3494// Fields allows partial responses to be retrieved. See 3495// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3496// for more information. 3497func (c *ProjectsTriggersGetCall) Fields(s ...googleapi.Field) *ProjectsTriggersGetCall { 3498 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3499 return c 3500} 3501 3502// IfNoneMatch sets the optional parameter which makes the operation 3503// fail if the object's ETag matches the given value. This is useful for 3504// getting updates only after the object has changed since the last 3505// request. Use googleapi.IsNotModified to check whether the response 3506// error from Do is the result of In-None-Match. 3507func (c *ProjectsTriggersGetCall) IfNoneMatch(entityTag string) *ProjectsTriggersGetCall { 3508 c.ifNoneMatch_ = entityTag 3509 return c 3510} 3511 3512// Context sets the context to be used in this call's Do method. Any 3513// pending HTTP request will be aborted if the provided context is 3514// canceled. 3515func (c *ProjectsTriggersGetCall) Context(ctx context.Context) *ProjectsTriggersGetCall { 3516 c.ctx_ = ctx 3517 return c 3518} 3519 3520// Header returns an http.Header that can be modified by the caller to 3521// add HTTP headers to the request. 3522func (c *ProjectsTriggersGetCall) Header() http.Header { 3523 if c.header_ == nil { 3524 c.header_ = make(http.Header) 3525 } 3526 return c.header_ 3527} 3528 3529func (c *ProjectsTriggersGetCall) doRequest(alt string) (*http.Response, error) { 3530 reqHeaders := make(http.Header) 3531 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3532 for k, v := range c.header_ { 3533 reqHeaders[k] = v 3534 } 3535 reqHeaders.Set("User-Agent", c.s.userAgent()) 3536 if c.ifNoneMatch_ != "" { 3537 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3538 } 3539 var body io.Reader = nil 3540 c.urlParams_.Set("alt", alt) 3541 c.urlParams_.Set("prettyPrint", "false") 3542 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/triggers/{triggerId}") 3543 urls += "?" + c.urlParams_.Encode() 3544 req, err := http.NewRequest("GET", urls, body) 3545 if err != nil { 3546 return nil, err 3547 } 3548 req.Header = reqHeaders 3549 googleapi.Expand(req.URL, map[string]string{ 3550 "projectId": c.projectId, 3551 "triggerId": c.triggerId, 3552 }) 3553 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3554} 3555 3556// Do executes the "cloudbuild.projects.triggers.get" call. 3557// Exactly one of *BuildTrigger or error will be non-nil. Any non-2xx 3558// status code is an error. Response headers are in either 3559// *BuildTrigger.ServerResponse.Header or (if a response was returned at 3560// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3561// to check whether the returned error was because 3562// http.StatusNotModified was returned. 3563func (c *ProjectsTriggersGetCall) Do(opts ...googleapi.CallOption) (*BuildTrigger, error) { 3564 gensupport.SetOptions(c.urlParams_, opts...) 3565 res, err := c.doRequest("json") 3566 if res != nil && res.StatusCode == http.StatusNotModified { 3567 if res.Body != nil { 3568 res.Body.Close() 3569 } 3570 return nil, &googleapi.Error{ 3571 Code: res.StatusCode, 3572 Header: res.Header, 3573 } 3574 } 3575 if err != nil { 3576 return nil, err 3577 } 3578 defer googleapi.CloseBody(res) 3579 if err := googleapi.CheckResponse(res); err != nil { 3580 return nil, err 3581 } 3582 ret := &BuildTrigger{ 3583 ServerResponse: googleapi.ServerResponse{ 3584 Header: res.Header, 3585 HTTPStatusCode: res.StatusCode, 3586 }, 3587 } 3588 target := &ret 3589 if err := gensupport.DecodeResponse(target, res); err != nil { 3590 return nil, err 3591 } 3592 return ret, nil 3593 // { 3594 // "description": "Returns information about a `BuildTrigger`.\n\nThis API is experimental.", 3595 // "flatPath": "v1/projects/{projectId}/triggers/{triggerId}", 3596 // "httpMethod": "GET", 3597 // "id": "cloudbuild.projects.triggers.get", 3598 // "parameterOrder": [ 3599 // "projectId", 3600 // "triggerId" 3601 // ], 3602 // "parameters": { 3603 // "projectId": { 3604 // "description": "Required. ID of the project that owns the trigger.", 3605 // "location": "path", 3606 // "required": true, 3607 // "type": "string" 3608 // }, 3609 // "triggerId": { 3610 // "description": "Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.", 3611 // "location": "path", 3612 // "required": true, 3613 // "type": "string" 3614 // } 3615 // }, 3616 // "path": "v1/projects/{projectId}/triggers/{triggerId}", 3617 // "response": { 3618 // "$ref": "BuildTrigger" 3619 // }, 3620 // "scopes": [ 3621 // "https://www.googleapis.com/auth/cloud-platform" 3622 // ] 3623 // } 3624 3625} 3626 3627// method id "cloudbuild.projects.triggers.list": 3628 3629type ProjectsTriggersListCall struct { 3630 s *Service 3631 projectId string 3632 urlParams_ gensupport.URLParams 3633 ifNoneMatch_ string 3634 ctx_ context.Context 3635 header_ http.Header 3636} 3637 3638// List: Lists existing `BuildTrigger`s. 3639// 3640// This API is experimental. 3641func (r *ProjectsTriggersService) List(projectId string) *ProjectsTriggersListCall { 3642 c := &ProjectsTriggersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3643 c.projectId = projectId 3644 return c 3645} 3646 3647// PageSize sets the optional parameter "pageSize": Number of results to 3648// return in the list. 3649func (c *ProjectsTriggersListCall) PageSize(pageSize int64) *ProjectsTriggersListCall { 3650 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3651 return c 3652} 3653 3654// PageToken sets the optional parameter "pageToken": Token to provide 3655// to skip to a particular spot in the list. 3656func (c *ProjectsTriggersListCall) PageToken(pageToken string) *ProjectsTriggersListCall { 3657 c.urlParams_.Set("pageToken", pageToken) 3658 return c 3659} 3660 3661// Fields allows partial responses to be retrieved. See 3662// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3663// for more information. 3664func (c *ProjectsTriggersListCall) Fields(s ...googleapi.Field) *ProjectsTriggersListCall { 3665 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3666 return c 3667} 3668 3669// IfNoneMatch sets the optional parameter which makes the operation 3670// fail if the object's ETag matches the given value. This is useful for 3671// getting updates only after the object has changed since the last 3672// request. Use googleapi.IsNotModified to check whether the response 3673// error from Do is the result of In-None-Match. 3674func (c *ProjectsTriggersListCall) IfNoneMatch(entityTag string) *ProjectsTriggersListCall { 3675 c.ifNoneMatch_ = entityTag 3676 return c 3677} 3678 3679// Context sets the context to be used in this call's Do method. Any 3680// pending HTTP request will be aborted if the provided context is 3681// canceled. 3682func (c *ProjectsTriggersListCall) Context(ctx context.Context) *ProjectsTriggersListCall { 3683 c.ctx_ = ctx 3684 return c 3685} 3686 3687// Header returns an http.Header that can be modified by the caller to 3688// add HTTP headers to the request. 3689func (c *ProjectsTriggersListCall) Header() http.Header { 3690 if c.header_ == nil { 3691 c.header_ = make(http.Header) 3692 } 3693 return c.header_ 3694} 3695 3696func (c *ProjectsTriggersListCall) doRequest(alt string) (*http.Response, error) { 3697 reqHeaders := make(http.Header) 3698 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3699 for k, v := range c.header_ { 3700 reqHeaders[k] = v 3701 } 3702 reqHeaders.Set("User-Agent", c.s.userAgent()) 3703 if c.ifNoneMatch_ != "" { 3704 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3705 } 3706 var body io.Reader = nil 3707 c.urlParams_.Set("alt", alt) 3708 c.urlParams_.Set("prettyPrint", "false") 3709 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/triggers") 3710 urls += "?" + c.urlParams_.Encode() 3711 req, err := http.NewRequest("GET", urls, body) 3712 if err != nil { 3713 return nil, err 3714 } 3715 req.Header = reqHeaders 3716 googleapi.Expand(req.URL, map[string]string{ 3717 "projectId": c.projectId, 3718 }) 3719 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3720} 3721 3722// Do executes the "cloudbuild.projects.triggers.list" call. 3723// Exactly one of *ListBuildTriggersResponse or error will be non-nil. 3724// Any non-2xx status code is an error. Response headers are in either 3725// *ListBuildTriggersResponse.ServerResponse.Header or (if a response 3726// was returned at all) in error.(*googleapi.Error).Header. Use 3727// googleapi.IsNotModified to check whether the returned error was 3728// because http.StatusNotModified was returned. 3729func (c *ProjectsTriggersListCall) Do(opts ...googleapi.CallOption) (*ListBuildTriggersResponse, error) { 3730 gensupport.SetOptions(c.urlParams_, opts...) 3731 res, err := c.doRequest("json") 3732 if res != nil && res.StatusCode == http.StatusNotModified { 3733 if res.Body != nil { 3734 res.Body.Close() 3735 } 3736 return nil, &googleapi.Error{ 3737 Code: res.StatusCode, 3738 Header: res.Header, 3739 } 3740 } 3741 if err != nil { 3742 return nil, err 3743 } 3744 defer googleapi.CloseBody(res) 3745 if err := googleapi.CheckResponse(res); err != nil { 3746 return nil, err 3747 } 3748 ret := &ListBuildTriggersResponse{ 3749 ServerResponse: googleapi.ServerResponse{ 3750 Header: res.Header, 3751 HTTPStatusCode: res.StatusCode, 3752 }, 3753 } 3754 target := &ret 3755 if err := gensupport.DecodeResponse(target, res); err != nil { 3756 return nil, err 3757 } 3758 return ret, nil 3759 // { 3760 // "description": "Lists existing `BuildTrigger`s.\n\nThis API is experimental.", 3761 // "flatPath": "v1/projects/{projectId}/triggers", 3762 // "httpMethod": "GET", 3763 // "id": "cloudbuild.projects.triggers.list", 3764 // "parameterOrder": [ 3765 // "projectId" 3766 // ], 3767 // "parameters": { 3768 // "pageSize": { 3769 // "description": "Number of results to return in the list.", 3770 // "format": "int32", 3771 // "location": "query", 3772 // "type": "integer" 3773 // }, 3774 // "pageToken": { 3775 // "description": "Token to provide to skip to a particular spot in the list.", 3776 // "location": "query", 3777 // "type": "string" 3778 // }, 3779 // "projectId": { 3780 // "description": "Required. ID of the project for which to list BuildTriggers.", 3781 // "location": "path", 3782 // "required": true, 3783 // "type": "string" 3784 // } 3785 // }, 3786 // "path": "v1/projects/{projectId}/triggers", 3787 // "response": { 3788 // "$ref": "ListBuildTriggersResponse" 3789 // }, 3790 // "scopes": [ 3791 // "https://www.googleapis.com/auth/cloud-platform" 3792 // ] 3793 // } 3794 3795} 3796 3797// Pages invokes f for each page of results. 3798// A non-nil error returned from f will halt the iteration. 3799// The provided context supersedes any context provided to the Context method. 3800func (c *ProjectsTriggersListCall) Pages(ctx context.Context, f func(*ListBuildTriggersResponse) error) error { 3801 c.ctx_ = ctx 3802 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3803 for { 3804 x, err := c.Do() 3805 if err != nil { 3806 return err 3807 } 3808 if err := f(x); err != nil { 3809 return err 3810 } 3811 if x.NextPageToken == "" { 3812 return nil 3813 } 3814 c.PageToken(x.NextPageToken) 3815 } 3816} 3817 3818// method id "cloudbuild.projects.triggers.patch": 3819 3820type ProjectsTriggersPatchCall struct { 3821 s *Service 3822 projectId string 3823 triggerId string 3824 buildtrigger *BuildTrigger 3825 urlParams_ gensupport.URLParams 3826 ctx_ context.Context 3827 header_ http.Header 3828} 3829 3830// Patch: Updates a `BuildTrigger` by its project ID and trigger 3831// ID. 3832// 3833// This API is experimental. 3834func (r *ProjectsTriggersService) Patch(projectId string, triggerId string, buildtrigger *BuildTrigger) *ProjectsTriggersPatchCall { 3835 c := &ProjectsTriggersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3836 c.projectId = projectId 3837 c.triggerId = triggerId 3838 c.buildtrigger = buildtrigger 3839 return c 3840} 3841 3842// Fields allows partial responses to be retrieved. See 3843// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3844// for more information. 3845func (c *ProjectsTriggersPatchCall) Fields(s ...googleapi.Field) *ProjectsTriggersPatchCall { 3846 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3847 return c 3848} 3849 3850// Context sets the context to be used in this call's Do method. Any 3851// pending HTTP request will be aborted if the provided context is 3852// canceled. 3853func (c *ProjectsTriggersPatchCall) Context(ctx context.Context) *ProjectsTriggersPatchCall { 3854 c.ctx_ = ctx 3855 return c 3856} 3857 3858// Header returns an http.Header that can be modified by the caller to 3859// add HTTP headers to the request. 3860func (c *ProjectsTriggersPatchCall) Header() http.Header { 3861 if c.header_ == nil { 3862 c.header_ = make(http.Header) 3863 } 3864 return c.header_ 3865} 3866 3867func (c *ProjectsTriggersPatchCall) doRequest(alt string) (*http.Response, error) { 3868 reqHeaders := make(http.Header) 3869 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3870 for k, v := range c.header_ { 3871 reqHeaders[k] = v 3872 } 3873 reqHeaders.Set("User-Agent", c.s.userAgent()) 3874 var body io.Reader = nil 3875 body, err := googleapi.WithoutDataWrapper.JSONReader(c.buildtrigger) 3876 if err != nil { 3877 return nil, err 3878 } 3879 reqHeaders.Set("Content-Type", "application/json") 3880 c.urlParams_.Set("alt", alt) 3881 c.urlParams_.Set("prettyPrint", "false") 3882 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/triggers/{triggerId}") 3883 urls += "?" + c.urlParams_.Encode() 3884 req, err := http.NewRequest("PATCH", urls, body) 3885 if err != nil { 3886 return nil, err 3887 } 3888 req.Header = reqHeaders 3889 googleapi.Expand(req.URL, map[string]string{ 3890 "projectId": c.projectId, 3891 "triggerId": c.triggerId, 3892 }) 3893 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3894} 3895 3896// Do executes the "cloudbuild.projects.triggers.patch" call. 3897// Exactly one of *BuildTrigger or error will be non-nil. Any non-2xx 3898// status code is an error. Response headers are in either 3899// *BuildTrigger.ServerResponse.Header or (if a response was returned at 3900// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3901// to check whether the returned error was because 3902// http.StatusNotModified was returned. 3903func (c *ProjectsTriggersPatchCall) Do(opts ...googleapi.CallOption) (*BuildTrigger, error) { 3904 gensupport.SetOptions(c.urlParams_, opts...) 3905 res, err := c.doRequest("json") 3906 if res != nil && res.StatusCode == http.StatusNotModified { 3907 if res.Body != nil { 3908 res.Body.Close() 3909 } 3910 return nil, &googleapi.Error{ 3911 Code: res.StatusCode, 3912 Header: res.Header, 3913 } 3914 } 3915 if err != nil { 3916 return nil, err 3917 } 3918 defer googleapi.CloseBody(res) 3919 if err := googleapi.CheckResponse(res); err != nil { 3920 return nil, err 3921 } 3922 ret := &BuildTrigger{ 3923 ServerResponse: googleapi.ServerResponse{ 3924 Header: res.Header, 3925 HTTPStatusCode: res.StatusCode, 3926 }, 3927 } 3928 target := &ret 3929 if err := gensupport.DecodeResponse(target, res); err != nil { 3930 return nil, err 3931 } 3932 return ret, nil 3933 // { 3934 // "description": "Updates a `BuildTrigger` by its project ID and trigger ID.\n\nThis API is experimental.", 3935 // "flatPath": "v1/projects/{projectId}/triggers/{triggerId}", 3936 // "httpMethod": "PATCH", 3937 // "id": "cloudbuild.projects.triggers.patch", 3938 // "parameterOrder": [ 3939 // "projectId", 3940 // "triggerId" 3941 // ], 3942 // "parameters": { 3943 // "projectId": { 3944 // "description": "Required. ID of the project that owns the trigger.", 3945 // "location": "path", 3946 // "required": true, 3947 // "type": "string" 3948 // }, 3949 // "triggerId": { 3950 // "description": "Required. ID of the `BuildTrigger` to update.", 3951 // "location": "path", 3952 // "required": true, 3953 // "type": "string" 3954 // } 3955 // }, 3956 // "path": "v1/projects/{projectId}/triggers/{triggerId}", 3957 // "request": { 3958 // "$ref": "BuildTrigger" 3959 // }, 3960 // "response": { 3961 // "$ref": "BuildTrigger" 3962 // }, 3963 // "scopes": [ 3964 // "https://www.googleapis.com/auth/cloud-platform" 3965 // ] 3966 // } 3967 3968} 3969 3970// method id "cloudbuild.projects.triggers.run": 3971 3972type ProjectsTriggersRunCall struct { 3973 s *Service 3974 projectId string 3975 triggerId string 3976 reposource *RepoSource 3977 urlParams_ gensupport.URLParams 3978 ctx_ context.Context 3979 header_ http.Header 3980} 3981 3982// Run: Runs a `BuildTrigger` at a particular source revision. 3983func (r *ProjectsTriggersService) Run(projectId string, triggerId string, reposource *RepoSource) *ProjectsTriggersRunCall { 3984 c := &ProjectsTriggersRunCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3985 c.projectId = projectId 3986 c.triggerId = triggerId 3987 c.reposource = reposource 3988 return c 3989} 3990 3991// Fields allows partial responses to be retrieved. See 3992// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3993// for more information. 3994func (c *ProjectsTriggersRunCall) Fields(s ...googleapi.Field) *ProjectsTriggersRunCall { 3995 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3996 return c 3997} 3998 3999// Context sets the context to be used in this call's Do method. Any 4000// pending HTTP request will be aborted if the provided context is 4001// canceled. 4002func (c *ProjectsTriggersRunCall) Context(ctx context.Context) *ProjectsTriggersRunCall { 4003 c.ctx_ = ctx 4004 return c 4005} 4006 4007// Header returns an http.Header that can be modified by the caller to 4008// add HTTP headers to the request. 4009func (c *ProjectsTriggersRunCall) Header() http.Header { 4010 if c.header_ == nil { 4011 c.header_ = make(http.Header) 4012 } 4013 return c.header_ 4014} 4015 4016func (c *ProjectsTriggersRunCall) doRequest(alt string) (*http.Response, error) { 4017 reqHeaders := make(http.Header) 4018 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4019 for k, v := range c.header_ { 4020 reqHeaders[k] = v 4021 } 4022 reqHeaders.Set("User-Agent", c.s.userAgent()) 4023 var body io.Reader = nil 4024 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reposource) 4025 if err != nil { 4026 return nil, err 4027 } 4028 reqHeaders.Set("Content-Type", "application/json") 4029 c.urlParams_.Set("alt", alt) 4030 c.urlParams_.Set("prettyPrint", "false") 4031 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/projects/{projectId}/triggers/{triggerId}:run") 4032 urls += "?" + c.urlParams_.Encode() 4033 req, err := http.NewRequest("POST", urls, body) 4034 if err != nil { 4035 return nil, err 4036 } 4037 req.Header = reqHeaders 4038 googleapi.Expand(req.URL, map[string]string{ 4039 "projectId": c.projectId, 4040 "triggerId": c.triggerId, 4041 }) 4042 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4043} 4044 4045// Do executes the "cloudbuild.projects.triggers.run" call. 4046// Exactly one of *Operation or error will be non-nil. Any non-2xx 4047// status code is an error. Response headers are in either 4048// *Operation.ServerResponse.Header or (if a response was returned at 4049// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4050// to check whether the returned error was because 4051// http.StatusNotModified was returned. 4052func (c *ProjectsTriggersRunCall) Do(opts ...googleapi.CallOption) (*Operation, error) { 4053 gensupport.SetOptions(c.urlParams_, opts...) 4054 res, err := c.doRequest("json") 4055 if res != nil && res.StatusCode == http.StatusNotModified { 4056 if res.Body != nil { 4057 res.Body.Close() 4058 } 4059 return nil, &googleapi.Error{ 4060 Code: res.StatusCode, 4061 Header: res.Header, 4062 } 4063 } 4064 if err != nil { 4065 return nil, err 4066 } 4067 defer googleapi.CloseBody(res) 4068 if err := googleapi.CheckResponse(res); err != nil { 4069 return nil, err 4070 } 4071 ret := &Operation{ 4072 ServerResponse: googleapi.ServerResponse{ 4073 Header: res.Header, 4074 HTTPStatusCode: res.StatusCode, 4075 }, 4076 } 4077 target := &ret 4078 if err := gensupport.DecodeResponse(target, res); err != nil { 4079 return nil, err 4080 } 4081 return ret, nil 4082 // { 4083 // "description": "Runs a `BuildTrigger` at a particular source revision.", 4084 // "flatPath": "v1/projects/{projectId}/triggers/{triggerId}:run", 4085 // "httpMethod": "POST", 4086 // "id": "cloudbuild.projects.triggers.run", 4087 // "parameterOrder": [ 4088 // "projectId", 4089 // "triggerId" 4090 // ], 4091 // "parameters": { 4092 // "projectId": { 4093 // "description": "Required. ID of the project.", 4094 // "location": "path", 4095 // "required": true, 4096 // "type": "string" 4097 // }, 4098 // "triggerId": { 4099 // "description": "Required. ID of the trigger.", 4100 // "location": "path", 4101 // "required": true, 4102 // "type": "string" 4103 // } 4104 // }, 4105 // "path": "v1/projects/{projectId}/triggers/{triggerId}:run", 4106 // "request": { 4107 // "$ref": "RepoSource" 4108 // }, 4109 // "response": { 4110 // "$ref": "Operation" 4111 // }, 4112 // "scopes": [ 4113 // "https://www.googleapis.com/auth/cloud-platform" 4114 // ] 4115 // } 4116 4117} 4118