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\GoogleCloudApigeeV1Deployment;
21use Google\Service\Apigee\GoogleProtobufEmpty;
22
23/**
24 * The "revisions" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $apigeeService = new Google\Service\Apigee(...);
28 *   $revisions = $apigeeService->revisions;
29 *  </code>
30 */
31class OrganizationsEnvironmentsApisRevisions extends \Google\Service\Resource
32{
33  /**
34   * Deploys a revision of an API proxy. If another revision of the same API proxy
35   * revision is currently deployed, set the `override` parameter to `true` to
36   * have this revision replace the currently deployed revision. You cannot invoke
37   * an API proxy until it has been deployed to an environment. After you deploy
38   * an API proxy revision, you cannot edit it. To edit the API proxy, you must
39   * create and deploy a new revision. For a request path `organizations/{org}/env
40   * ironments/{env}/apis/{api}/revisions/{rev}/deployments`, two permissions are
41   * required: * `apigee.deployments.create` on the resource
42   * `organizations/{org}/environments/{env}` * `apigee.proxyrevisions.deploy` on
43   * the resource `organizations/{org}/apis/{api}/revisions/{rev}`
44   * (revisions.deploy)
45   *
46   * @param string $name Required. Name of the API proxy revision deployment in
47   * the following format:
48   * `organizations/{org}/environments/{env}/apis/{api}/revisions/{rev}`
49   * @param array $optParams Optional parameters.
50   *
51   * @opt_param bool override Flag that specifies whether the new deployment
52   * replaces other deployed revisions of the API proxy in the environment. Set
53   * `override` to `true` to replace other deployed revisions. By default,
54   * `override` is `false` and the deployment is rejected if other revisions of
55   * the API proxy are deployed in the environment.
56   * @opt_param bool sequencedRollout Flag that specifies whether to enable
57   * sequenced rollout. If set to `true`, the routing rules for this deployment
58   * and the environment changes to add the deployment will be rolled out in a
59   * safe order. This reduces the risk of downtime that could be caused by
60   * changing the environment group's routing before the new destination for the
61   * affected traffic is ready to receive it. This should only be necessary if the
62   * new deployment will be capturing traffic from another environment under a
63   * shared environment group or if traffic will be rerouted to a different
64   * environment due to a base path removal. The [GenerateDeployChangeReport
65   * API](GenerateDeployChangeReport) may be used to examine routing changes
66   * before issuing the deployment request, and its response will indicate if a
67   * sequenced rollout is recommended for the deployment.
68   * @opt_param string serviceAccount Google Cloud IAM service account. The
69   * service account represents the identity of the deployed proxy, and determines
70   * what permissions it has. The format must be
71   * `{ACCOUNT_ID}@{PROJECT}.iam.gserviceaccount.com`.
72   * @return GoogleCloudApigeeV1Deployment
73   */
74  public function deploy($name, $optParams = [])
75  {
76    $params = ['name' => $name];
77    $params = array_merge($params, $optParams);
78    return $this->call('deploy', [$params], GoogleCloudApigeeV1Deployment::class);
79  }
80  /**
81   * Gets the deployment of an API proxy revision and actual state reported by
82   * runtime pods. (revisions.getDeployments)
83   *
84   * @param string $name Required. Name representing an API proxy revision in an
85   * environment in the following format:
86   * `organizations/{org}/environments/{env}/apis/{api}/revisions/{rev}`
87   * @param array $optParams Optional parameters.
88   * @return GoogleCloudApigeeV1Deployment
89   */
90  public function getDeployments($name, $optParams = [])
91  {
92    $params = ['name' => $name];
93    $params = array_merge($params, $optParams);
94    return $this->call('getDeployments', [$params], GoogleCloudApigeeV1Deployment::class);
95  }
96  /**
97   * Undeploys an API proxy revision from an environment. For a request path `orga
98   * nizations/{org}/environments/{env}/apis/{api}/revisions/{rev}/deployments`,
99   * two permissions are required: * `apigee.deployments.delete` on the resource
100   * `organizations/{org}/environments/{env}` * `apigee.proxyrevisions.undeploy`
101   * on the resource `organizations/{org}/apis/{api}/revisions/{rev}`
102   * (revisions.undeploy)
103   *
104   * @param string $name Required. Name of the API proxy revision deployment in
105   * the following format:
106   * `organizations/{org}/environments/{env}/apis/{api}/revisions/{rev}`
107   * @param array $optParams Optional parameters.
108   *
109   * @opt_param bool sequencedRollout Flag that specifies whether to enable
110   * sequenced rollout. If set to `true`, the environment group routing rules
111   * corresponding to this deployment will be removed before removing the
112   * deployment from the runtime. This is likely to be a rare use case; it is only
113   * needed when the intended effect of undeploying this proxy is to cause the
114   * traffic it currently handles to be rerouted to some other existing proxy in
115   * the environment group. The [GenerateUndeployChangeReport
116   * API](GenerateUndeployChangeReport) may be used to examine routing changes
117   * before issuing the undeployment request, and its response will indicate if a
118   * sequenced rollout is recommended for the undeployment.
119   * @return GoogleProtobufEmpty
120   */
121  public function undeploy($name, $optParams = [])
122  {
123    $params = ['name' => $name];
124    $params = array_merge($params, $optParams);
125    return $this->call('undeploy', [$params], GoogleProtobufEmpty::class);
126  }
127}
128
129// Adding a class alias for backwards compatibility with the previous class name.
130class_alias(OrganizationsEnvironmentsApisRevisions::class, 'Google_Service_Apigee_Resource_OrganizationsEnvironmentsApisRevisions');
131