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\ListServiceConfigsResponse;
21use Google\Service\ServiceManagement\Operation;
22use Google\Service\ServiceManagement\Service;
23use Google\Service\ServiceManagement\SubmitConfigSourceRequest;
24
25/**
26 * The "configs" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $servicemanagementService = new Google\Service\ServiceManagement(...);
30 *   $configs = $servicemanagementService->configs;
31 *  </code>
32 */
33class ServicesConfigs extends \Google\Service\Resource
34{
35  /**
36   * Creates a new service configuration (version) for a managed service. This
37   * method only stores the service configuration. To roll out the service
38   * configuration to backend systems please call CreateServiceRollout. Only the
39   * 100 most recent service configurations and ones referenced by existing
40   * rollouts are kept for each service. The rest will be deleted eventually.
41   * (configs.create)
42   *
43   * @param string $serviceName Required. The name of the service. See the
44   * [overview](https://cloud.google.com/service-management/overview) for naming
45   * requirements. For example: `example.googleapis.com`.
46   * @param Service $postBody
47   * @param array $optParams Optional parameters.
48   * @return Service
49   */
50  public function create($serviceName, Service $postBody, $optParams = [])
51  {
52    $params = ['serviceName' => $serviceName, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], Service::class);
55  }
56  /**
57   * Gets a service configuration (version) for a managed service. (configs.get)
58   *
59   * @param string $serviceName Required. The name of the service. See the
60   * [overview](https://cloud.google.com/service-management/overview) for naming
61   * requirements. For example: `example.googleapis.com`.
62   * @param string $configId Required. The id of the service configuration
63   * resource. This field must be specified for the server to return all fields,
64   * including `SourceInfo`.
65   * @param array $optParams Optional parameters.
66   *
67   * @opt_param string view Specifies which parts of the Service Config should be
68   * returned in the response.
69   * @return Service
70   */
71  public function get($serviceName, $configId, $optParams = [])
72  {
73    $params = ['serviceName' => $serviceName, 'configId' => $configId];
74    $params = array_merge($params, $optParams);
75    return $this->call('get', [$params], Service::class);
76  }
77  /**
78   * Lists the history of the service configuration for a managed service, from
79   * the newest to the oldest. (configs.listServicesConfigs)
80   *
81   * @param string $serviceName Required. The name of the service. See the
82   * [overview](https://cloud.google.com/service-management/overview) for naming
83   * requirements. For example: `example.googleapis.com`.
84   * @param array $optParams Optional parameters.
85   *
86   * @opt_param int pageSize The max number of items to include in the response
87   * list. Page size is 50 if not specified. Maximum value is 100.
88   * @opt_param string pageToken The token of the page to retrieve.
89   * @return ListServiceConfigsResponse
90   */
91  public function listServicesConfigs($serviceName, $optParams = [])
92  {
93    $params = ['serviceName' => $serviceName];
94    $params = array_merge($params, $optParams);
95    return $this->call('list', [$params], ListServiceConfigsResponse::class);
96  }
97  /**
98   * Creates a new service configuration (version) for a managed service based on
99   * user-supplied configuration source files (for example: OpenAPI
100   * Specification). This method stores the source configurations as well as the
101   * generated service configuration. To rollout the service configuration to
102   * other services, please call CreateServiceRollout. Only the 100 most recent
103   * configuration sources and ones referenced by existing service configurtions
104   * are kept for each service. The rest will be deleted eventually. Operation
105   * (configs.submit)
106   *
107   * @param string $serviceName Required. The name of the service. See the
108   * [overview](https://cloud.google.com/service-management/overview) for naming
109   * requirements. For example: `example.googleapis.com`.
110   * @param SubmitConfigSourceRequest $postBody
111   * @param array $optParams Optional parameters.
112   * @return Operation
113   */
114  public function submit($serviceName, SubmitConfigSourceRequest $postBody, $optParams = [])
115  {
116    $params = ['serviceName' => $serviceName, 'postBody' => $postBody];
117    $params = array_merge($params, $optParams);
118    return $this->call('submit', [$params], Operation::class);
119  }
120}
121
122// Adding a class alias for backwards compatibility with the previous class name.
123class_alias(ServicesConfigs::class, 'Google_Service_ServiceManagement_Resource_ServicesConfigs');
124