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 |
|
---|
18 | namespace Google\Service\ServiceDirectory\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\ServiceDirectory\GetIamPolicyRequest;
|
---|
21 | use Google\Service\ServiceDirectory\ListNamespacesResponse;
|
---|
22 | use Google\Service\ServiceDirectory\Policy;
|
---|
23 | use Google\Service\ServiceDirectory\ServicedirectoryEmpty;
|
---|
24 | use Google\Service\ServiceDirectory\ServicedirectoryNamespace;
|
---|
25 | use Google\Service\ServiceDirectory\SetIamPolicyRequest;
|
---|
26 | use Google\Service\ServiceDirectory\TestIamPermissionsRequest;
|
---|
27 | use Google\Service\ServiceDirectory\TestIamPermissionsResponse;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * The "namespaces" collection of methods.
|
---|
31 | * Typical usage is:
|
---|
32 | * <code>
|
---|
33 | * $servicedirectoryService = new Google\Service\ServiceDirectory(...);
|
---|
34 | * $namespaces = $servicedirectoryService->projects_locations_namespaces;
|
---|
35 | * </code>
|
---|
36 | */
|
---|
37 | class ProjectsLocationsNamespaces extends \Google\Service\Resource
|
---|
38 | {
|
---|
39 | /**
|
---|
40 | * Creates a namespace, and returns the new namespace. (namespaces.create)
|
---|
41 | *
|
---|
42 | * @param string $parent Required. The resource name of the project and location
|
---|
43 | * the namespace will be created in.
|
---|
44 | * @param ServicedirectoryNamespace $postBody
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | *
|
---|
47 | * @opt_param string namespaceId Required. The Resource ID must be 1-63
|
---|
48 | * characters long, and comply with RFC1035. Specifically, the name must be 1-63
|
---|
49 | * characters long and match the regular expression
|
---|
50 | * `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first character must be a
|
---|
51 | * lowercase letter, and all following characters must be a dash, lowercase
|
---|
52 | * letter, or digit, except the last character, which cannot be a dash.
|
---|
53 | * @return ServicedirectoryNamespace
|
---|
54 | * @throws \Google\Service\Exception
|
---|
55 | */
|
---|
56 | public function create($parent, ServicedirectoryNamespace $postBody, $optParams = [])
|
---|
57 | {
|
---|
58 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
59 | $params = array_merge($params, $optParams);
|
---|
60 | return $this->call('create', [$params], ServicedirectoryNamespace::class);
|
---|
61 | }
|
---|
62 | /**
|
---|
63 | * Deletes a namespace. This also deletes all services and endpoints in the
|
---|
64 | * namespace. (namespaces.delete)
|
---|
65 | *
|
---|
66 | * @param string $name Required. The name of the namespace to delete.
|
---|
67 | * @param array $optParams Optional parameters.
|
---|
68 | * @return ServicedirectoryEmpty
|
---|
69 | * @throws \Google\Service\Exception
|
---|
70 | */
|
---|
71 | public function delete($name, $optParams = [])
|
---|
72 | {
|
---|
73 | $params = ['name' => $name];
|
---|
74 | $params = array_merge($params, $optParams);
|
---|
75 | return $this->call('delete', [$params], ServicedirectoryEmpty::class);
|
---|
76 | }
|
---|
77 | /**
|
---|
78 | * Gets a namespace. (namespaces.get)
|
---|
79 | *
|
---|
80 | * @param string $name Required. The name of the namespace to retrieve.
|
---|
81 | * @param array $optParams Optional parameters.
|
---|
82 | * @return ServicedirectoryNamespace
|
---|
83 | * @throws \Google\Service\Exception
|
---|
84 | */
|
---|
85 | public function get($name, $optParams = [])
|
---|
86 | {
|
---|
87 | $params = ['name' => $name];
|
---|
88 | $params = array_merge($params, $optParams);
|
---|
89 | return $this->call('get', [$params], ServicedirectoryNamespace::class);
|
---|
90 | }
|
---|
91 | /**
|
---|
92 | * Gets the IAM Policy for a resource (namespace or service only).
|
---|
93 | * (namespaces.getIamPolicy)
|
---|
94 | *
|
---|
95 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
96 | * requested. See [Resource
|
---|
97 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
98 | * appropriate value for this field.
|
---|
99 | * @param GetIamPolicyRequest $postBody
|
---|
100 | * @param array $optParams Optional parameters.
|
---|
101 | * @return Policy
|
---|
102 | * @throws \Google\Service\Exception
|
---|
103 | */
|
---|
104 | public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
|
---|
105 | {
|
---|
106 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
107 | $params = array_merge($params, $optParams);
|
---|
108 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
109 | }
|
---|
110 | /**
|
---|
111 | * Lists all namespaces. (namespaces.listProjectsLocationsNamespaces)
|
---|
112 | *
|
---|
113 | * @param string $parent Required. The resource name of the project and location
|
---|
114 | * whose namespaces you'd like to list.
|
---|
115 | * @param array $optParams Optional parameters.
|
---|
116 | *
|
---|
117 | * @opt_param string filter Optional. The filter to list results by. General
|
---|
118 | * `filter` string syntax: ` ()` * `` can be `name` or `labels.` for map field *
|
---|
119 | * `` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:` means `HAS`, and
|
---|
120 | * is roughly the same as `=` * `` must be the same data type as field * `` can
|
---|
121 | * be `AND`, `OR`, `NOT` Examples of valid filters: * `labels.owner` returns
|
---|
122 | * namespaces that have a label with the key `owner`, this is the same as
|
---|
123 | * `labels:owner` * `labels.owner=sd` returns namespaces that have key/value
|
---|
124 | * `owner=sd` * `name>projects/my-project/locations/us-
|
---|
125 | * east1/namespaces/namespace-c` returns namespaces that have name that is
|
---|
126 | * alphabetically later than the string, so "namespace-e" is returned but
|
---|
127 | * "namespace-a" is not * `labels.owner!=sd AND labels.foo=bar` returns
|
---|
128 | * namespaces that have `owner` in label key but value is not `sd` AND have
|
---|
129 | * key/value `foo=bar` * `doesnotexist.foo=bar` returns an empty list. Note that
|
---|
130 | * namespace doesn't have a field called "doesnotexist". Since the filter does
|
---|
131 | * not match any namespaces, it returns no results For more information about
|
---|
132 | * filtering, see [API Filtering](https://aip.dev/160).
|
---|
133 | * @opt_param string orderBy Optional. The order to list results by. General
|
---|
134 | * `order_by` string syntax: ` () (,)` * `` allows value: `name` * `` ascending
|
---|
135 | * or descending order by ``. If this is left blank, `asc` is used Note that an
|
---|
136 | * empty `order_by` string results in default order, which is order by `name` in
|
---|
137 | * ascending order.
|
---|
138 | * @opt_param int pageSize Optional. The maximum number of items to return.
|
---|
139 | * @opt_param string pageToken Optional. The next_page_token value returned from
|
---|
140 | * a previous List request, if any.
|
---|
141 | * @return ListNamespacesResponse
|
---|
142 | * @throws \Google\Service\Exception
|
---|
143 | */
|
---|
144 | public function listProjectsLocationsNamespaces($parent, $optParams = [])
|
---|
145 | {
|
---|
146 | $params = ['parent' => $parent];
|
---|
147 | $params = array_merge($params, $optParams);
|
---|
148 | return $this->call('list', [$params], ListNamespacesResponse::class);
|
---|
149 | }
|
---|
150 | /**
|
---|
151 | * Updates a namespace. (namespaces.patch)
|
---|
152 | *
|
---|
153 | * @param string $name Immutable. The resource name for the namespace in the
|
---|
154 | * format `projects/locations/namespaces`.
|
---|
155 | * @param ServicedirectoryNamespace $postBody
|
---|
156 | * @param array $optParams Optional parameters.
|
---|
157 | *
|
---|
158 | * @opt_param string updateMask Required. List of fields to be updated in this
|
---|
159 | * request.
|
---|
160 | * @return ServicedirectoryNamespace
|
---|
161 | * @throws \Google\Service\Exception
|
---|
162 | */
|
---|
163 | public function patch($name, ServicedirectoryNamespace $postBody, $optParams = [])
|
---|
164 | {
|
---|
165 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
166 | $params = array_merge($params, $optParams);
|
---|
167 | return $this->call('patch', [$params], ServicedirectoryNamespace::class);
|
---|
168 | }
|
---|
169 | /**
|
---|
170 | * Sets the IAM Policy for a resource (namespace or service only).
|
---|
171 | * (namespaces.setIamPolicy)
|
---|
172 | *
|
---|
173 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
174 | * specified. See [Resource
|
---|
175 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
176 | * appropriate value for this field.
|
---|
177 | * @param SetIamPolicyRequest $postBody
|
---|
178 | * @param array $optParams Optional parameters.
|
---|
179 | * @return Policy
|
---|
180 | * @throws \Google\Service\Exception
|
---|
181 | */
|
---|
182 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
183 | {
|
---|
184 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
185 | $params = array_merge($params, $optParams);
|
---|
186 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
187 | }
|
---|
188 | /**
|
---|
189 | * Tests IAM permissions for a resource (namespace or service only).
|
---|
190 | * (namespaces.testIamPermissions)
|
---|
191 | *
|
---|
192 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
193 | * being requested. See [Resource
|
---|
194 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
195 | * appropriate value for this field.
|
---|
196 | * @param TestIamPermissionsRequest $postBody
|
---|
197 | * @param array $optParams Optional parameters.
|
---|
198 | * @return TestIamPermissionsResponse
|
---|
199 | * @throws \Google\Service\Exception
|
---|
200 | */
|
---|
201 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
202 | {
|
---|
203 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
204 | $params = array_merge($params, $optParams);
|
---|
205 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
206 | }
|
---|
207 | }
|
---|
208 |
|
---|
209 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
210 | class_alias(ProjectsLocationsNamespaces::class, 'Google_Service_ServiceDirectory_Resource_ProjectsLocationsNamespaces');
|
---|