You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2646 lines
95 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package composer provides access to the Cloud Composer API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/composer/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/composer/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // composerService, err := composer.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // composerService, err := composer.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // composerService, err := composer.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package composer // import "google.golang.org/api/composer/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "composer:v1"
  67. const apiName = "composer"
  68. const apiVersion = "v1"
  69. const basePath = "https://composer.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Projects = NewProjectsService(s)
  106. return s, nil
  107. }
  108. type Service struct {
  109. client *http.Client
  110. BasePath string // API endpoint base URL
  111. UserAgent string // optional additional User-Agent fragment
  112. Projects *ProjectsService
  113. }
  114. func (s *Service) userAgent() string {
  115. if s.UserAgent == "" {
  116. return googleapi.UserAgent
  117. }
  118. return googleapi.UserAgent + " " + s.UserAgent
  119. }
  120. func NewProjectsService(s *Service) *ProjectsService {
  121. rs := &ProjectsService{s: s}
  122. rs.Locations = NewProjectsLocationsService(s)
  123. return rs
  124. }
  125. type ProjectsService struct {
  126. s *Service
  127. Locations *ProjectsLocationsService
  128. }
  129. func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
  130. rs := &ProjectsLocationsService{s: s}
  131. rs.Environments = NewProjectsLocationsEnvironmentsService(s)
  132. rs.ImageVersions = NewProjectsLocationsImageVersionsService(s)
  133. rs.Operations = NewProjectsLocationsOperationsService(s)
  134. return rs
  135. }
  136. type ProjectsLocationsService struct {
  137. s *Service
  138. Environments *ProjectsLocationsEnvironmentsService
  139. ImageVersions *ProjectsLocationsImageVersionsService
  140. Operations *ProjectsLocationsOperationsService
  141. }
  142. func NewProjectsLocationsEnvironmentsService(s *Service) *ProjectsLocationsEnvironmentsService {
  143. rs := &ProjectsLocationsEnvironmentsService{s: s}
  144. return rs
  145. }
  146. type ProjectsLocationsEnvironmentsService struct {
  147. s *Service
  148. }
  149. func NewProjectsLocationsImageVersionsService(s *Service) *ProjectsLocationsImageVersionsService {
  150. rs := &ProjectsLocationsImageVersionsService{s: s}
  151. return rs
  152. }
  153. type ProjectsLocationsImageVersionsService struct {
  154. s *Service
  155. }
  156. func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
  157. rs := &ProjectsLocationsOperationsService{s: s}
  158. return rs
  159. }
  160. type ProjectsLocationsOperationsService struct {
  161. s *Service
  162. }
  163. // Empty: A generic empty message that you can re-use to avoid defining
  164. // duplicated
  165. // empty messages in your APIs. A typical example is to use it as the
  166. // request
  167. // or the response type of an API method. For instance:
  168. //
  169. // service Foo {
  170. // rpc Bar(google.protobuf.Empty) returns
  171. // (google.protobuf.Empty);
  172. // }
  173. //
  174. // The JSON representation for `Empty` is empty JSON object `{}`.
  175. type Empty struct {
  176. // ServerResponse contains the HTTP response code and headers from the
  177. // server.
  178. googleapi.ServerResponse `json:"-"`
  179. }
  180. // Environment: An environment for running orchestration tasks.
  181. type Environment struct {
  182. // Config: Configuration parameters for this environment.
  183. Config *EnvironmentConfig `json:"config,omitempty"`
  184. // CreateTime: Output only.
  185. // The time at which this environment was created.
  186. CreateTime string `json:"createTime,omitempty"`
  187. // Labels: Optional. User-defined labels for this environment.
  188. // The labels map can contain no more than 64 entries. Entries of the
  189. // labels
  190. // map are UTF8 strings that comply with the following restrictions:
  191. //
  192. // * Keys must conform to regexp: \p{Ll}\p{Lo}{0,62}
  193. // * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63}
  194. // * Both keys and values are additionally constrained to be <= 128
  195. // bytes in
  196. // size.
  197. Labels map[string]string `json:"labels,omitempty"`
  198. // Name: The resource name of the environment, in the
  199. // form:
  200. // "projects/{projectId}/locations/{locationId}/environments/{envir
  201. // onmentId}"
  202. Name string `json:"name,omitempty"`
  203. // State: The current state of the environment.
  204. //
  205. // Possible values:
  206. // "STATE_UNSPECIFIED" - The state of the environment is unknown.
  207. // "CREATING" - The environment is in the process of being created.
  208. // "RUNNING" - The environment is currently running and healthy. It is
  209. // ready for use.
  210. // "UPDATING" - The environment is being updated. It remains usable
  211. // but cannot receive
  212. // additional update requests or be deleted at this time.
  213. // "DELETING" - The environment is undergoing deletion. It cannot be
  214. // used.
  215. // "ERROR" - The environment has encountered an error and cannot be
  216. // used.
  217. State string `json:"state,omitempty"`
  218. // UpdateTime: Output only.
  219. // The time at which this environment was last modified.
  220. UpdateTime string `json:"updateTime,omitempty"`
  221. // Uuid: Output only.
  222. // The UUID (Universally Unique IDentifier) associated with this
  223. // environment.
  224. // This value is generated when the environment is created.
  225. Uuid string `json:"uuid,omitempty"`
  226. // ServerResponse contains the HTTP response code and headers from the
  227. // server.
  228. googleapi.ServerResponse `json:"-"`
  229. // ForceSendFields is a list of field names (e.g. "Config") to
  230. // unconditionally include in API requests. By default, fields with
  231. // empty values are omitted from API requests. However, any non-pointer,
  232. // non-interface field appearing in ForceSendFields will be sent to the
  233. // server regardless of whether the field is empty or not. This may be
  234. // used to include empty fields in Patch requests.
  235. ForceSendFields []string `json:"-"`
  236. // NullFields is a list of field names (e.g. "Config") to include in API
  237. // requests with the JSON null value. By default, fields with empty
  238. // values are omitted from API requests. However, any field with an
  239. // empty value appearing in NullFields will be sent to the server as
  240. // null. It is an error if a field in this list has a non-empty value.
  241. // This may be used to include null fields in Patch requests.
  242. NullFields []string `json:"-"`
  243. }
  244. func (s *Environment) MarshalJSON() ([]byte, error) {
  245. type NoMethod Environment
  246. raw := NoMethod(*s)
  247. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  248. }
  249. // EnvironmentConfig: Configuration information for an environment.
  250. type EnvironmentConfig struct {
  251. // AirflowUri: Output only.
  252. // The URI of the Apache Airflow Web UI hosted within this environment
  253. // (see
  254. // [Airflow web
  255. // interface](/composer/docs/how-to/accessing/airflow-web-interface)).
  256. AirflowUri string `json:"airflowUri,omitempty"`
  257. // DagGcsPrefix: Output only.
  258. // The Cloud Storage prefix of the DAGs for this environment. Although
  259. // Cloud
  260. // Storage objects reside in a flat namespace, a hierarchical file
  261. // tree
  262. // can be simulated using "/"-delimited object name prefixes. DAG
  263. // objects for
  264. // this environment reside in a simulated directory with the given
  265. // prefix.
  266. DagGcsPrefix string `json:"dagGcsPrefix,omitempty"`
  267. // GkeCluster: Output only.
  268. // The Kubernetes Engine cluster used to run this environment.
  269. GkeCluster string `json:"gkeCluster,omitempty"`
  270. // NodeConfig: The configuration used for the Kubernetes Engine cluster.
  271. NodeConfig *NodeConfig `json:"nodeConfig,omitempty"`
  272. // NodeCount: The number of nodes in the Kubernetes Engine cluster that
  273. // will be
  274. // used to run this environment.
  275. NodeCount int64 `json:"nodeCount,omitempty"`
  276. // SoftwareConfig: The configuration settings for software inside the
  277. // environment.
  278. SoftwareConfig *SoftwareConfig `json:"softwareConfig,omitempty"`
  279. // ForceSendFields is a list of field names (e.g. "AirflowUri") to
  280. // unconditionally include in API requests. By default, fields with
  281. // empty values are omitted from API requests. However, any non-pointer,
  282. // non-interface field appearing in ForceSendFields will be sent to the
  283. // server regardless of whether the field is empty or not. This may be
  284. // used to include empty fields in Patch requests.
  285. ForceSendFields []string `json:"-"`
  286. // NullFields is a list of field names (e.g. "AirflowUri") to include in
  287. // API requests with the JSON null value. By default, fields with empty
  288. // values are omitted from API requests. However, any field with an
  289. // empty value appearing in NullFields will be sent to the server as
  290. // null. It is an error if a field in this list has a non-empty value.
  291. // This may be used to include null fields in Patch requests.
  292. NullFields []string `json:"-"`
  293. }
  294. func (s *EnvironmentConfig) MarshalJSON() ([]byte, error) {
  295. type NoMethod EnvironmentConfig
  296. raw := NoMethod(*s)
  297. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  298. }
  299. // ImageVersion: ImageVersion information
  300. type ImageVersion struct {
  301. // ImageVersionId: The string identifier of the ImageVersion, in the
  302. // form:
  303. // "composer-x.y.z-airflow-a.b(.c)"
  304. ImageVersionId string `json:"imageVersionId,omitempty"`
  305. // IsDefault: Whether this is the default ImageVersion used by Composer
  306. // during
  307. // environment creation if no input ImageVersion is specified.
  308. IsDefault bool `json:"isDefault,omitempty"`
  309. // SupportedPythonVersions: supported python versions
  310. SupportedPythonVersions []string `json:"supportedPythonVersions,omitempty"`
  311. // ForceSendFields is a list of field names (e.g. "ImageVersionId") to
  312. // unconditionally include in API requests. By default, fields with
  313. // empty values are omitted from API requests. However, any non-pointer,
  314. // non-interface field appearing in ForceSendFields will be sent to the
  315. // server regardless of whether the field is empty or not. This may be
  316. // used to include empty fields in Patch requests.
  317. ForceSendFields []string `json:"-"`
  318. // NullFields is a list of field names (e.g. "ImageVersionId") to
  319. // include in API requests with the JSON null value. By default, fields
  320. // with empty values are omitted from API requests. However, any field
  321. // with an empty value appearing in NullFields will be sent to the
  322. // server as null. It is an error if a field in this list has a
  323. // non-empty value. This may be used to include null fields in Patch
  324. // requests.
  325. NullFields []string `json:"-"`
  326. }
  327. func (s *ImageVersion) MarshalJSON() ([]byte, error) {
  328. type NoMethod ImageVersion
  329. raw := NoMethod(*s)
  330. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  331. }
  332. // ListEnvironmentsResponse: The environments in a project and location.
  333. type ListEnvironmentsResponse struct {
  334. // Environments: The list of environments returned by a
  335. // ListEnvironmentsRequest.
  336. Environments []*Environment `json:"environments,omitempty"`
  337. // NextPageToken: The page token used to query for the next page if one
  338. // exists.
  339. NextPageToken string `json:"nextPageToken,omitempty"`
  340. // ServerResponse contains the HTTP response code and headers from the
  341. // server.
  342. googleapi.ServerResponse `json:"-"`
  343. // ForceSendFields is a list of field names (e.g. "Environments") to
  344. // unconditionally include in API requests. By default, fields with
  345. // empty values are omitted from API requests. However, any non-pointer,
  346. // non-interface field appearing in ForceSendFields will be sent to the
  347. // server regardless of whether the field is empty or not. This may be
  348. // used to include empty fields in Patch requests.
  349. ForceSendFields []string `json:"-"`
  350. // NullFields is a list of field names (e.g. "Environments") to include
  351. // in API requests with the JSON null value. By default, fields with
  352. // empty values are omitted from API requests. However, any field with
  353. // an empty value appearing in NullFields will be sent to the server as
  354. // null. It is an error if a field in this list has a non-empty value.
  355. // This may be used to include null fields in Patch requests.
  356. NullFields []string `json:"-"`
  357. }
  358. func (s *ListEnvironmentsResponse) MarshalJSON() ([]byte, error) {
  359. type NoMethod ListEnvironmentsResponse
  360. raw := NoMethod(*s)
  361. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  362. }
  363. // ListImageVersionsResponse: The ImageVersions in a project and
  364. // location.
  365. type ListImageVersionsResponse struct {
  366. // ImageVersions: The list of supported ImageVersions in a location.
  367. ImageVersions []*ImageVersion `json:"imageVersions,omitempty"`
  368. // NextPageToken: The page token used to query for the next page if one
  369. // exists.
  370. NextPageToken string `json:"nextPageToken,omitempty"`
  371. // ServerResponse contains the HTTP response code and headers from the
  372. // server.
  373. googleapi.ServerResponse `json:"-"`
  374. // ForceSendFields is a list of field names (e.g. "ImageVersions") to
  375. // unconditionally include in API requests. By default, fields with
  376. // empty values are omitted from API requests. However, any non-pointer,
  377. // non-interface field appearing in ForceSendFields will be sent to the
  378. // server regardless of whether the field is empty or not. This may be
  379. // used to include empty fields in Patch requests.
  380. ForceSendFields []string `json:"-"`
  381. // NullFields is a list of field names (e.g. "ImageVersions") to include
  382. // in API requests with the JSON null value. By default, fields with
  383. // empty values are omitted from API requests. However, any field with
  384. // an empty value appearing in NullFields will be sent to the server as
  385. // null. It is an error if a field in this list has a non-empty value.
  386. // This may be used to include null fields in Patch requests.
  387. NullFields []string `json:"-"`
  388. }
  389. func (s *ListImageVersionsResponse) MarshalJSON() ([]byte, error) {
  390. type NoMethod ListImageVersionsResponse
  391. raw := NoMethod(*s)
  392. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  393. }
  394. // ListOperationsResponse: The response message for
  395. // Operations.ListOperations.
  396. type ListOperationsResponse struct {
  397. // NextPageToken: The standard List next-page token.
  398. NextPageToken string `json:"nextPageToken,omitempty"`
  399. // Operations: A list of operations that matches the specified filter in
  400. // the request.
  401. Operations []*Operation `json:"operations,omitempty"`
  402. // ServerResponse contains the HTTP response code and headers from the
  403. // server.
  404. googleapi.ServerResponse `json:"-"`
  405. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  406. // unconditionally include in API requests. By default, fields with
  407. // empty values are omitted from API requests. However, any non-pointer,
  408. // non-interface field appearing in ForceSendFields will be sent to the
  409. // server regardless of whether the field is empty or not. This may be
  410. // used to include empty fields in Patch requests.
  411. ForceSendFields []string `json:"-"`
  412. // NullFields is a list of field names (e.g. "NextPageToken") to include
  413. // in API requests with the JSON null value. By default, fields with
  414. // empty values are omitted from API requests. However, any field with
  415. // an empty value appearing in NullFields will be sent to the server as
  416. // null. It is an error if a field in this list has a non-empty value.
  417. // This may be used to include null fields in Patch requests.
  418. NullFields []string `json:"-"`
  419. }
  420. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  421. type NoMethod ListOperationsResponse
  422. raw := NoMethod(*s)
  423. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  424. }
  425. // NodeConfig: The configuration information for the Kubernetes Engine
  426. // nodes running
  427. // the Apache Airflow software.
  428. type NodeConfig struct {
  429. // DiskSizeGb: Optional. The disk size in GB used for node VMs. Minimum
  430. // size is 20GB.
  431. // If unspecified, defaults to 100GB. Cannot be updated.
  432. DiskSizeGb int64 `json:"diskSizeGb,omitempty"`
  433. // Location: Optional. The Compute Engine
  434. // [zone](/compute/docs/regions-zones) in which
  435. // to deploy the VMs used to run the Apache Airflow software, specified
  436. // as a
  437. // [relative resource
  438. // name](/apis/design/resource_names#relative_resource_name).
  439. // For example: "projects/{projectId}/zones/{zoneId}".
  440. //
  441. // This `location` must belong to the enclosing environment's project
  442. // and
  443. // location. If both this field and `nodeConfig.machineType` are
  444. // specified,
  445. // `nodeConfig.machineType` must belong to this `location`; if both
  446. // are
  447. // unspecified, the service will pick a zone in the Compute Engine
  448. // region
  449. // corresponding to the Cloud Composer location, and propagate that
  450. // choice to
  451. // both fields. If only one field (`location` or
  452. // `nodeConfig.machineType`) is
  453. // specified, the location information from the specified field will
  454. // be
  455. // propagated to the unspecified field.
  456. Location string `json:"location,omitempty"`
  457. // MachineType: Optional. The Compute Engine
  458. // [machine type](/compute/docs/machine-types) used for cluster
  459. // instances,
  460. // specified as a
  461. // [relative resource
  462. // name](/apis/design/resource_names#relative_resource_name).
  463. // For
  464. // example:
  465. // "projects/{projectId}/zones/{zoneId}/machineTypes/{machineTyp
  466. // eId}".
  467. //
  468. // The `machineType` must belong to the enclosing environment's project
  469. // and
  470. // location. If both this field and `nodeConfig.location` are
  471. // specified,
  472. // this `machineType` must belong to the `nodeConfig.location`; if both
  473. // are
  474. // unspecified, the service will pick a zone in the Compute Engine
  475. // region
  476. // corresponding to the Cloud Composer location, and propagate that
  477. // choice to
  478. // both fields. If exactly one of this field and `nodeConfig.location`
  479. // is
  480. // specified, the location information from the specified field will
  481. // be
  482. // propagated to the unspecified field.
  483. //
  484. // If this field is unspecified, the `machineTypeId` defaults
  485. // to "n1-standard-1".
  486. MachineType string `json:"machineType,omitempty"`
  487. // Network: Optional. The Compute Engine network to be used for
  488. // machine
  489. // communications, specified as a
  490. // [relative resource
  491. // name](/apis/design/resource_names#relative_resource_name).
  492. // For example:
  493. // "projects/{projectId}/global/networks/{networkId}".
  494. //
  495. // [Shared VPC](/vpc/docs/shared-vpc) is not currently supported.
  496. // The
  497. // network must belong to the environment's project. If unspecified,
  498. // the
  499. // "default" network ID in the environment's project is used. If
  500. // a
  501. // [Custom Subnet Network](/vpc/docs/vpc#vpc_networks_and_subnets)
  502. // is provided, `nodeConfig.subnetwork` must also be provided.
  503. Network string `json:"network,omitempty"`
  504. // OauthScopes: Optional. The set of Google API scopes to be made
  505. // available on all
  506. // node VMs. If `oauth_scopes` is empty, defaults
  507. // to
  508. // ["https://www.googleapis.com/auth/cloud-platform"]. Cannot be
  509. // updated.
  510. OauthScopes []string `json:"oauthScopes,omitempty"`
  511. // ServiceAccount: Optional. The Google Cloud Platform Service Account
  512. // to be used by the node
  513. // VMs. If a service account is not specified, the "default" Compute
  514. // Engine
  515. // service account is used. Cannot be updated.
  516. ServiceAccount string `json:"serviceAccount,omitempty"`
  517. // Subnetwork: Optional. The Compute Engine subnetwork to be used for
  518. // machine
  519. // communications, specified as a
  520. // [relative resource
  521. // name](/apis/design/resource_names#relative_resource_name).
  522. // For
  523. // example:
  524. // "projects/{projectId}/regions/{regionId}/subnetworks/{subnetw
  525. // orkId}"
  526. //
  527. // If a subnetwork is provided, `nodeConfig.network` must also be
  528. // provided,
  529. // and the subnetwork must belong to the enclosing environment's project
  530. // and
  531. // location.
  532. Subnetwork string `json:"subnetwork,omitempty"`
  533. // Tags: Optional. The list of instance tags applied to all node VMs.
  534. // Tags are used
  535. // to identify valid sources or targets for network firewalls. Each tag
  536. // within
  537. // the list must comply with
  538. // [RFC1035](https://www.ietf.org/rfc/rfc1035.txt).
  539. // Cannot be updated.
  540. Tags []string `json:"tags,omitempty"`
  541. // ForceSendFields is a list of field names (e.g. "DiskSizeGb") to
  542. // unconditionally include in API requests. By default, fields with
  543. // empty values are omitted from API requests. However, any non-pointer,
  544. // non-interface field appearing in ForceSendFields will be sent to the
  545. // server regardless of whether the field is empty or not. This may be
  546. // used to include empty fields in Patch requests.
  547. ForceSendFields []string `json:"-"`
  548. // NullFields is a list of field names (e.g. "DiskSizeGb") to include in
  549. // API requests with the JSON null value. By default, fields with empty
  550. // values are omitted from API requests. However, any field with an
  551. // empty value appearing in NullFields will be sent to the server as
  552. // null. It is an error if a field in this list has a non-empty value.
  553. // This may be used to include null fields in Patch requests.
  554. NullFields []string `json:"-"`
  555. }
  556. func (s *NodeConfig) MarshalJSON() ([]byte, error) {
  557. type NoMethod NodeConfig
  558. raw := NoMethod(*s)
  559. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  560. }
  561. // Operation: This resource represents a long-running operation that is
  562. // the result of a
  563. // network API call.
  564. type Operation struct {
  565. // Done: If the value is `false`, it means the operation is still in
  566. // progress.
  567. // If `true`, the operation is completed, and either `error` or
  568. // `response` is
  569. // available.
  570. Done bool `json:"done,omitempty"`
  571. // Error: The error result of the operation in case of failure or
  572. // cancellation.
  573. Error *Status `json:"error,omitempty"`
  574. // Metadata: Service-specific metadata associated with the operation.
  575. // It typically
  576. // contains progress information and common metadata such as create
  577. // time.
  578. // Some services might not provide such metadata. Any method that
  579. // returns a
  580. // long-running operation should document the metadata type, if any.
  581. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  582. // Name: The server-assigned name, which is only unique within the same
  583. // service that
  584. // originally returns it. If you use the default HTTP mapping,
  585. // the
  586. // `name` should have the format of `operations/some/unique/name`.
  587. Name string `json:"name,omitempty"`
  588. // Response: The normal response of the operation in case of success.
  589. // If the original
  590. // method returns no data on success, such as `Delete`, the response
  591. // is
  592. // `google.protobuf.Empty`. If the original method is
  593. // standard
  594. // `Get`/`Create`/`Update`, the response should be the resource. For
  595. // other
  596. // methods, the response should have the type `XxxResponse`, where
  597. // `Xxx`
  598. // is the original method name. For example, if the original method
  599. // name
  600. // is `TakeSnapshot()`, the inferred response type
  601. // is
  602. // `TakeSnapshotResponse`.
  603. Response googleapi.RawMessage `json:"response,omitempty"`
  604. // ServerResponse contains the HTTP response code and headers from the
  605. // server.
  606. googleapi.ServerResponse `json:"-"`
  607. // ForceSendFields is a list of field names (e.g. "Done") to
  608. // unconditionally include in API requests. By default, fields with
  609. // empty values are omitted from API requests. However, any non-pointer,
  610. // non-interface field appearing in ForceSendFields will be sent to the
  611. // server regardless of whether the field is empty or not. This may be
  612. // used to include empty fields in Patch requests.
  613. ForceSendFields []string `json:"-"`
  614. // NullFields is a list of field names (e.g. "Done") to include in API
  615. // requests with the JSON null value. By default, fields with empty
  616. // values are omitted from API requests. However, any field with an
  617. // empty value appearing in NullFields will be sent to the server as
  618. // null. It is an error if a field in this list has a non-empty value.
  619. // This may be used to include null fields in Patch requests.
  620. NullFields []string `json:"-"`
  621. }
  622. func (s *Operation) MarshalJSON() ([]byte, error) {
  623. type NoMethod Operation
  624. raw := NoMethod(*s)
  625. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  626. }
  627. // OperationMetadata: Metadata describing an operation.
  628. type OperationMetadata struct {
  629. // CreateTime: Output only.
  630. // The time the operation was submitted to the server.
  631. CreateTime string `json:"createTime,omitempty"`
  632. // EndTime: Output only.
  633. // The time when the operation terminated, regardless of its
  634. // success.
  635. // This field is unset if the operation is still ongoing.
  636. EndTime string `json:"endTime,omitempty"`
  637. // OperationType: Output only.
  638. // The type of operation being performed.
  639. //
  640. // Possible values:
  641. // "TYPE_UNSPECIFIED" - Unused.
  642. // "CREATE" - A resource creation operation.
  643. // "DELETE" - A resource deletion operation.
  644. // "UPDATE" - A resource update operation.
  645. OperationType string `json:"operationType,omitempty"`
  646. // Resource: Output only.
  647. // The resource being operated on, as a [relative resource
  648. // name](
  649. // /apis/design/resource_names#relative_resource_name).
  650. Resource string `json:"resource,omitempty"`
  651. // ResourceUuid: Output only.
  652. // The UUID of the resource being operated on.
  653. ResourceUuid string `json:"resourceUuid,omitempty"`
  654. // State: Output only.
  655. // The current operation state.
  656. //
  657. // Possible values:
  658. // "STATE_UNSPECIFIED" - Unused.
  659. // "PENDING" - The operation has been created but is not yet started.
  660. // "RUNNING" - The operation is underway.
  661. // "SUCCEEDED" - The operation completed successfully.
  662. // "SUCCESSFUL"
  663. // "FAILED" - The operation is no longer running but did not succeed.
  664. State string `json:"state,omitempty"`
  665. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  666. // unconditionally include in API requests. By default, fields with
  667. // empty values are omitted from API requests. However, any non-pointer,
  668. // non-interface field appearing in ForceSendFields will be sent to the
  669. // server regardless of whether the field is empty or not. This may be
  670. // used to include empty fields in Patch requests.
  671. ForceSendFields []string `json:"-"`
  672. // NullFields is a list of field names (e.g. "CreateTime") to include in
  673. // API requests with the JSON null value. By default, fields with empty
  674. // values are omitted from API requests. However, any field with an
  675. // empty value appearing in NullFields will be sent to the server as
  676. // null. It is an error if a field in this list has a non-empty value.
  677. // This may be used to include null fields in Patch requests.
  678. NullFields []string `json:"-"`
  679. }
  680. func (s *OperationMetadata) MarshalJSON() ([]byte, error) {
  681. type NoMethod OperationMetadata
  682. raw := NoMethod(*s)
  683. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  684. }
  685. // SoftwareConfig: Specifies the selection and configuration of software
  686. // inside the environment.
  687. type SoftwareConfig struct {
  688. // AirflowConfigOverrides: Optional. Apache Airflow configuration
  689. // properties to override.
  690. //
  691. // Property keys contain the section and property names, separated by a
  692. // hyphen,
  693. // for example "core-dags_are_paused_at_creation". Section names must
  694. // not
  695. // contain hyphens ("-"), opening square brackets ("["), or closing
  696. // square
  697. // brackets ("]"). The property name must not be empty and must not
  698. // contain
  699. // an equals sign ("=") or semicolon (";"). Section and property names
  700. // must
  701. // not contain a period ("."). Apache Airflow configuration property
  702. // names
  703. // must be written in
  704. // [snake_case](https://en.wikipedia.org/wiki/Snake_case).
  705. // Property values can contain any character, and can be written in
  706. // any
  707. // lower/upper case format.
  708. //
  709. // Certain Apache Airflow configuration property values
  710. // are
  711. // [blacklisted](/composer/docs/how-to/managing/setting-airflow-confi
  712. // gurations#airflow_configuration_blacklists),
  713. // and cannot be overridden.
  714. AirflowConfigOverrides map[string]string `json:"airflowConfigOverrides,omitempty"`
  715. // EnvVariables: Optional. Additional environment variables to provide
  716. // to the Apache Airflow
  717. // scheduler, worker, and webserver processes.
  718. //
  719. // Environment variable names must match the regular
  720. // expression
  721. // `a-zA-Z_*`. They cannot specify Apache Airflow
  722. // software configuration overrides (they cannot match the regular
  723. // expression
  724. // `AIRFLOW__[A-Z0-9_]+__[A-Z0-9_]+`), and they cannot match any of
  725. // the
  726. // following reserved names:
  727. //
  728. // * `AIRFLOW_HOME`
  729. // * `C_FORCE_ROOT`
  730. // * `CONTAINER_NAME`
  731. // * `DAGS_FOLDER`
  732. // * `GCP_PROJECT`
  733. // * `GCS_BUCKET`
  734. // * `GKE_CLUSTER_NAME`
  735. // * `SQL_DATABASE`
  736. // * `SQL_INSTANCE`
  737. // * `SQL_PASSWORD`
  738. // * `SQL_PROJECT`
  739. // * `SQL_REGION`
  740. // * `SQL_USER`
  741. EnvVariables map[string]string `json:"envVariables,omitempty"`
  742. // ImageVersion: The version of the software running in the
  743. // environment.
  744. // This encapsulates both the version of Cloud Composer functionality
  745. // and the
  746. // version of Apache Airflow. It must match the regular
  747. // expression
  748. // `composer-([0-9]+\.[0-9]+\.[0-9]+|latest)-airflow-[0-9]+\.[
  749. // 0-9]+(\.[0-9]+.*)?`.
  750. // When used as input, the server also checks if the provided version
  751. // is
  752. // supported and denies the request for an unsupported version.
  753. //
  754. // The Cloud Composer portion of the version is a
  755. // [semantic version](https://semver.org) or `latest`. When the patch
  756. // version
  757. // is omitted, the current Cloud Composer patch version is
  758. // selected.
  759. // When `latest` is provided instead of an explicit version number,
  760. // the server replaces `latest` with the current Cloud Composer
  761. // version
  762. // and stores that version number in the same field.
  763. //
  764. // The portion of the image version that follows <em>airflow-</em> is
  765. // an
  766. // official Apache Airflow repository
  767. // [release
  768. // name](https://github.com/apache/incubator-airflow/releases).
  769. //
  770. // See also [Version
  771. // List](/composer/docs/concepts/versioning/composer-versions).
  772. ImageVersion string `json:"imageVersion,omitempty"`
  773. // PypiPackages: Optional. Custom Python Package Index (PyPI) packages
  774. // to be installed in
  775. // the environment.
  776. //
  777. // Keys refer to the lowercase package name such as "numpy"
  778. // and values are the lowercase extras and version specifier such
  779. // as
  780. // "==1.12.0", "[devel,gcp_api]", or "[devel]>=1.8.2, <1.9.2". To
  781. // specify a
  782. // package without pinning it to a version specifier, use the empty
  783. // string as
  784. // the value.
  785. PypiPackages map[string]string `json:"pypiPackages,omitempty"`
  786. // PythonVersion: Optional. The major version of Python used to run the
  787. // Apache Airflow
  788. // scheduler, worker, and webserver processes.
  789. //
  790. // Can be set to '2' or '3'. If not specified, the default is '2'.
  791. // Cannot be
  792. // updated.
  793. PythonVersion string `json:"pythonVersion,omitempty"`
  794. // ForceSendFields is a list of field names (e.g.
  795. // "AirflowConfigOverrides") to unconditionally include in API requests.
  796. // By default, fields with empty values are omitted from API requests.
  797. // However, any non-pointer, non-interface field appearing in
  798. // ForceSendFields will be sent to the server regardless of whether the
  799. // field is empty or not. This may be used to include empty fields in
  800. // Patch requests.
  801. ForceSendFields []string `json:"-"`
  802. // NullFields is a list of field names (e.g. "AirflowConfigOverrides")
  803. // to include in API requests with the JSON null value. By default,
  804. // fields with empty values are omitted from API requests. However, any
  805. // field with an empty value appearing in NullFields will be sent to the
  806. // server as null. It is an error if a field in this list has a
  807. // non-empty value. This may be used to include null fields in Patch
  808. // requests.
  809. NullFields []string `json:"-"`
  810. }
  811. func (s *SoftwareConfig) MarshalJSON() ([]byte, error) {
  812. type NoMethod SoftwareConfig
  813. raw := NoMethod(*s)
  814. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  815. }
  816. // Status: The `Status` type defines a logical error model that is
  817. // suitable for
  818. // different programming environments, including REST APIs and RPC APIs.
  819. // It is
  820. // used by [gRPC](https://github.com/grpc). The error model is designed
  821. // to be:
  822. //
  823. // - Simple to use and understand for most users
  824. // - Flexible enough to meet unexpected needs
  825. //
  826. // # Overview
  827. //
  828. // The `Status` message contains three pieces of data: error code,
  829. // error
  830. // message, and error details. The error code should be an enum value
  831. // of
  832. // google.rpc.Code, but it may accept additional error codes if needed.
  833. // The
  834. // error message should be a developer-facing English message that
  835. // helps
  836. // developers *understand* and *resolve* the error. If a localized
  837. // user-facing
  838. // error message is needed, put the localized message in the error
  839. // details or
  840. // localize it in the client. The optional error details may contain
  841. // arbitrary
  842. // information about the error. There is a predefined set of error
  843. // detail types
  844. // in the package `google.rpc` that can be used for common error
  845. // conditions.
  846. //
  847. // # Language mapping
  848. //
  849. // The `Status` message is the logical representation of the error
  850. // model, but it
  851. // is not necessarily the actual wire format. When the `Status` message
  852. // is
  853. // exposed in different client libraries and different wire protocols,
  854. // it can be
  855. // mapped differently. For example, it will likely be mapped to some
  856. // exceptions
  857. // in Java, but more likely mapped to some error codes in C.
  858. //
  859. // # Other uses
  860. //
  861. // The error model and the `Status` message can be used in a variety
  862. // of
  863. // environments, either with or without APIs, to provide a
  864. // consistent developer experience across different
  865. // environments.
  866. //
  867. // Example uses of this error model include:
  868. //
  869. // - Partial errors. If a service needs to return partial errors to the
  870. // client,
  871. // it may embed the `Status` in the normal response to indicate the
  872. // partial
  873. // errors.
  874. //
  875. // - Workflow errors. A typical workflow has multiple steps. Each step
  876. // may
  877. // have a `Status` message for error reporting.
  878. //
  879. // - Batch operations. If a client uses batch request and batch
  880. // response, the
  881. // `Status` message should be used directly inside batch response,
  882. // one for
  883. // each error sub-response.
  884. //
  885. // - Asynchronous operations. If an API call embeds asynchronous
  886. // operation
  887. // results in its response, the status of those operations should
  888. // be
  889. // represented directly using the `Status` message.
  890. //
  891. // - Logging. If some API errors are stored in logs, the message
  892. // `Status` could
  893. // be used directly after any stripping needed for security/privacy
  894. // reasons.
  895. type Status struct {
  896. // Code: The status code, which should be an enum value of
  897. // google.rpc.Code.
  898. Code int64 `json:"code,omitempty"`
  899. // Details: A list of messages that carry the error details. There is a
  900. // common set of
  901. // message types for APIs to use.
  902. Details []googleapi.RawMessage `json:"details,omitempty"`
  903. // Message: A developer-facing error message, which should be in
  904. // English. Any
  905. // user-facing error message should be localized and sent in
  906. // the
  907. // google.rpc.Status.details field, or localized by the client.
  908. Message string `json:"message,omitempty"`
  909. // ForceSendFields is a list of field names (e.g. "Code") to
  910. // unconditionally include in API requests. By default, fields with
  911. // empty values are omitted from API requests. However, any non-pointer,
  912. // non-interface field appearing in ForceSendFields will be sent to the
  913. // server regardless of whether the field is empty or not. This may be
  914. // used to include empty fields in Patch requests.
  915. ForceSendFields []string `json:"-"`
  916. // NullFields is a list of field names (e.g. "Code") to include in API
  917. // requests with the JSON null value. By default, fields with empty
  918. // values are omitted from API requests. However, any field with an
  919. // empty value appearing in NullFields will be sent to the server as
  920. // null. It is an error if a field in this list has a non-empty value.
  921. // This may be used to include null fields in Patch requests.
  922. NullFields []string `json:"-"`
  923. }
  924. func (s *Status) MarshalJSON() ([]byte, error) {
  925. type NoMethod Status
  926. raw := NoMethod(*s)
  927. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  928. }
  929. // method id "composer.projects.locations.environments.create":
  930. type ProjectsLocationsEnvironmentsCreateCall struct {
  931. s *Service
  932. parent string
  933. environment *Environment
  934. urlParams_ gensupport.URLParams
  935. ctx_ context.Context
  936. header_ http.Header
  937. }
  938. // Create: Create a new environment.
  939. func (r *ProjectsLocationsEnvironmentsService) Create(parent string, environment *Environment) *ProjectsLocationsEnvironmentsCreateCall {
  940. c := &ProjectsLocationsEnvironmentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  941. c.parent = parent
  942. c.environment = environment
  943. return c
  944. }
  945. // Fields allows partial responses to be retrieved. See
  946. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  947. // for more information.
  948. func (c *ProjectsLocationsEnvironmentsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsEnvironmentsCreateCall {
  949. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  950. return c
  951. }
  952. // Context sets the context to be used in this call's Do method. Any
  953. // pending HTTP request will be aborted if the provided context is
  954. // canceled.
  955. func (c *ProjectsLocationsEnvironmentsCreateCall) Context(ctx context.Context) *ProjectsLocationsEnvironmentsCreateCall {
  956. c.ctx_ = ctx
  957. return c
  958. }
  959. // Header returns an http.Header that can be modified by the caller to
  960. // add HTTP headers to the request.
  961. func (c *ProjectsLocationsEnvironmentsCreateCall) Header() http.Header {
  962. if c.header_ == nil {
  963. c.header_ = make(http.Header)
  964. }
  965. return c.header_
  966. }
  967. func (c *ProjectsLocationsEnvironmentsCreateCall) doRequest(alt string) (*http.Response, error) {
  968. reqHeaders := make(http.Header)
  969. for k, v := range c.header_ {
  970. reqHeaders[k] = v
  971. }
  972. reqHeaders.Set("User-Agent", c.s.userAgent())
  973. var body io.Reader = nil
  974. body, err := googleapi.WithoutDataWrapper.JSONReader(c.environment)
  975. if err != nil {
  976. return nil, err
  977. }
  978. reqHeaders.Set("Content-Type", "application/json")
  979. c.urlParams_.Set("alt", alt)
  980. c.urlParams_.Set("prettyPrint", "false")
  981. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/environments")
  982. urls += "?" + c.urlParams_.Encode()
  983. req, err := http.NewRequest("POST", urls, body)
  984. if err != nil {
  985. return nil, err
  986. }
  987. req.Header = reqHeaders
  988. googleapi.Expand(req.URL, map[string]string{
  989. "parent": c.parent,
  990. })
  991. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  992. }
  993. // Do executes the "composer.projects.locations.environments.create" call.
  994. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  995. // status code is an error. Response headers are in either
  996. // *Operation.ServerResponse.Header or (if a response was returned at
  997. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  998. // to check whether the returned error was because
  999. // http.StatusNotModified was returned.
  1000. func (c *ProjectsLocationsEnvironmentsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1001. gensupport.SetOptions(c.urlParams_, opts...)
  1002. res, err := c.doRequest("json")
  1003. if res != nil && res.StatusCode == http.StatusNotModified {
  1004. if res.Body != nil {
  1005. res.Body.Close()
  1006. }
  1007. return nil, &googleapi.Error{
  1008. Code: res.StatusCode,
  1009. Header: res.Header,
  1010. }
  1011. }
  1012. if err != nil {
  1013. return nil, err
  1014. }
  1015. defer googleapi.CloseBody(res)
  1016. if err := googleapi.CheckResponse(res); err != nil {
  1017. return nil, err
  1018. }
  1019. ret := &Operation{
  1020. ServerResponse: googleapi.ServerResponse{
  1021. Header: res.Header,
  1022. HTTPStatusCode: res.StatusCode,
  1023. },
  1024. }
  1025. target := &ret
  1026. if err := gensupport.DecodeResponse(target, res); err != nil {
  1027. return nil, err
  1028. }
  1029. return ret, nil
  1030. // {
  1031. // "description": "Create a new environment.",
  1032. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/environments",
  1033. // "httpMethod": "POST",
  1034. // "id": "composer.projects.locations.environments.create",
  1035. // "parameterOrder": [
  1036. // "parent"
  1037. // ],
  1038. // "parameters": {
  1039. // "parent": {
  1040. // "description": "The parent must be of the form \"projects/{projectId}/locations/{locationId}\".",
  1041. // "location": "path",
  1042. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1043. // "required": true,
  1044. // "type": "string"
  1045. // }
  1046. // },
  1047. // "path": "v1/{+parent}/environments",
  1048. // "request": {
  1049. // "$ref": "Environment"
  1050. // },
  1051. // "response": {
  1052. // "$ref": "Operation"
  1053. // },
  1054. // "scopes": [
  1055. // "https://www.googleapis.com/auth/cloud-platform"
  1056. // ]
  1057. // }
  1058. }
  1059. // method id "composer.projects.locations.environments.delete":
  1060. type ProjectsLocationsEnvironmentsDeleteCall struct {
  1061. s *Service
  1062. name string
  1063. urlParams_ gensupport.URLParams
  1064. ctx_ context.Context
  1065. header_ http.Header
  1066. }
  1067. // Delete: Delete an environment.
  1068. func (r *ProjectsLocationsEnvironmentsService) Delete(name string) *ProjectsLocationsEnvironmentsDeleteCall {
  1069. c := &ProjectsLocationsEnvironmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1070. c.name = name
  1071. return c
  1072. }
  1073. // Fields allows partial responses to be retrieved. See
  1074. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1075. // for more information.
  1076. func (c *ProjectsLocationsEnvironmentsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsEnvironmentsDeleteCall {
  1077. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1078. return c
  1079. }
  1080. // Context sets the context to be used in this call's Do method. Any
  1081. // pending HTTP request will be aborted if the provided context is
  1082. // canceled.
  1083. func (c *ProjectsLocationsEnvironmentsDeleteCall) Context(ctx context.Context) *ProjectsLocationsEnvironmentsDeleteCall {
  1084. c.ctx_ = ctx
  1085. return c
  1086. }
  1087. // Header returns an http.Header that can be modified by the caller to
  1088. // add HTTP headers to the request.
  1089. func (c *ProjectsLocationsEnvironmentsDeleteCall) Header() http.Header {
  1090. if c.header_ == nil {
  1091. c.header_ = make(http.Header)
  1092. }
  1093. return c.header_
  1094. }
  1095. func (c *ProjectsLocationsEnvironmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1096. reqHeaders := make(http.Header)
  1097. for k, v := range c.header_ {
  1098. reqHeaders[k] = v
  1099. }
  1100. reqHeaders.Set("User-Agent", c.s.userAgent())
  1101. var body io.Reader = nil
  1102. c.urlParams_.Set("alt", alt)
  1103. c.urlParams_.Set("prettyPrint", "false")
  1104. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1105. urls += "?" + c.urlParams_.Encode()
  1106. req, err := http.NewRequest("DELETE", urls, body)
  1107. if err != nil {
  1108. return nil, err
  1109. }
  1110. req.Header = reqHeaders
  1111. googleapi.Expand(req.URL, map[string]string{
  1112. "name": c.name,
  1113. })
  1114. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1115. }
  1116. // Do executes the "composer.projects.locations.environments.delete" call.
  1117. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1118. // status code is an error. Response headers are in either
  1119. // *Operation.ServerResponse.Header or (if a response was returned at
  1120. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1121. // to check whether the returned error was because
  1122. // http.StatusNotModified was returned.
  1123. func (c *ProjectsLocationsEnvironmentsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1124. gensupport.SetOptions(c.urlParams_, opts...)
  1125. res, err := c.doRequest("json")
  1126. if res != nil && res.StatusCode == http.StatusNotModified {
  1127. if res.Body != nil {
  1128. res.Body.Close()
  1129. }
  1130. return nil, &googleapi.Error{
  1131. Code: res.StatusCode,
  1132. Header: res.Header,
  1133. }
  1134. }
  1135. if err != nil {
  1136. return nil, err
  1137. }
  1138. defer googleapi.CloseBody(res)
  1139. if err := googleapi.CheckResponse(res); err != nil {
  1140. return nil, err
  1141. }
  1142. ret := &Operation{
  1143. ServerResponse: googleapi.ServerResponse{
  1144. Header: res.Header,
  1145. HTTPStatusCode: res.StatusCode,
  1146. },
  1147. }
  1148. target := &ret
  1149. if err := gensupport.DecodeResponse(target, res); err != nil {
  1150. return nil, err
  1151. }
  1152. return ret, nil
  1153. // {
  1154. // "description": "Delete an environment.",
  1155. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/environments/{environmentsId}",
  1156. // "httpMethod": "DELETE",
  1157. // "id": "composer.projects.locations.environments.delete",
  1158. // "parameterOrder": [
  1159. // "name"
  1160. // ],
  1161. // "parameters": {
  1162. // "name": {
  1163. // "description": "The environment to delete, in the form:\n\"projects/{projectId}/locations/{locationId}/environments/{environmentId}\"",
  1164. // "location": "path",
  1165. // "pattern": "^projects/[^/]+/locations/[^/]+/environments/[^/]+$",
  1166. // "required": true,
  1167. // "type": "string"
  1168. // }
  1169. // },
  1170. // "path": "v1/{+name}",
  1171. // "response": {
  1172. // "$ref": "Operation"
  1173. // },
  1174. // "scopes": [
  1175. // "https://www.googleapis.com/auth/cloud-platform"
  1176. // ]
  1177. // }
  1178. }
  1179. // method id "composer.projects.locations.environments.get":
  1180. type ProjectsLocationsEnvironmentsGetCall struct {
  1181. s *Service
  1182. name string
  1183. urlParams_ gensupport.URLParams
  1184. ifNoneMatch_ string
  1185. ctx_ context.Context
  1186. header_ http.Header
  1187. }
  1188. // Get: Get an existing environment.
  1189. func (r *ProjectsLocationsEnvironmentsService) Get(name string) *ProjectsLocationsEnvironmentsGetCall {
  1190. c := &ProjectsLocationsEnvironmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1191. c.name = name
  1192. return c
  1193. }
  1194. // Fields allows partial responses to be retrieved. See
  1195. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1196. // for more information.
  1197. func (c *ProjectsLocationsEnvironmentsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsEnvironmentsGetCall {
  1198. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1199. return c
  1200. }
  1201. // IfNoneMatch sets the optional parameter which makes the operation
  1202. // fail if the object's ETag matches the given value. This is useful for
  1203. // getting updates only after the object has changed since the last
  1204. // request. Use googleapi.IsNotModified to check whether the response
  1205. // error from Do is the result of In-None-Match.
  1206. func (c *ProjectsLocationsEnvironmentsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsEnvironmentsGetCall {
  1207. c.ifNoneMatch_ = entityTag
  1208. return c
  1209. }
  1210. // Context sets the context to be used in this call's Do method. Any
  1211. // pending HTTP request will be aborted if the provided context is
  1212. // canceled.
  1213. func (c *ProjectsLocationsEnvironmentsGetCall) Context(ctx context.Context) *ProjectsLocationsEnvironmentsGetCall {
  1214. c.ctx_ = ctx
  1215. return c
  1216. }
  1217. // Header returns an http.Header that can be modified by the caller to
  1218. // add HTTP headers to the request.
  1219. func (c *ProjectsLocationsEnvironmentsGetCall) Header() http.Header {
  1220. if c.header_ == nil {
  1221. c.header_ = make(http.Header)
  1222. }
  1223. return c.header_
  1224. }
  1225. func (c *ProjectsLocationsEnvironmentsGetCall) doRequest(alt string) (*http.Response, error) {
  1226. reqHeaders := make(http.Header)
  1227. for k, v := range c.header_ {
  1228. reqHeaders[k] = v
  1229. }
  1230. reqHeaders.Set("User-Agent", c.s.userAgent())
  1231. if c.ifNoneMatch_ != "" {
  1232. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1233. }
  1234. var body io.Reader = nil
  1235. c.urlParams_.Set("alt", alt)
  1236. c.urlParams_.Set("prettyPrint", "false")
  1237. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1238. urls += "?" + c.urlParams_.Encode()
  1239. req, err := http.NewRequest("GET", urls, body)
  1240. if err != nil {
  1241. return nil, err
  1242. }
  1243. req.Header = reqHeaders
  1244. googleapi.Expand(req.URL, map[string]string{
  1245. "name": c.name,
  1246. })
  1247. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1248. }
  1249. // Do executes the "composer.projects.locations.environments.get" call.
  1250. // Exactly one of *Environment or error will be non-nil. Any non-2xx
  1251. // status code is an error. Response headers are in either
  1252. // *Environment.ServerResponse.Header or (if a response was returned at
  1253. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1254. // to check whether the returned error was because
  1255. // http.StatusNotModified was returned.
  1256. func (c *ProjectsLocationsEnvironmentsGetCall) Do(opts ...googleapi.CallOption) (*Environment, error) {
  1257. gensupport.SetOptions(c.urlParams_, opts...)
  1258. res, err := c.doRequest("json")
  1259. if res != nil && res.StatusCode == http.StatusNotModified {
  1260. if res.Body != nil {
  1261. res.Body.Close()
  1262. }
  1263. return nil, &googleapi.Error{
  1264. Code: res.StatusCode,
  1265. Header: res.Header,
  1266. }
  1267. }
  1268. if err != nil {
  1269. return nil, err
  1270. }
  1271. defer googleapi.CloseBody(res)
  1272. if err := googleapi.CheckResponse(res); err != nil {
  1273. return nil, err
  1274. }
  1275. ret := &Environment{
  1276. ServerResponse: googleapi.ServerResponse{
  1277. Header: res.Header,
  1278. HTTPStatusCode: res.StatusCode,
  1279. },
  1280. }
  1281. target := &ret
  1282. if err := gensupport.DecodeResponse(target, res); err != nil {
  1283. return nil, err
  1284. }
  1285. return ret, nil
  1286. // {
  1287. // "description": "Get an existing environment.",
  1288. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/environments/{environmentsId}",
  1289. // "httpMethod": "GET",
  1290. // "id": "composer.projects.locations.environments.get",
  1291. // "parameterOrder": [
  1292. // "name"
  1293. // ],
  1294. // "parameters": {
  1295. // "name": {
  1296. // "description": "The resource name of the environment to get, in the form:\n\"projects/{projectId}/locations/{locationId}/environments/{environmentId}\"",
  1297. // "location": "path",
  1298. // "pattern": "^projects/[^/]+/locations/[^/]+/environments/[^/]+$",
  1299. // "required": true,
  1300. // "type": "string"
  1301. // }
  1302. // },
  1303. // "path": "v1/{+name}",
  1304. // "response": {
  1305. // "$ref": "Environment"
  1306. // },
  1307. // "scopes": [
  1308. // "https://www.googleapis.com/auth/cloud-platform"
  1309. // ]
  1310. // }
  1311. }
  1312. // method id "composer.projects.locations.environments.list":
  1313. type ProjectsLocationsEnvironmentsListCall struct {
  1314. s *Service
  1315. parent string
  1316. urlParams_ gensupport.URLParams
  1317. ifNoneMatch_ string
  1318. ctx_ context.Context
  1319. header_ http.Header
  1320. }
  1321. // List: List environments.
  1322. func (r *ProjectsLocationsEnvironmentsService) List(parent string) *ProjectsLocationsEnvironmentsListCall {
  1323. c := &ProjectsLocationsEnvironmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1324. c.parent = parent
  1325. return c
  1326. }
  1327. // PageSize sets the optional parameter "pageSize": The maximum number
  1328. // of environments to return.
  1329. func (c *ProjectsLocationsEnvironmentsListCall) PageSize(pageSize int64) *ProjectsLocationsEnvironmentsListCall {
  1330. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1331. return c
  1332. }
  1333. // PageToken sets the optional parameter "pageToken": The
  1334. // next_page_token value returned from a previous List request, if any.
  1335. func (c *ProjectsLocationsEnvironmentsListCall) PageToken(pageToken string) *ProjectsLocationsEnvironmentsListCall {
  1336. c.urlParams_.Set("pageToken", pageToken)
  1337. return c
  1338. }
  1339. // Fields allows partial responses to be retrieved. See
  1340. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1341. // for more information.
  1342. func (c *ProjectsLocationsEnvironmentsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsEnvironmentsListCall {
  1343. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1344. return c
  1345. }
  1346. // IfNoneMatch sets the optional parameter which makes the operation
  1347. // fail if the object's ETag matches the given value. This is useful for
  1348. // getting updates only after the object has changed since the last
  1349. // request. Use googleapi.IsNotModified to check whether the response
  1350. // error from Do is the result of In-None-Match.
  1351. func (c *ProjectsLocationsEnvironmentsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsEnvironmentsListCall {
  1352. c.ifNoneMatch_ = entityTag
  1353. return c
  1354. }
  1355. // Context sets the context to be used in this call's Do method. Any
  1356. // pending HTTP request will be aborted if the provided context is
  1357. // canceled.
  1358. func (c *ProjectsLocationsEnvironmentsListCall) Context(ctx context.Context) *ProjectsLocationsEnvironmentsListCall {
  1359. c.ctx_ = ctx
  1360. return c
  1361. }
  1362. // Header returns an http.Header that can be modified by the caller to
  1363. // add HTTP headers to the request.
  1364. func (c *ProjectsLocationsEnvironmentsListCall) Header() http.Header {
  1365. if c.header_ == nil {
  1366. c.header_ = make(http.Header)
  1367. }
  1368. return c.header_
  1369. }
  1370. func (c *ProjectsLocationsEnvironmentsListCall) doRequest(alt string) (*http.Response, error) {
  1371. reqHeaders := make(http.Header)
  1372. for k, v := range c.header_ {
  1373. reqHeaders[k] = v
  1374. }
  1375. reqHeaders.Set("User-Agent", c.s.userAgent())
  1376. if c.ifNoneMatch_ != "" {
  1377. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1378. }
  1379. var body io.Reader = nil
  1380. c.urlParams_.Set("alt", alt)
  1381. c.urlParams_.Set("prettyPrint", "false")
  1382. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/environments")
  1383. urls += "?" + c.urlParams_.Encode()
  1384. req, err := http.NewRequest("GET", urls, body)
  1385. if err != nil {
  1386. return nil, err
  1387. }
  1388. req.Header = reqHeaders
  1389. googleapi.Expand(req.URL, map[string]string{
  1390. "parent": c.parent,
  1391. })
  1392. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1393. }
  1394. // Do executes the "composer.projects.locations.environments.list" call.
  1395. // Exactly one of *ListEnvironmentsResponse or error will be non-nil.
  1396. // Any non-2xx status code is an error. Response headers are in either
  1397. // *ListEnvironmentsResponse.ServerResponse.Header or (if a response was
  1398. // returned at all) in error.(*googleapi.Error).Header. Use
  1399. // googleapi.IsNotModified to check whether the returned error was
  1400. // because http.StatusNotModified was returned.
  1401. func (c *ProjectsLocationsEnvironmentsListCall) Do(opts ...googleapi.CallOption) (*ListEnvironmentsResponse, error) {
  1402. gensupport.SetOptions(c.urlParams_, opts...)
  1403. res, err := c.doRequest("json")
  1404. if res != nil && res.StatusCode == http.StatusNotModified {
  1405. if res.Body != nil {
  1406. res.Body.Close()
  1407. }
  1408. return nil, &googleapi.Error{
  1409. Code: res.StatusCode,
  1410. Header: res.Header,
  1411. }
  1412. }
  1413. if err != nil {
  1414. return nil, err
  1415. }
  1416. defer googleapi.CloseBody(res)
  1417. if err := googleapi.CheckResponse(res); err != nil {
  1418. return nil, err
  1419. }
  1420. ret := &ListEnvironmentsResponse{
  1421. ServerResponse: googleapi.ServerResponse{
  1422. Header: res.Header,
  1423. HTTPStatusCode: res.StatusCode,
  1424. },
  1425. }
  1426. target := &ret
  1427. if err := gensupport.DecodeResponse(target, res); err != nil {
  1428. return nil, err
  1429. }
  1430. return ret, nil
  1431. // {
  1432. // "description": "List environments.",
  1433. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/environments",
  1434. // "httpMethod": "GET",
  1435. // "id": "composer.projects.locations.environments.list",
  1436. // "parameterOrder": [
  1437. // "parent"
  1438. // ],
  1439. // "parameters": {
  1440. // "pageSize": {
  1441. // "description": "The maximum number of environments to return.",
  1442. // "format": "int32",
  1443. // "location": "query",
  1444. // "type": "integer"
  1445. // },
  1446. // "pageToken": {
  1447. // "description": "The next_page_token value returned from a previous List request, if any.",
  1448. // "location": "query",
  1449. // "type": "string"
  1450. // },
  1451. // "parent": {
  1452. // "description": "List environments in the given project and location, in the form:\n\"projects/{projectId}/locations/{locationId}\"",
  1453. // "location": "path",
  1454. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1455. // "required": true,
  1456. // "type": "string"
  1457. // }
  1458. // },
  1459. // "path": "v1/{+parent}/environments",
  1460. // "response": {
  1461. // "$ref": "ListEnvironmentsResponse"
  1462. // },
  1463. // "scopes": [
  1464. // "https://www.googleapis.com/auth/cloud-platform"
  1465. // ]
  1466. // }
  1467. }
  1468. // Pages invokes f for each page of results.
  1469. // A non-nil error returned from f will halt the iteration.
  1470. // The provided context supersedes any context provided to the Context method.
  1471. func (c *ProjectsLocationsEnvironmentsListCall) Pages(ctx context.Context, f func(*ListEnvironmentsResponse) error) error {
  1472. c.ctx_ = ctx
  1473. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1474. for {
  1475. x, err := c.Do()
  1476. if err != nil {
  1477. return err
  1478. }
  1479. if err := f(x); err != nil {
  1480. return err
  1481. }
  1482. if x.NextPageToken == "" {
  1483. return nil
  1484. }
  1485. c.PageToken(x.NextPageToken)
  1486. }
  1487. }
  1488. // method id "composer.projects.locations.environments.patch":
  1489. type ProjectsLocationsEnvironmentsPatchCall struct {
  1490. s *Service
  1491. name string
  1492. environment *Environment
  1493. urlParams_ gensupport.URLParams
  1494. ctx_ context.Context
  1495. header_ http.Header
  1496. }
  1497. // Patch: Update an environment.
  1498. func (r *ProjectsLocationsEnvironmentsService) Patch(name string, environment *Environment) *ProjectsLocationsEnvironmentsPatchCall {
  1499. c := &ProjectsLocationsEnvironmentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1500. c.name = name
  1501. c.environment = environment
  1502. return c
  1503. }
  1504. // UpdateMask sets the optional parameter "updateMask": Required. A
  1505. // comma-separated list of paths, relative to `Environment`, of
  1506. // fields to update.
  1507. // For example, to set the version of scikit-learn to install in
  1508. // the
  1509. // environment to 0.19.0 and to remove an existing installation
  1510. // of
  1511. // numpy, the `updateMask` parameter would include the following
  1512. // two
  1513. // `paths` values: "config.softwareConfig.pypiPackages.scikit-learn"
  1514. // and
  1515. // "config.softwareConfig.pypiPackages.numpy". The included
  1516. // patch
  1517. // environment would specify the scikit-learn version as follows:
  1518. //
  1519. // {
  1520. // "config":{
  1521. // "softwareConfig":{
  1522. // "pypiPackages":{
  1523. // "scikit-learn":"==0.19.0"
  1524. // }
  1525. // }
  1526. // }
  1527. // }
  1528. //
  1529. // Note that in the above example, any existing PyPI packages
  1530. // other than scikit-learn and numpy will be unaffected.
  1531. //
  1532. // Only one update type may be included in a single request's
  1533. // `updateMask`.
  1534. // For example, one cannot update both the PyPI packages and
  1535. // labels in the same request. However, it is possible to update
  1536. // multiple
  1537. // members of a map field simultaneously in the same request. For
  1538. // example,
  1539. // to set the labels "label1" and "label2" while clearing "label3"
  1540. // (assuming
  1541. // it already exists), one can
  1542. // provide the paths "labels.label1", "labels.label2", and
  1543. // "labels.label3"
  1544. // and populate the patch environment as follows:
  1545. //
  1546. // {
  1547. // "labels":{
  1548. // "label1":"new-label1-value"
  1549. // "label2":"new-label2-value"
  1550. // }
  1551. // }
  1552. //
  1553. // Note that in the above example, any existing labels that are
  1554. // not
  1555. // included in the `updateMask` will be unaffected.
  1556. //
  1557. // It is also possible to replace an entire map field by providing
  1558. // the
  1559. // map field's path in the `updateMask`. The new value of the field
  1560. // will
  1561. // be that which is provided in the patch environment. For example,
  1562. // to
  1563. // delete all pre-existing user-specified PyPI packages and
  1564. // install botocore at version 1.7.14, the `updateMask` would
  1565. // contain
  1566. // the path "config.softwareConfig.pypiPackages", and
  1567. // the patch environment would be the following:
  1568. //
  1569. // {
  1570. // "config":{
  1571. // "softwareConfig":{
  1572. // "pypiPackages":{
  1573. // "botocore":"==1.7.14"
  1574. // }
  1575. // }
  1576. // }
  1577. // }
  1578. //
  1579. // **Note:** Only the following fields can be updated:
  1580. //
  1581. // <table>
  1582. // <tbody>
  1583. // <tr>
  1584. // <td><strong>Mask</strong></td>
  1585. // <td><strong>Purpose</strong></td>
  1586. // </tr>
  1587. // <tr>
  1588. // <td>config.softwareConfig.pypiPackages
  1589. // </td>
  1590. // <td>Replace all custom custom PyPI packages. If a replacement
  1591. // package map is not included in `environment`, all custom
  1592. // PyPI packages are cleared. It is an error to provide both this mask
  1593. // and a
  1594. // mask specifying an individual package.</td>
  1595. // </tr>
  1596. // <tr>
  1597. // <td>config.softwareConfig.pypiPackages.<var>packagename</var></td>
  1598. // <td>Update the custom PyPI package <var>packagename</var>,
  1599. // preserving other packages. To delete the package, include it in
  1600. // `updateMask`, and omit the mapping for it in
  1601. // `environment.config.softwareConfig.pypiPackages`. It is an error
  1602. // to provide both a mask of this form and the
  1603. // "config.softwareConfig.pypiPackages" mask.</td>
  1604. // </tr>
  1605. // <tr>
  1606. // <td>labels</td>
  1607. // <td>Replace all environment labels. If a replacement labels map is
  1608. // not
  1609. // included in `environment`, all labels are cleared. It is an error
  1610. // to
  1611. // provide both this mask and a mask specifying one or more individual
  1612. // labels.</td>
  1613. // </tr>
  1614. // <tr>
  1615. // <td>labels.<var>labelName</var></td>
  1616. // <td>Set the label named <var>labelName</var>, while preserving
  1617. // other
  1618. // labels. To delete the label, include it in `updateMask` and omit
  1619. // its
  1620. // mapping in `environment.labels`. It is an error to provide both a
  1621. // mask of this form and the "labels" mask.</td>
  1622. // </tr>
  1623. // <tr>
  1624. // <td>config.nodeCount</td>
  1625. // <td>Horizontally scale the number of nodes in the environment. An
  1626. // integer
  1627. // greater than or equal to 3 must be provided in the
  1628. // `config.nodeCount` field.
  1629. // </td>
  1630. // </tr>
  1631. // <tr>
  1632. // <td>config.softwareConfig.airflowConfigOverrides</td>
  1633. // <td>Replace all Apache Airflow config overrides. If a replacement
  1634. // config
  1635. // overrides map is not included in `environment`, all config
  1636. // overrides
  1637. // are cleared.
  1638. // It is an error to provide both this mask and a mask specifying one
  1639. // or
  1640. // more individual config overrides.</td>
  1641. // </tr>
  1642. // <tr>
  1643. //
  1644. // <td>config.softwareConfig.airflowConfigOverrides.<var>section</var>-<v
  1645. // ar>name
  1646. // </var></td>
  1647. // <td>Override the Apache Airflow config property <var>name</var> in
  1648. // the
  1649. // section named <var>section</var>, preserving other properties. To
  1650. // delete
  1651. // the property override, include it in `updateMask` and omit its
  1652. // mapping
  1653. // in `environment.config.softwareConfig.airflowConfigOverrides`.
  1654. // It is an error to provide both a mask of this form and the
  1655. // "config.softwareConfig.airflowConfigOverrides" mask.</td>
  1656. // </tr>
  1657. // <tr>
  1658. // <td>config.softwareConfig.envVariables</td>
  1659. // <td>Replace all environment variables. If a replacement environment
  1660. // variable map is not included in `environment`, all custom
  1661. // environment
  1662. // variables are cleared.
  1663. // It is an error to provide both this mask and a mask specifying one
  1664. // or
  1665. // more individual environment variables.</td>
  1666. // </tr>
  1667. // </tbody>
  1668. // </table>
  1669. func (c *ProjectsLocationsEnvironmentsPatchCall) UpdateMask(updateMask string) *ProjectsLocationsEnvironmentsPatchCall {
  1670. c.urlParams_.Set("updateMask", updateMask)
  1671. return c
  1672. }
  1673. // Fields allows partial responses to be retrieved. See
  1674. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1675. // for more information.
  1676. func (c *ProjectsLocationsEnvironmentsPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsEnvironmentsPatchCall {
  1677. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1678. return c
  1679. }
  1680. // Context sets the context to be used in this call's Do method. Any
  1681. // pending HTTP request will be aborted if the provided context is
  1682. // canceled.
  1683. func (c *ProjectsLocationsEnvironmentsPatchCall) Context(ctx context.Context) *ProjectsLocationsEnvironmentsPatchCall {
  1684. c.ctx_ = ctx
  1685. return c
  1686. }
  1687. // Header returns an http.Header that can be modified by the caller to
  1688. // add HTTP headers to the request.
  1689. func (c *ProjectsLocationsEnvironmentsPatchCall) Header() http.Header {
  1690. if c.header_ == nil {
  1691. c.header_ = make(http.Header)
  1692. }
  1693. return c.header_
  1694. }
  1695. func (c *ProjectsLocationsEnvironmentsPatchCall) doRequest(alt string) (*http.Response, error) {
  1696. reqHeaders := make(http.Header)
  1697. for k, v := range c.header_ {
  1698. reqHeaders[k] = v
  1699. }
  1700. reqHeaders.Set("User-Agent", c.s.userAgent())
  1701. var body io.Reader = nil
  1702. body, err := googleapi.WithoutDataWrapper.JSONReader(c.environment)
  1703. if err != nil {
  1704. return nil, err
  1705. }
  1706. reqHeaders.Set("Content-Type", "application/json")
  1707. c.urlParams_.Set("alt", alt)
  1708. c.urlParams_.Set("prettyPrint", "false")
  1709. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1710. urls += "?" + c.urlParams_.Encode()
  1711. req, err := http.NewRequest("PATCH", urls, body)
  1712. if err != nil {
  1713. return nil, err
  1714. }
  1715. req.Header = reqHeaders
  1716. googleapi.Expand(req.URL, map[string]string{
  1717. "name": c.name,
  1718. })
  1719. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1720. }
  1721. // Do executes the "composer.projects.locations.environments.patch" call.
  1722. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1723. // status code is an error. Response headers are in either
  1724. // *Operation.ServerResponse.Header or (if a response was returned at
  1725. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1726. // to check whether the returned error was because
  1727. // http.StatusNotModified was returned.
  1728. func (c *ProjectsLocationsEnvironmentsPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1729. gensupport.SetOptions(c.urlParams_, opts...)
  1730. res, err := c.doRequest("json")
  1731. if res != nil && res.StatusCode == http.StatusNotModified {
  1732. if res.Body != nil {
  1733. res.Body.Close()
  1734. }
  1735. return nil, &googleapi.Error{
  1736. Code: res.StatusCode,
  1737. Header: res.Header,
  1738. }
  1739. }
  1740. if err != nil {
  1741. return nil, err
  1742. }
  1743. defer googleapi.CloseBody(res)
  1744. if err := googleapi.CheckResponse(res); err != nil {
  1745. return nil, err
  1746. }
  1747. ret := &Operation{
  1748. ServerResponse: googleapi.ServerResponse{
  1749. Header: res.Header,
  1750. HTTPStatusCode: res.StatusCode,
  1751. },
  1752. }
  1753. target := &ret
  1754. if err := gensupport.DecodeResponse(target, res); err != nil {
  1755. return nil, err
  1756. }
  1757. return ret, nil
  1758. // {
  1759. // "description": "Update an environment.",
  1760. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/environments/{environmentsId}",
  1761. // "httpMethod": "PATCH",
  1762. // "id": "composer.projects.locations.environments.patch",
  1763. // "parameterOrder": [
  1764. // "name"
  1765. // ],
  1766. // "parameters": {
  1767. // "name": {
  1768. // "description": "The relative resource name of the environment to update, in the form:\n\"projects/{projectId}/locations/{locationId}/environments/{environmentId}\"",
  1769. // "location": "path",
  1770. // "pattern": "^projects/[^/]+/locations/[^/]+/environments/[^/]+$",
  1771. // "required": true,
  1772. // "type": "string"
  1773. // },
  1774. // "updateMask": {
  1775. // "description": "Required. A comma-separated list of paths, relative to `Environment`, of\nfields to update.\nFor example, to set the version of scikit-learn to install in the\nenvironment to 0.19.0 and to remove an existing installation of\nnumpy, the `updateMask` parameter would include the following two\n`paths` values: \"config.softwareConfig.pypiPackages.scikit-learn\" and\n\"config.softwareConfig.pypiPackages.numpy\". The included patch\nenvironment would specify the scikit-learn version as follows:\n\n {\n \"config\":{\n \"softwareConfig\":{\n \"pypiPackages\":{\n \"scikit-learn\":\"==0.19.0\"\n }\n }\n }\n }\n\nNote that in the above example, any existing PyPI packages\nother than scikit-learn and numpy will be unaffected.\n\nOnly one update type may be included in a single request's `updateMask`.\nFor example, one cannot update both the PyPI packages and\nlabels in the same request. However, it is possible to update multiple\nmembers of a map field simultaneously in the same request. For example,\nto set the labels \"label1\" and \"label2\" while clearing \"label3\" (assuming\nit already exists), one can\nprovide the paths \"labels.label1\", \"labels.label2\", and \"labels.label3\"\nand populate the patch environment as follows:\n\n {\n \"labels\":{\n \"label1\":\"new-label1-value\"\n \"label2\":\"new-label2-value\"\n }\n }\n\nNote that in the above example, any existing labels that are not\nincluded in the `updateMask` will be unaffected.\n\nIt is also possible to replace an entire map field by providing the\nmap field's path in the `updateMask`. The new value of the field will\nbe that which is provided in the patch environment. For example, to\ndelete all pre-existing user-specified PyPI packages and\ninstall botocore at version 1.7.14, the `updateMask` would contain\nthe path \"config.softwareConfig.pypiPackages\", and\nthe patch environment would be the following:\n\n {\n \"config\":{\n \"softwareConfig\":{\n \"pypiPackages\":{\n \"botocore\":\"==1.7.14\"\n }\n }\n }\n }\n\n**Note:** Only the following fields can be updated:\n\n \u003ctable\u003e\n \u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cstrong\u003eMask\u003c/strong\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cstrong\u003ePurpose\u003c/strong\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003econfig.softwareConfig.pypiPackages\n \u003c/td\u003e\n \u003ctd\u003eReplace all custom custom PyPI packages. If a replacement\n package map is not included in `environment`, all custom\n PyPI packages are cleared. It is an error to provide both this mask and a\n mask specifying an individual package.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003econfig.softwareConfig.pypiPackages.\u003cvar\u003epackagename\u003c/var\u003e\u003c/td\u003e\n \u003ctd\u003eUpdate the custom PyPI package \u003cvar\u003epackagename\u003c/var\u003e,\n preserving other packages. To delete the package, include it in\n `updateMask`, and omit the mapping for it in\n `environment.config.softwareConfig.pypiPackages`. It is an error\n to provide both a mask of this form and the\n \"config.softwareConfig.pypiPackages\" mask.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003elabels\u003c/td\u003e\n \u003ctd\u003eReplace all environment labels. If a replacement labels map is not\n included in `environment`, all labels are cleared. It is an error to\n provide both this mask and a mask specifying one or more individual\n labels.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003elabels.\u003cvar\u003elabelName\u003c/var\u003e\u003c/td\u003e\n \u003ctd\u003eSet the label named \u003cvar\u003elabelName\u003c/var\u003e, while preserving other\n labels. To delete the label, include it in `updateMask` and omit its\n mapping in `environment.labels`. It is an error to provide both a\n mask of this form and the \"labels\" mask.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003econfig.nodeCount\u003c/td\u003e\n \u003ctd\u003eHorizontally scale the number of nodes in the environment. An integer\n greater than or equal to 3 must be provided in the `config.nodeCount` field.\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003econfig.softwareConfig.airflowConfigOverrides\u003c/td\u003e\n \u003ctd\u003eReplace all Apache Airflow config overrides. If a replacement config\n overrides map is not included in `environment`, all config overrides\n are cleared.\n It is an error to provide both this mask and a mask specifying one or\n more individual config overrides.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003econfig.softwareConfig.airflowConfigOverrides.\u003cvar\u003esection\u003c/var\u003e-\u003cvar\u003ename\n \u003c/var\u003e\u003c/td\u003e\n \u003ctd\u003eOverride the Apache Airflow config property \u003cvar\u003ename\u003c/var\u003e in the\n section named \u003cvar\u003esection\u003c/var\u003e, preserving other properties. To delete\n the property override, include it in `updateMask` and omit its mapping\n in `environment.config.softwareConfig.airflowConfigOverrides`.\n It is an error to provide both a mask of this form and the\n \"config.softwareConfig.airflowConfigOverrides\" mask.\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003econfig.softwareConfig.envVariables\u003c/td\u003e\n \u003ctd\u003eReplace all environment variables. If a replacement environment\n variable map is not included in `environment`, all custom environment\n variables are cleared.\n It is an error to provide both this mask and a mask specifying one or\n more individual environment variables.\u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003c/table\u003e",
  1776. // "format": "google-fieldmask",
  1777. // "location": "query",
  1778. // "type": "string"
  1779. // }
  1780. // },
  1781. // "path": "v1/{+name}",
  1782. // "request": {
  1783. // "$ref": "Environment"
  1784. // },
  1785. // "response": {
  1786. // "$ref": "Operation"
  1787. // },
  1788. // "scopes": [
  1789. // "https://www.googleapis.com/auth/cloud-platform"
  1790. // ]
  1791. // }
  1792. }
  1793. // method id "composer.projects.locations.imageVersions.list":
  1794. type ProjectsLocationsImageVersionsListCall struct {
  1795. s *Service
  1796. parent string
  1797. urlParams_ gensupport.URLParams
  1798. ifNoneMatch_ string
  1799. ctx_ context.Context
  1800. header_ http.Header
  1801. }
  1802. // List: List ImageVersions for provided location.
  1803. func (r *ProjectsLocationsImageVersionsService) List(parent string) *ProjectsLocationsImageVersionsListCall {
  1804. c := &ProjectsLocationsImageVersionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1805. c.parent = parent
  1806. return c
  1807. }
  1808. // PageSize sets the optional parameter "pageSize": The maximum number
  1809. // of image_versions to return.
  1810. func (c *ProjectsLocationsImageVersionsListCall) PageSize(pageSize int64) *ProjectsLocationsImageVersionsListCall {
  1811. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1812. return c
  1813. }
  1814. // PageToken sets the optional parameter "pageToken": The
  1815. // next_page_token value returned from a previous List request, if any.
  1816. func (c *ProjectsLocationsImageVersionsListCall) PageToken(pageToken string) *ProjectsLocationsImageVersionsListCall {
  1817. c.urlParams_.Set("pageToken", pageToken)
  1818. return c
  1819. }
  1820. // Fields allows partial responses to be retrieved. See
  1821. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1822. // for more information.
  1823. func (c *ProjectsLocationsImageVersionsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsImageVersionsListCall {
  1824. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1825. return c
  1826. }
  1827. // IfNoneMatch sets the optional parameter which makes the operation
  1828. // fail if the object's ETag matches the given value. This is useful for
  1829. // getting updates only after the object has changed since the last
  1830. // request. Use googleapi.IsNotModified to check whether the response
  1831. // error from Do is the result of In-None-Match.
  1832. func (c *ProjectsLocationsImageVersionsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsImageVersionsListCall {
  1833. c.ifNoneMatch_ = entityTag
  1834. return c
  1835. }
  1836. // Context sets the context to be used in this call's Do method. Any
  1837. // pending HTTP request will be aborted if the provided context is
  1838. // canceled.
  1839. func (c *ProjectsLocationsImageVersionsListCall) Context(ctx context.Context) *ProjectsLocationsImageVersionsListCall {
  1840. c.ctx_ = ctx
  1841. return c
  1842. }
  1843. // Header returns an http.Header that can be modified by the caller to
  1844. // add HTTP headers to the request.
  1845. func (c *ProjectsLocationsImageVersionsListCall) Header() http.Header {
  1846. if c.header_ == nil {
  1847. c.header_ = make(http.Header)
  1848. }
  1849. return c.header_
  1850. }
  1851. func (c *ProjectsLocationsImageVersionsListCall) doRequest(alt string) (*http.Response, error) {
  1852. reqHeaders := make(http.Header)
  1853. for k, v := range c.header_ {
  1854. reqHeaders[k] = v
  1855. }
  1856. reqHeaders.Set("User-Agent", c.s.userAgent())
  1857. if c.ifNoneMatch_ != "" {
  1858. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1859. }
  1860. var body io.Reader = nil
  1861. c.urlParams_.Set("alt", alt)
  1862. c.urlParams_.Set("prettyPrint", "false")
  1863. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/imageVersions")
  1864. urls += "?" + c.urlParams_.Encode()
  1865. req, err := http.NewRequest("GET", urls, body)
  1866. if err != nil {
  1867. return nil, err
  1868. }
  1869. req.Header = reqHeaders
  1870. googleapi.Expand(req.URL, map[string]string{
  1871. "parent": c.parent,
  1872. })
  1873. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1874. }
  1875. // Do executes the "composer.projects.locations.imageVersions.list" call.
  1876. // Exactly one of *ListImageVersionsResponse or error will be non-nil.
  1877. // Any non-2xx status code is an error. Response headers are in either
  1878. // *ListImageVersionsResponse.ServerResponse.Header or (if a response
  1879. // was returned at all) in error.(*googleapi.Error).Header. Use
  1880. // googleapi.IsNotModified to check whether the returned error was
  1881. // because http.StatusNotModified was returned.
  1882. func (c *ProjectsLocationsImageVersionsListCall) Do(opts ...googleapi.CallOption) (*ListImageVersionsResponse, error) {
  1883. gensupport.SetOptions(c.urlParams_, opts...)
  1884. res, err := c.doRequest("json")
  1885. if res != nil && res.StatusCode == http.StatusNotModified {
  1886. if res.Body != nil {
  1887. res.Body.Close()
  1888. }
  1889. return nil, &googleapi.Error{
  1890. Code: res.StatusCode,
  1891. Header: res.Header,
  1892. }
  1893. }
  1894. if err != nil {
  1895. return nil, err
  1896. }
  1897. defer googleapi.CloseBody(res)
  1898. if err := googleapi.CheckResponse(res); err != nil {
  1899. return nil, err
  1900. }
  1901. ret := &ListImageVersionsResponse{
  1902. ServerResponse: googleapi.ServerResponse{
  1903. Header: res.Header,
  1904. HTTPStatusCode: res.StatusCode,
  1905. },
  1906. }
  1907. target := &ret
  1908. if err := gensupport.DecodeResponse(target, res); err != nil {
  1909. return nil, err
  1910. }
  1911. return ret, nil
  1912. // {
  1913. // "description": "List ImageVersions for provided location.",
  1914. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/imageVersions",
  1915. // "httpMethod": "GET",
  1916. // "id": "composer.projects.locations.imageVersions.list",
  1917. // "parameterOrder": [
  1918. // "parent"
  1919. // ],
  1920. // "parameters": {
  1921. // "pageSize": {
  1922. // "description": "The maximum number of image_versions to return.",
  1923. // "format": "int32",
  1924. // "location": "query",
  1925. // "type": "integer"
  1926. // },
  1927. // "pageToken": {
  1928. // "description": "The next_page_token value returned from a previous List request, if any.",
  1929. // "location": "query",
  1930. // "type": "string"
  1931. // },
  1932. // "parent": {
  1933. // "description": "List ImageVersions in the given project and location, in the form:\n\"projects/{projectId}/locations/{locationId}\"",
  1934. // "location": "path",
  1935. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  1936. // "required": true,
  1937. // "type": "string"
  1938. // }
  1939. // },
  1940. // "path": "v1/{+parent}/imageVersions",
  1941. // "response": {
  1942. // "$ref": "ListImageVersionsResponse"
  1943. // },
  1944. // "scopes": [
  1945. // "https://www.googleapis.com/auth/cloud-platform"
  1946. // ]
  1947. // }
  1948. }
  1949. // Pages invokes f for each page of results.
  1950. // A non-nil error returned from f will halt the iteration.
  1951. // The provided context supersedes any context provided to the Context method.
  1952. func (c *ProjectsLocationsImageVersionsListCall) Pages(ctx context.Context, f func(*ListImageVersionsResponse) error) error {
  1953. c.ctx_ = ctx
  1954. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1955. for {
  1956. x, err := c.Do()
  1957. if err != nil {
  1958. return err
  1959. }
  1960. if err := f(x); err != nil {
  1961. return err
  1962. }
  1963. if x.NextPageToken == "" {
  1964. return nil
  1965. }
  1966. c.PageToken(x.NextPageToken)
  1967. }
  1968. }
  1969. // method id "composer.projects.locations.operations.delete":
  1970. type ProjectsLocationsOperationsDeleteCall struct {
  1971. s *Service
  1972. name string
  1973. urlParams_ gensupport.URLParams
  1974. ctx_ context.Context
  1975. header_ http.Header
  1976. }
  1977. // Delete: Deletes a long-running operation. This method indicates that
  1978. // the client is
  1979. // no longer interested in the operation result. It does not cancel
  1980. // the
  1981. // operation. If the server doesn't support this method, it
  1982. // returns
  1983. // `google.rpc.Code.UNIMPLEMENTED`.
  1984. func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
  1985. c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1986. c.name = name
  1987. return c
  1988. }
  1989. // Fields allows partial responses to be retrieved. See
  1990. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1991. // for more information.
  1992. func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
  1993. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1994. return c
  1995. }
  1996. // Context sets the context to be used in this call's Do method. Any
  1997. // pending HTTP request will be aborted if the provided context is
  1998. // canceled.
  1999. func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
  2000. c.ctx_ = ctx
  2001. return c
  2002. }
  2003. // Header returns an http.Header that can be modified by the caller to
  2004. // add HTTP headers to the request.
  2005. func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
  2006. if c.header_ == nil {
  2007. c.header_ = make(http.Header)
  2008. }
  2009. return c.header_
  2010. }
  2011. func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2012. reqHeaders := make(http.Header)
  2013. for k, v := range c.header_ {
  2014. reqHeaders[k] = v
  2015. }
  2016. reqHeaders.Set("User-Agent", c.s.userAgent())
  2017. var body io.Reader = nil
  2018. c.urlParams_.Set("alt", alt)
  2019. c.urlParams_.Set("prettyPrint", "false")
  2020. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2021. urls += "?" + c.urlParams_.Encode()
  2022. req, err := http.NewRequest("DELETE", urls, body)
  2023. if err != nil {
  2024. return nil, err
  2025. }
  2026. req.Header = reqHeaders
  2027. googleapi.Expand(req.URL, map[string]string{
  2028. "name": c.name,
  2029. })
  2030. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2031. }
  2032. // Do executes the "composer.projects.locations.operations.delete" call.
  2033. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2034. // code is an error. Response headers are in either
  2035. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2036. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2037. // check whether the returned error was because http.StatusNotModified
  2038. // was returned.
  2039. func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2040. gensupport.SetOptions(c.urlParams_, opts...)
  2041. res, err := c.doRequest("json")
  2042. if res != nil && res.StatusCode == http.StatusNotModified {
  2043. if res.Body != nil {
  2044. res.Body.Close()
  2045. }
  2046. return nil, &googleapi.Error{
  2047. Code: res.StatusCode,
  2048. Header: res.Header,
  2049. }
  2050. }
  2051. if err != nil {
  2052. return nil, err
  2053. }
  2054. defer googleapi.CloseBody(res)
  2055. if err := googleapi.CheckResponse(res); err != nil {
  2056. return nil, err
  2057. }
  2058. ret := &Empty{
  2059. ServerResponse: googleapi.ServerResponse{
  2060. Header: res.Header,
  2061. HTTPStatusCode: res.StatusCode,
  2062. },
  2063. }
  2064. target := &ret
  2065. if err := gensupport.DecodeResponse(target, res); err != nil {
  2066. return nil, err
  2067. }
  2068. return ret, nil
  2069. // {
  2070. // "description": "Deletes a long-running operation. This method indicates that the client is\nno longer interested in the operation result. It does not cancel the\noperation. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`.",
  2071. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
  2072. // "httpMethod": "DELETE",
  2073. // "id": "composer.projects.locations.operations.delete",
  2074. // "parameterOrder": [
  2075. // "name"
  2076. // ],
  2077. // "parameters": {
  2078. // "name": {
  2079. // "description": "The name of the operation resource to be deleted.",
  2080. // "location": "path",
  2081. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2082. // "required": true,
  2083. // "type": "string"
  2084. // }
  2085. // },
  2086. // "path": "v1/{+name}",
  2087. // "response": {
  2088. // "$ref": "Empty"
  2089. // },
  2090. // "scopes": [
  2091. // "https://www.googleapis.com/auth/cloud-platform"
  2092. // ]
  2093. // }
  2094. }
  2095. // method id "composer.projects.locations.operations.get":
  2096. type ProjectsLocationsOperationsGetCall struct {
  2097. s *Service
  2098. name string
  2099. urlParams_ gensupport.URLParams
  2100. ifNoneMatch_ string
  2101. ctx_ context.Context
  2102. header_ http.Header
  2103. }
  2104. // Get: Gets the latest state of a long-running operation. Clients can
  2105. // use this
  2106. // method to poll the operation result at intervals as recommended by
  2107. // the API
  2108. // service.
  2109. func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
  2110. c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2111. c.name = name
  2112. return c
  2113. }
  2114. // Fields allows partial responses to be retrieved. See
  2115. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2116. // for more information.
  2117. func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
  2118. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2119. return c
  2120. }
  2121. // IfNoneMatch sets the optional parameter which makes the operation
  2122. // fail if the object's ETag matches the given value. This is useful for
  2123. // getting updates only after the object has changed since the last
  2124. // request. Use googleapi.IsNotModified to check whether the response
  2125. // error from Do is the result of In-None-Match.
  2126. func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
  2127. c.ifNoneMatch_ = entityTag
  2128. return c
  2129. }
  2130. // Context sets the context to be used in this call's Do method. Any
  2131. // pending HTTP request will be aborted if the provided context is
  2132. // canceled.
  2133. func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
  2134. c.ctx_ = ctx
  2135. return c
  2136. }
  2137. // Header returns an http.Header that can be modified by the caller to
  2138. // add HTTP headers to the request.
  2139. func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
  2140. if c.header_ == nil {
  2141. c.header_ = make(http.Header)
  2142. }
  2143. return c.header_
  2144. }
  2145. func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
  2146. reqHeaders := make(http.Header)
  2147. for k, v := range c.header_ {
  2148. reqHeaders[k] = v
  2149. }
  2150. reqHeaders.Set("User-Agent", c.s.userAgent())
  2151. if c.ifNoneMatch_ != "" {
  2152. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2153. }
  2154. var body io.Reader = nil
  2155. c.urlParams_.Set("alt", alt)
  2156. c.urlParams_.Set("prettyPrint", "false")
  2157. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2158. urls += "?" + c.urlParams_.Encode()
  2159. req, err := http.NewRequest("GET", urls, body)
  2160. if err != nil {
  2161. return nil, err
  2162. }
  2163. req.Header = reqHeaders
  2164. googleapi.Expand(req.URL, map[string]string{
  2165. "name": c.name,
  2166. })
  2167. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2168. }
  2169. // Do executes the "composer.projects.locations.operations.get" call.
  2170. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  2171. // status code is an error. Response headers are in either
  2172. // *Operation.ServerResponse.Header or (if a response was returned at
  2173. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2174. // to check whether the returned error was because
  2175. // http.StatusNotModified was returned.
  2176. func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  2177. gensupport.SetOptions(c.urlParams_, opts...)
  2178. res, err := c.doRequest("json")
  2179. if res != nil && res.StatusCode == http.StatusNotModified {
  2180. if res.Body != nil {
  2181. res.Body.Close()
  2182. }
  2183. return nil, &googleapi.Error{
  2184. Code: res.StatusCode,
  2185. Header: res.Header,
  2186. }
  2187. }
  2188. if err != nil {
  2189. return nil, err
  2190. }
  2191. defer googleapi.CloseBody(res)
  2192. if err := googleapi.CheckResponse(res); err != nil {
  2193. return nil, err
  2194. }
  2195. ret := &Operation{
  2196. ServerResponse: googleapi.ServerResponse{
  2197. Header: res.Header,
  2198. HTTPStatusCode: res.StatusCode,
  2199. },
  2200. }
  2201. target := &ret
  2202. if err := gensupport.DecodeResponse(target, res); err != nil {
  2203. return nil, err
  2204. }
  2205. return ret, nil
  2206. // {
  2207. // "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.",
  2208. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}",
  2209. // "httpMethod": "GET",
  2210. // "id": "composer.projects.locations.operations.get",
  2211. // "parameterOrder": [
  2212. // "name"
  2213. // ],
  2214. // "parameters": {
  2215. // "name": {
  2216. // "description": "The name of the operation resource.",
  2217. // "location": "path",
  2218. // "pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
  2219. // "required": true,
  2220. // "type": "string"
  2221. // }
  2222. // },
  2223. // "path": "v1/{+name}",
  2224. // "response": {
  2225. // "$ref": "Operation"
  2226. // },
  2227. // "scopes": [
  2228. // "https://www.googleapis.com/auth/cloud-platform"
  2229. // ]
  2230. // }
  2231. }
  2232. // method id "composer.projects.locations.operations.list":
  2233. type ProjectsLocationsOperationsListCall struct {
  2234. s *Service
  2235. name string
  2236. urlParams_ gensupport.URLParams
  2237. ifNoneMatch_ string
  2238. ctx_ context.Context
  2239. header_ http.Header
  2240. }
  2241. // List: Lists operations that match the specified filter in the
  2242. // request. If the
  2243. // server doesn't support this method, it returns
  2244. // `UNIMPLEMENTED`.
  2245. //
  2246. // NOTE: the `name` binding allows API services to override the
  2247. // binding
  2248. // to use different resource name schemes, such as `users/*/operations`.
  2249. // To
  2250. // override the binding, API services can add a binding such
  2251. // as
  2252. // "/v1/{name=users/*}/operations" to their service configuration.
  2253. // For backwards compatibility, the default name includes the
  2254. // operations
  2255. // collection id, however overriding users must ensure the name
  2256. // binding
  2257. // is the parent resource, without the operations collection id.
  2258. func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
  2259. c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2260. c.name = name
  2261. return c
  2262. }
  2263. // Filter sets the optional parameter "filter": The standard list
  2264. // filter.
  2265. func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
  2266. c.urlParams_.Set("filter", filter)
  2267. return c
  2268. }
  2269. // PageSize sets the optional parameter "pageSize": The standard list
  2270. // page size.
  2271. func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
  2272. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2273. return c
  2274. }
  2275. // PageToken sets the optional parameter "pageToken": The standard list
  2276. // page token.
  2277. func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
  2278. c.urlParams_.Set("pageToken", pageToken)
  2279. return c
  2280. }
  2281. // Fields allows partial responses to be retrieved. See
  2282. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2283. // for more information.
  2284. func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
  2285. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2286. return c
  2287. }
  2288. // IfNoneMatch sets the optional parameter which makes the operation
  2289. // fail if the object's ETag matches the given value. This is useful for
  2290. // getting updates only after the object has changed since the last
  2291. // request. Use googleapi.IsNotModified to check whether the response
  2292. // error from Do is the result of In-None-Match.
  2293. func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
  2294. c.ifNoneMatch_ = entityTag
  2295. return c
  2296. }
  2297. // Context sets the context to be used in this call's Do method. Any
  2298. // pending HTTP request will be aborted if the provided context is
  2299. // canceled.
  2300. func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
  2301. c.ctx_ = ctx
  2302. return c
  2303. }
  2304. // Header returns an http.Header that can be modified by the caller to
  2305. // add HTTP headers to the request.
  2306. func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
  2307. if c.header_ == nil {
  2308. c.header_ = make(http.Header)
  2309. }
  2310. return c.header_
  2311. }
  2312. func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
  2313. reqHeaders := make(http.Header)
  2314. for k, v := range c.header_ {
  2315. reqHeaders[k] = v
  2316. }
  2317. reqHeaders.Set("User-Agent", c.s.userAgent())
  2318. if c.ifNoneMatch_ != "" {
  2319. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2320. }
  2321. var body io.Reader = nil
  2322. c.urlParams_.Set("alt", alt)
  2323. c.urlParams_.Set("prettyPrint", "false")
  2324. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/operations")
  2325. urls += "?" + c.urlParams_.Encode()
  2326. req, err := http.NewRequest("GET", urls, body)
  2327. if err != nil {
  2328. return nil, err
  2329. }
  2330. req.Header = reqHeaders
  2331. googleapi.Expand(req.URL, map[string]string{
  2332. "name": c.name,
  2333. })
  2334. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2335. }
  2336. // Do executes the "composer.projects.locations.operations.list" call.
  2337. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  2338. // non-2xx status code is an error. Response headers are in either
  2339. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  2340. // returned at all) in error.(*googleapi.Error).Header. Use
  2341. // googleapi.IsNotModified to check whether the returned error was
  2342. // because http.StatusNotModified was returned.
  2343. func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  2344. gensupport.SetOptions(c.urlParams_, opts...)
  2345. res, err := c.doRequest("json")
  2346. if res != nil && res.StatusCode == http.StatusNotModified {
  2347. if res.Body != nil {
  2348. res.Body.Close()
  2349. }
  2350. return nil, &googleapi.Error{
  2351. Code: res.StatusCode,
  2352. Header: res.Header,
  2353. }
  2354. }
  2355. if err != nil {
  2356. return nil, err
  2357. }
  2358. defer googleapi.CloseBody(res)
  2359. if err := googleapi.CheckResponse(res); err != nil {
  2360. return nil, err
  2361. }
  2362. ret := &ListOperationsResponse{
  2363. ServerResponse: googleapi.ServerResponse{
  2364. Header: res.Header,
  2365. HTTPStatusCode: res.StatusCode,
  2366. },
  2367. }
  2368. target := &ret
  2369. if err := gensupport.DecodeResponse(target, res); err != nil {
  2370. return nil, err
  2371. }
  2372. return ret, nil
  2373. // {
  2374. // "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.",
  2375. // "flatPath": "v1/projects/{projectsId}/locations/{locationsId}/operations",
  2376. // "httpMethod": "GET",
  2377. // "id": "composer.projects.locations.operations.list",
  2378. // "parameterOrder": [
  2379. // "name"
  2380. // ],
  2381. // "parameters": {
  2382. // "filter": {
  2383. // "description": "The standard list filter.",
  2384. // "location": "query",
  2385. // "type": "string"
  2386. // },
  2387. // "name": {
  2388. // "description": "The name of the operation's parent resource.",
  2389. // "location": "path",
  2390. // "pattern": "^projects/[^/]+/locations/[^/]+$",
  2391. // "required": true,
  2392. // "type": "string"
  2393. // },
  2394. // "pageSize": {
  2395. // "description": "The standard list page size.",
  2396. // "format": "int32",
  2397. // "location": "query",
  2398. // "type": "integer"
  2399. // },
  2400. // "pageToken": {
  2401. // "description": "The standard list page token.",
  2402. // "location": "query",
  2403. // "type": "string"
  2404. // }
  2405. // },
  2406. // "path": "v1/{+name}/operations",
  2407. // "response": {
  2408. // "$ref": "ListOperationsResponse"
  2409. // },
  2410. // "scopes": [
  2411. // "https://www.googleapis.com/auth/cloud-platform"
  2412. // ]
  2413. // }
  2414. }
  2415. // Pages invokes f for each page of results.
  2416. // A non-nil error returned from f will halt the iteration.
  2417. // The provided context supersedes any context provided to the Context method.
  2418. func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  2419. c.ctx_ = ctx
  2420. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2421. for {
  2422. x, err := c.Do()
  2423. if err != nil {
  2424. return err
  2425. }
  2426. if err := f(x); err != nil {
  2427. return err
  2428. }
  2429. if x.NextPageToken == "" {
  2430. return nil
  2431. }
  2432. c.PageToken(x.NextPageToken)
  2433. }
  2434. }