Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

4095 rader
138 KiB

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