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.
 
 
 

3755 rader
126 KiB

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