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\CloudRun\Resource;
19
20use Google\Service\CloudRun\ListServicesResponse;
21use Google\Service\CloudRun\Service;
22use Google\Service\CloudRun\Status;
23
24/**
25 * The "services" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $runService = new Google\Service\CloudRun(...);
29 *   $services = $runService->services;
30 *  </code>
31 */
32class NamespacesServices extends \Google\Service\Resource
33{
34  /**
35   * Create a service. (services.create)
36   *
37   * @param string $parent The namespace in which the service should be created.
38   * For Cloud Run (fully managed), replace {namespace_id} with the project ID or
39   * number.
40   * @param Service $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string dryRun Indicates that the server should validate the
44   * request and populate default values without persisting the request. Supported
45   * values: `all`
46   * @return Service
47   */
48  public function create($parent, Service $postBody, $optParams = [])
49  {
50    $params = ['parent' => $parent, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], Service::class);
53  }
54  /**
55   * Delete a service. This will cause the Service to stop serving traffic and
56   * will delete the child entities like Routes, Configurations and Revisions.
57   * (services.delete)
58   *
59   * @param string $name The name of the service to delete. For Cloud Run (fully
60   * managed), replace {namespace_id} with the project ID or number.
61   * @param array $optParams Optional parameters.
62   *
63   * @opt_param string apiVersion Cloud Run currently ignores this parameter.
64   * @opt_param string dryRun Indicates that the server should validate the
65   * request and populate default values without persisting the request. Supported
66   * values: `all`
67   * @opt_param string kind Cloud Run currently ignores this parameter.
68   * @opt_param string propagationPolicy Specifies the propagation policy of
69   * delete. Cloud Run currently ignores this setting, and deletes in the
70   * background. Please see kubernetes.io/docs/concepts/workloads/controllers
71   * /garbage-collection/ for more information.
72   * @return Status
73   */
74  public function delete($name, $optParams = [])
75  {
76    $params = ['name' => $name];
77    $params = array_merge($params, $optParams);
78    return $this->call('delete', [$params], Status::class);
79  }
80  /**
81   * Get information about a service. (services.get)
82   *
83   * @param string $name The name of the service to retrieve. For Cloud Run (fully
84   * managed), replace {namespace_id} with the project ID or number.
85   * @param array $optParams Optional parameters.
86   * @return Service
87   */
88  public function get($name, $optParams = [])
89  {
90    $params = ['name' => $name];
91    $params = array_merge($params, $optParams);
92    return $this->call('get', [$params], Service::class);
93  }
94  /**
95   * List services. (services.listNamespacesServices)
96   *
97   * @param string $parent The namespace from which the services should be listed.
98   * For Cloud Run (fully managed), replace {namespace_id} with the project ID or
99   * number.
100   * @param array $optParams Optional parameters.
101   *
102   * @opt_param string continue Optional. Encoded string to continue paging.
103   * @opt_param string fieldSelector Allows to filter resources based on a
104   * specific value for a field name. Send this in a query string format. i.e.
105   * 'metadata.name%3Dlorem'. Not currently used by Cloud Run.
106   * @opt_param bool includeUninitialized Not currently used by Cloud Run.
107   * @opt_param string labelSelector Allows to filter resources based on a label.
108   * Supported operations are =, !=, exists, in, and notIn.
109   * @opt_param int limit Optional. The maximum number of records that should be
110   * returned.
111   * @opt_param string resourceVersion The baseline resource version from which
112   * the list or watch operation should start. Not currently used by Cloud Run.
113   * @opt_param bool watch Flag that indicates that the client expects to watch
114   * this resource as well. Not currently used by Cloud Run.
115   * @return ListServicesResponse
116   */
117  public function listNamespacesServices($parent, $optParams = [])
118  {
119    $params = ['parent' => $parent];
120    $params = array_merge($params, $optParams);
121    return $this->call('list', [$params], ListServicesResponse::class);
122  }
123  /**
124   * Replace a service. Only the spec and metadata labels and annotations are
125   * modifiable. After the Update request, Cloud Run will work to make the
126   * 'status' match the requested 'spec'. May provide metadata.resourceVersion to
127   * enforce update from last read for optimistic concurrency control.
128   * (services.replaceService)
129   *
130   * @param string $name The name of the service being replaced. For Cloud Run
131   * (fully managed), replace {namespace_id} with the project ID or number.
132   * @param Service $postBody
133   * @param array $optParams Optional parameters.
134   *
135   * @opt_param string dryRun Indicates that the server should validate the
136   * request and populate default values without persisting the request. Supported
137   * values: `all`
138   * @return Service
139   */
140  public function replaceService($name, Service $postBody, $optParams = [])
141  {
142    $params = ['name' => $name, 'postBody' => $postBody];
143    $params = array_merge($params, $optParams);
144    return $this->call('replaceService', [$params], Service::class);
145  }
146}
147
148// Adding a class alias for backwards compatibility with the previous class name.
149class_alias(NamespacesServices::class, 'Google_Service_CloudRun_Resource_NamespacesServices');
150