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\ServiceManagement\Resource;
19
20use Google\Service\ServiceManagement\ListServiceRolloutsResponse;
21use Google\Service\ServiceManagement\Operation;
22use Google\Service\ServiceManagement\Rollout;
23
24/**
25 * The "rollouts" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $servicemanagementService = new Google\Service\ServiceManagement(...);
29 *   $rollouts = $servicemanagementService->rollouts;
30 *  </code>
31 */
32class ServicesRollouts extends \Google\Service\Resource
33{
34  /**
35   * Creates a new service configuration rollout. Based on rollout, the Google
36   * Service Management will roll out the service configurations to different
37   * backend services. For example, the logging configuration will be pushed to
38   * Google Cloud Logging. Please note that any previous pending and running
39   * Rollouts and associated Operations will be automatically cancelled so that
40   * the latest Rollout will not be blocked by previous Rollouts. Only the 100
41   * most recent (in any state) and the last 10 successful (if not already part of
42   * the set of 100 most recent) rollouts are kept for each service. The rest will
43   * be deleted eventually. Operation (rollouts.create)
44   *
45   * @param string $serviceName Required. The name of the service. See the
46   * [overview](https://cloud.google.com/service-management/overview) for naming
47   * requirements. For example: `example.googleapis.com`.
48   * @param Rollout $postBody
49   * @param array $optParams Optional parameters.
50   * @return Operation
51   */
52  public function create($serviceName, Rollout $postBody, $optParams = [])
53  {
54    $params = ['serviceName' => $serviceName, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('create', [$params], Operation::class);
57  }
58  /**
59   * Gets a service configuration rollout. (rollouts.get)
60   *
61   * @param string $serviceName Required. The name of the service. See the
62   * [overview](https://cloud.google.com/service-management/overview) for naming
63   * requirements. For example: `example.googleapis.com`.
64   * @param string $rolloutId Required. The id of the rollout resource.
65   * @param array $optParams Optional parameters.
66   * @return Rollout
67   */
68  public function get($serviceName, $rolloutId, $optParams = [])
69  {
70    $params = ['serviceName' => $serviceName, 'rolloutId' => $rolloutId];
71    $params = array_merge($params, $optParams);
72    return $this->call('get', [$params], Rollout::class);
73  }
74  /**
75   * Lists the history of the service configuration rollouts for a managed
76   * service, from the newest to the oldest. (rollouts.listServicesRollouts)
77   *
78   * @param string $serviceName Required. The name of the service. See the
79   * [overview](https://cloud.google.com/service-management/overview) for naming
80   * requirements. For example: `example.googleapis.com`.
81   * @param array $optParams Optional parameters.
82   *
83   * @opt_param string filter Required. Use `filter` to return subset of rollouts.
84   * The following filters are supported: -- By status. For example,
85   * `filter='status=SUCCESS'` -- By strategy. For example,
86   * `filter='strategy=TrafficPercentStrategy'`
87   * @opt_param int pageSize The max number of items to include in the response
88   * list. Page size is 50 if not specified. Maximum value is 100.
89   * @opt_param string pageToken The token of the page to retrieve.
90   * @return ListServiceRolloutsResponse
91   */
92  public function listServicesRollouts($serviceName, $optParams = [])
93  {
94    $params = ['serviceName' => $serviceName];
95    $params = array_merge($params, $optParams);
96    return $this->call('list', [$params], ListServiceRolloutsResponse::class);
97  }
98}
99
100// Adding a class alias for backwards compatibility with the previous class name.
101class_alias(ServicesRollouts::class, 'Google_Service_ServiceManagement_Resource_ServicesRollouts');
102