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\Apigee\Resource;
19
20use Google\Service\Apigee\GoogleCloudApigeeV1DebugMask;
21use Google\Service\Apigee\GoogleCloudApigeeV1Environment;
22use Google\Service\Apigee\GoogleCloudApigeeV1EnvironmentConfig;
23use Google\Service\Apigee\GoogleCloudApigeeV1Subscription;
24use Google\Service\Apigee\GoogleCloudApigeeV1TraceConfig;
25use Google\Service\Apigee\GoogleIamV1Policy;
26use Google\Service\Apigee\GoogleIamV1SetIamPolicyRequest;
27use Google\Service\Apigee\GoogleIamV1TestIamPermissionsRequest;
28use Google\Service\Apigee\GoogleIamV1TestIamPermissionsResponse;
29use Google\Service\Apigee\GoogleLongrunningOperation;
30use Google\Service\Apigee\GoogleProtobufEmpty;
31
32/**
33 * The "environments" collection of methods.
34 * Typical usage is:
35 *  <code>
36 *   $apigeeService = new Google\Service\Apigee(...);
37 *   $environments = $apigeeService->environments;
38 *  </code>
39 */
40class OrganizationsEnvironments extends \Google\Service\Resource
41{
42  /**
43   * Creates an environment in an organization. (environments.create)
44   *
45   * @param string $parent Required. Name of the organization in which the
46   * environment will be created. Use the following structure in your request:
47   * `organizations/{org}`
48   * @param GoogleCloudApigeeV1Environment $postBody
49   * @param array $optParams Optional parameters.
50   *
51   * @opt_param string name Optional. Name of the environment. Alternatively, the
52   * name may be specified in the request body in the name field.
53   * @return GoogleLongrunningOperation
54   */
55  public function create($parent, GoogleCloudApigeeV1Environment $postBody, $optParams = [])
56  {
57    $params = ['parent' => $parent, 'postBody' => $postBody];
58    $params = array_merge($params, $optParams);
59    return $this->call('create', [$params], GoogleLongrunningOperation::class);
60  }
61  /**
62   * Deletes an environment from an organization. (environments.delete)
63   *
64   * @param string $name Required. Name of the environment. Use the following
65   * structure in your request: `organizations/{org}/environments/{env}`
66   * @param array $optParams Optional parameters.
67   * @return GoogleLongrunningOperation
68   */
69  public function delete($name, $optParams = [])
70  {
71    $params = ['name' => $name];
72    $params = array_merge($params, $optParams);
73    return $this->call('delete', [$params], GoogleLongrunningOperation::class);
74  }
75  /**
76   * Gets environment details. (environments.get)
77   *
78   * @param string $name Required. Name of the environment. Use the following
79   * structure in your request: `organizations/{org}/environments/{env}`
80   * @param array $optParams Optional parameters.
81   * @return GoogleCloudApigeeV1Environment
82   */
83  public function get($name, $optParams = [])
84  {
85    $params = ['name' => $name];
86    $params = array_merge($params, $optParams);
87    return $this->call('get', [$params], GoogleCloudApigeeV1Environment::class);
88  }
89  /**
90   * Gets the debug mask singleton resource for an environment.
91   * (environments.getDebugmask)
92   *
93   * @param string $name Required. Name of the debug mask. Use the following
94   * structure in your request:
95   * `organizations/{org}/environments/{env}/debugmask`.
96   * @param array $optParams Optional parameters.
97   * @return GoogleCloudApigeeV1DebugMask
98   */
99  public function getDebugmask($name, $optParams = [])
100  {
101    $params = ['name' => $name];
102    $params = array_merge($params, $optParams);
103    return $this->call('getDebugmask', [$params], GoogleCloudApigeeV1DebugMask::class);
104  }
105  /**
106   * Gets the deployed configuration for an environment.
107   * (environments.getDeployedConfig)
108   *
109   * @param string $name Required. Name of the environment deployed configuration
110   * resource. Use the following structure in your request:
111   * `organizations/{org}/environments/{env}/deployedConfig`
112   * @param array $optParams Optional parameters.
113   * @return GoogleCloudApigeeV1EnvironmentConfig
114   */
115  public function getDeployedConfig($name, $optParams = [])
116  {
117    $params = ['name' => $name];
118    $params = array_merge($params, $optParams);
119    return $this->call('getDeployedConfig', [$params], GoogleCloudApigeeV1EnvironmentConfig::class);
120  }
121  /**
122   * Gets the IAM policy on an environment. For more information, see [Manage
123   * users, roles, and permissions using the
124   * API](https://cloud.google.com/apigee/docs/api-platform/system-administration
125   * /manage-users-roles). You must have the `apigee.environments.getIamPolicy`
126   * permission to call this API. (environments.getIamPolicy)
127   *
128   * @param string $resource REQUIRED: The resource for which the policy is being
129   * requested. See the operation documentation for the appropriate value for this
130   * field.
131   * @param array $optParams Optional parameters.
132   *
133   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
134   * version that will be used to format the policy. Valid values are 0, 1, and 3.
135   * Requests specifying an invalid value will be rejected. Requests for policies
136   * with any conditional role bindings must specify version 3. Policies with no
137   * conditional role bindings may specify any valid value or leave the field
138   * unset. The policy in the response might use the policy version that you
139   * specified, or it might use a lower policy version. For example, if you
140   * specify version 3, but the policy has no conditional role bindings, the
141   * response uses version 1. To learn which resources support conditions in their
142   * IAM policies, see the [IAM
143   * documentation](https://cloud.google.com/iam/help/conditions/resource-
144   * policies).
145   * @return GoogleIamV1Policy
146   */
147  public function getIamPolicy($resource, $optParams = [])
148  {
149    $params = ['resource' => $resource];
150    $params = array_merge($params, $optParams);
151    return $this->call('getIamPolicy', [$params], GoogleIamV1Policy::class);
152  }
153  /**
154   * Get distributed trace configuration in an environment.
155   * (environments.getTraceConfig)
156   *
157   * @param string $name Required. Name of the trace configuration. Use the
158   * following structure in your request:
159   * "organizations/environments/traceConfig".
160   * @param array $optParams Optional parameters.
161   * @return GoogleCloudApigeeV1TraceConfig
162   */
163  public function getTraceConfig($name, $optParams = [])
164  {
165    $params = ['name' => $name];
166    $params = array_merge($params, $optParams);
167    return $this->call('getTraceConfig', [$params], GoogleCloudApigeeV1TraceConfig::class);
168  }
169  /**
170   * Sets the IAM policy on an environment, if the policy already exists it will
171   * be replaced. For more information, see [Manage users, roles, and permissions
172   * using the API](https://cloud.google.com/apigee/docs/api-platform/system-
173   * administration/manage-users-roles). You must have the
174   * `apigee.environments.setIamPolicy` permission to call this API.
175   * (environments.setIamPolicy)
176   *
177   * @param string $resource REQUIRED: The resource for which the policy is being
178   * specified. See the operation documentation for the appropriate value for this
179   * field.
180   * @param GoogleIamV1SetIamPolicyRequest $postBody
181   * @param array $optParams Optional parameters.
182   * @return GoogleIamV1Policy
183   */
184  public function setIamPolicy($resource, GoogleIamV1SetIamPolicyRequest $postBody, $optParams = [])
185  {
186    $params = ['resource' => $resource, 'postBody' => $postBody];
187    $params = array_merge($params, $optParams);
188    return $this->call('setIamPolicy', [$params], GoogleIamV1Policy::class);
189  }
190  /**
191   * Creates a subscription for the environment's Pub/Sub topic. The server will
192   * assign a random name for this subscription. The "name" and "push_config" must
193   * *not* be specified. (environments.subscribe)
194   *
195   * @param string $parent Required. Name of the environment. Use the following
196   * structure in your request: `organizations/{org}/environments/{env}`
197   * @param array $optParams Optional parameters.
198   * @return GoogleCloudApigeeV1Subscription
199   */
200  public function subscribe($parent, $optParams = [])
201  {
202    $params = ['parent' => $parent];
203    $params = array_merge($params, $optParams);
204    return $this->call('subscribe', [$params], GoogleCloudApigeeV1Subscription::class);
205  }
206  /**
207   * Tests the permissions of a user on an environment, and returns a subset of
208   * permissions that the user has on the environment. If the environment does not
209   * exist, an empty permission set is returned (a NOT_FOUND error is not
210   * returned). (environments.testIamPermissions)
211   *
212   * @param string $resource REQUIRED: The resource for which the policy detail is
213   * being requested. See the operation documentation for the appropriate value
214   * for this field.
215   * @param GoogleIamV1TestIamPermissionsRequest $postBody
216   * @param array $optParams Optional parameters.
217   * @return GoogleIamV1TestIamPermissionsResponse
218   */
219  public function testIamPermissions($resource, GoogleIamV1TestIamPermissionsRequest $postBody, $optParams = [])
220  {
221    $params = ['resource' => $resource, 'postBody' => $postBody];
222    $params = array_merge($params, $optParams);
223    return $this->call('testIamPermissions', [$params], GoogleIamV1TestIamPermissionsResponse::class);
224  }
225  /**
226   * Deletes a subscription for the environment's Pub/Sub topic.
227   * (environments.unsubscribe)
228   *
229   * @param string $parent Required. Name of the environment. Use the following
230   * structure in your request: `organizations/{org}/environments/{env}`
231   * @param GoogleCloudApigeeV1Subscription $postBody
232   * @param array $optParams Optional parameters.
233   * @return GoogleProtobufEmpty
234   */
235  public function unsubscribe($parent, GoogleCloudApigeeV1Subscription $postBody, $optParams = [])
236  {
237    $params = ['parent' => $parent, 'postBody' => $postBody];
238    $params = array_merge($params, $optParams);
239    return $this->call('unsubscribe', [$params], GoogleProtobufEmpty::class);
240  }
241  /**
242   * Updates an existing environment. When updating properties, you must pass all
243   * existing properties to the API, even if they are not being changed. If you
244   * omit properties from the payload, the properties are removed. To get the
245   * current list of properties for the environment, use the [Get Environment
246   * API](get). **Note**: Both `PUT` and `POST` methods are supported for updating
247   * an existing environment. (environments.update)
248   *
249   * @param string $name Required. Name of the environment. Use the following
250   * structure in your request: `organizations/{org}/environments/{env}`
251   * @param GoogleCloudApigeeV1Environment $postBody
252   * @param array $optParams Optional parameters.
253   * @return GoogleCloudApigeeV1Environment
254   */
255  public function update($name, GoogleCloudApigeeV1Environment $postBody, $optParams = [])
256  {
257    $params = ['name' => $name, 'postBody' => $postBody];
258    $params = array_merge($params, $optParams);
259    return $this->call('update', [$params], GoogleCloudApigeeV1Environment::class);
260  }
261  /**
262   * Updates the debug mask singleton resource for an environment.
263   * (environments.updateDebugmask)
264   *
265   * @param string $name Name of the debug mask.
266   * @param GoogleCloudApigeeV1DebugMask $postBody
267   * @param array $optParams Optional parameters.
268   *
269   * @opt_param bool replaceRepeatedFields Boolean flag that specifies whether to
270   * replace existing values in the debug mask when doing an update. Set to true
271   * to replace existing values. The default behavior is to append the values
272   * (false).
273   * @opt_param string updateMask Field debug mask to support partial updates.
274   * @return GoogleCloudApigeeV1DebugMask
275   */
276  public function updateDebugmask($name, GoogleCloudApigeeV1DebugMask $postBody, $optParams = [])
277  {
278    $params = ['name' => $name, 'postBody' => $postBody];
279    $params = array_merge($params, $optParams);
280    return $this->call('updateDebugmask', [$params], GoogleCloudApigeeV1DebugMask::class);
281  }
282  /**
283   * Updates an existing environment. When updating properties, you must pass all
284   * existing properties to the API, even if they are not being changed. If you
285   * omit properties from the payload, the properties are removed. To get the
286   * current list of properties for the environment, use the [Get Environment
287   * API](get). **Note**: Both `PUT` and `POST` methods are supported for updating
288   * an existing environment. (environments.updateEnvironment)
289   *
290   * @param string $name Required. Name of the environment. Use the following
291   * structure in your request: `organizations/{org}/environments/{env}`
292   * @param GoogleCloudApigeeV1Environment $postBody
293   * @param array $optParams Optional parameters.
294   * @return GoogleCloudApigeeV1Environment
295   */
296  public function updateEnvironment($name, GoogleCloudApigeeV1Environment $postBody, $optParams = [])
297  {
298    $params = ['name' => $name, 'postBody' => $postBody];
299    $params = array_merge($params, $optParams);
300    return $this->call('updateEnvironment', [$params], GoogleCloudApigeeV1Environment::class);
301  }
302  /**
303   * Updates the trace configurations in an environment. Note that the repeated
304   * fields have replace semantics when included in the field mask and that they
305   * will be overwritten by the value of the fields in the request body.
306   * (environments.updateTraceConfig)
307   *
308   * @param string $name Required. Name of the trace configuration. Use the
309   * following structure in your request:
310   * "organizations/environments/traceConfig".
311   * @param GoogleCloudApigeeV1TraceConfig $postBody
312   * @param array $optParams Optional parameters.
313   *
314   * @opt_param string updateMask List of fields to be updated.
315   * @return GoogleCloudApigeeV1TraceConfig
316   */
317  public function updateTraceConfig($name, GoogleCloudApigeeV1TraceConfig $postBody, $optParams = [])
318  {
319    $params = ['name' => $name, 'postBody' => $postBody];
320    $params = array_merge($params, $optParams);
321    return $this->call('updateTraceConfig', [$params], GoogleCloudApigeeV1TraceConfig::class);
322  }
323}
324
325// Adding a class alias for backwards compatibility with the previous class name.
326class_alias(OrganizationsEnvironments::class, 'Google_Service_Apigee_Resource_OrganizationsEnvironments');
327