1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\CloudComposer\Resource;
19
20use Google\Service\CloudComposer\Environment;
21use Google\Service\CloudComposer\ListEnvironmentsResponse;
22use Google\Service\CloudComposer\Operation;
23
24/**
25 * The "environments" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $composerService = new Google\Service\CloudComposer(...);
29 *   $environments = $composerService->environments;
30 *  </code>
31 */
32class ProjectsLocationsEnvironments extends \Google\Service\Resource
33{
34  /**
35   * Create a new environment. (environments.create)
36   *
37   * @param string $parent The parent must be of the form
38   * "projects/{projectId}/locations/{locationId}".
39   * @param Environment $postBody
40   * @param array $optParams Optional parameters.
41   * @return Operation
42   */
43  public function create($parent, Environment $postBody, $optParams = [])
44  {
45    $params = ['parent' => $parent, 'postBody' => $postBody];
46    $params = array_merge($params, $optParams);
47    return $this->call('create', [$params], Operation::class);
48  }
49  /**
50   * Delete an environment. (environments.delete)
51   *
52   * @param string $name The environment to delete, in the form:
53   * "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
54   * @param array $optParams Optional parameters.
55   * @return Operation
56   */
57  public function delete($name, $optParams = [])
58  {
59    $params = ['name' => $name];
60    $params = array_merge($params, $optParams);
61    return $this->call('delete', [$params], Operation::class);
62  }
63  /**
64   * Get an existing environment. (environments.get)
65   *
66   * @param string $name The resource name of the environment to get, in the form:
67   * "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
68   * @param array $optParams Optional parameters.
69   * @return Environment
70   */
71  public function get($name, $optParams = [])
72  {
73    $params = ['name' => $name];
74    $params = array_merge($params, $optParams);
75    return $this->call('get', [$params], Environment::class);
76  }
77  /**
78   * List environments. (environments.listProjectsLocationsEnvironments)
79   *
80   * @param string $parent List environments in the given project and location, in
81   * the form: "projects/{projectId}/locations/{locationId}"
82   * @param array $optParams Optional parameters.
83   *
84   * @opt_param int pageSize The maximum number of environments to return.
85   * @opt_param string pageToken The next_page_token value returned from a
86   * previous List request, if any.
87   * @return ListEnvironmentsResponse
88   */
89  public function listProjectsLocationsEnvironments($parent, $optParams = [])
90  {
91    $params = ['parent' => $parent];
92    $params = array_merge($params, $optParams);
93    return $this->call('list', [$params], ListEnvironmentsResponse::class);
94  }
95  /**
96   * Update an environment. (environments.patch)
97   *
98   * @param string $name The relative resource name of the environment to update,
99   * in the form:
100   * "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
101   * @param Environment $postBody
102   * @param array $optParams Optional parameters.
103   *
104   * @opt_param string updateMask Required. A comma-separated list of paths,
105   * relative to `Environment`, of fields to update. For example, to set the
106   * version of scikit-learn to install in the environment to 0.19.0 and to remove
107   * an existing installation of numpy, the `updateMask` parameter would include
108   * the following two `paths` values: "config.softwareConfig.pypiPackages.scikit-
109   * learn" and "config.softwareConfig.pypiPackages.numpy". The included patch
110   * environment would specify the scikit-learn version as follows: { "config":{
111   * "softwareConfig":{ "pypiPackages":{ "scikit-learn":"==0.19.0" } } } } Note
112   * that in the above example, any existing PyPI packages other than scikit-learn
113   * and numpy will be unaffected. Only one update type may be included in a
114   * single request's `updateMask`. For example, one cannot update both the PyPI
115   * packages and labels in the same request. However, it is possible to update
116   * multiple members of a map field simultaneously in the same request. For
117   * example, to set the labels "label1" and "label2" while clearing "label3"
118   * (assuming it already exists), one can provide the paths "labels.label1",
119   * "labels.label2", and "labels.label3" and populate the patch environment as
120   * follows: { "labels":{ "label1":"new-label1-value" "label2":"new-label2-value"
121   * } } Note that in the above example, any existing labels that are not included
122   * in the `updateMask` will be unaffected. It is also possible to replace an
123   * entire map field by providing the map field's path in the `updateMask`. The
124   * new value of the field will be that which is provided in the patch
125   * environment. For example, to delete all pre-existing user-specified PyPI
126   * packages and install botocore at version 1.7.14, the `updateMask` would
127   * contain the path "config.softwareConfig.pypiPackages", and the patch
128   * environment would be the following: { "config":{ "softwareConfig":{
129   * "pypiPackages":{ "botocore":"==1.7.14" } } } } **Note:** Only the following
130   * fields can be updated: * `config.softwareConfig.pypiPackages` * Replace all
131   * custom custom PyPI packages. If a replacement package map is not included in
132   * `environment`, all custom PyPI packages are cleared. It is an error to
133   * provide both this mask and a mask specifying an individual package. *
134   * `config.softwareConfig.pypiPackages.`packagename * Update the custom PyPI
135   * package *packagename*, preserving other packages. To delete the package,
136   * include it in `updateMask`, and omit the mapping for it in
137   * `environment.config.softwareConfig.pypiPackages`. It is an error to provide
138   * both a mask of this form and the `config.softwareConfig.pypiPackages` mask. *
139   * `labels` * Replace all environment labels. If a replacement labels map is not
140   * included in `environment`, all labels are cleared. It is an error to provide
141   * both this mask and a mask specifying one or more individual labels. *
142   * `labels.`labelName * Set the label named *labelName*, while preserving other
143   * labels. To delete the label, include it in `updateMask` and omit its mapping
144   * in `environment.labels`. It is an error to provide both a mask of this form
145   * and the `labels` mask. * `config.nodeCount` * Horizontally scale the number
146   * of nodes in the environment. An integer greater than or equal to 3 must be
147   * provided in the `config.nodeCount` field. Supported for Cloud Composer
148   * environments in versions composer-1.*.*-airflow-*.*.*. *
149   * `config.webServerNetworkAccessControl` * Replace the environment's current
150   * `WebServerNetworkAccessControl`. *
151   * `config.softwareConfig.airflowConfigOverrides` * Replace all Apache Airflow
152   * config overrides. If a replacement config overrides map is not included in
153   * `environment`, all config overrides are cleared. It is an error to provide
154   * both this mask and a mask specifying one or more individual config overrides.
155   * * `config.softwareConfig.airflowConfigOverrides.`section-name * Override the
156   * Apache Airflow config property *name* in the section named *section*,
157   * preserving other properties. To delete the property override, include it in
158   * `updateMask` and omit its mapping in
159   * `environment.config.softwareConfig.airflowConfigOverrides`. It is an error to
160   * provide both a mask of this form and the
161   * `config.softwareConfig.airflowConfigOverrides` mask. *
162   * `config.softwareConfig.envVariables` * Replace all environment variables. If
163   * a replacement environment variable map is not included in `environment`, all
164   * custom environment variables are cleared. It is an error to provide both this
165   * mask and a mask specifying one or more individual environment variables. *
166   * `config.softwareConfig.schedulerCount` * Horizontally scale the number of
167   * schedulers in Airflow. A positive integer not greater than the number of
168   * nodes must be provided in the `config.softwareConfig.schedulerCount` field.
169   * Supported for Cloud Composer environments in versions
170   * composer-1.*.*-airflow-2.*.*. * `config.databaseConfig.machineType` * Cloud
171   * SQL machine type used by Airflow database. It has to be one of:
172   * db-n1-standard-2, db-n1-standard-4, db-n1-standard-8 or db-n1-standard-16.
173   * Supported for Cloud Composer environments in versions
174   * composer-1.*.*-airflow-*.*.*. * `config.webServerConfig.machineType` *
175   * Machine type on which Airflow web server is running. It has to be one of:
176   * composer-n1-webserver-2, composer-n1-webserver-4 or composer-n1-webserver-8.
177   * Supported for Cloud Composer environments in versions
178   * composer-1.*.*-airflow-*.*.*.
179   * @return Operation
180   */
181  public function patch($name, Environment $postBody, $optParams = [])
182  {
183    $params = ['name' => $name, 'postBody' => $postBody];
184    $params = array_merge($params, $optParams);
185    return $this->call('patch', [$params], Operation::class);
186  }
187}
188
189// Adding a class alias for backwards compatibility with the previous class name.
190class_alias(ProjectsLocationsEnvironments::class, 'Google_Service_CloudComposer_Resource_ProjectsLocationsEnvironments');
191