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\BinaryAuthorization\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\BinaryAuthorization\Attestor;
|
---|
21 | use Google\Service\BinaryAuthorization\BinaryauthorizationEmpty;
|
---|
22 | use Google\Service\BinaryAuthorization\IamPolicy;
|
---|
23 | use Google\Service\BinaryAuthorization\ListAttestorsResponse;
|
---|
24 | use Google\Service\BinaryAuthorization\SetIamPolicyRequest;
|
---|
25 | use Google\Service\BinaryAuthorization\TestIamPermissionsRequest;
|
---|
26 | use Google\Service\BinaryAuthorization\TestIamPermissionsResponse;
|
---|
27 | use Google\Service\BinaryAuthorization\ValidateAttestationOccurrenceRequest;
|
---|
28 | use Google\Service\BinaryAuthorization\ValidateAttestationOccurrenceResponse;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The "attestors" collection of methods.
|
---|
32 | * Typical usage is:
|
---|
33 | * <code>
|
---|
34 | * $binaryauthorizationService = new Google\Service\BinaryAuthorization(...);
|
---|
35 | * $attestors = $binaryauthorizationService->projects_attestors;
|
---|
36 | * </code>
|
---|
37 | */
|
---|
38 | class ProjectsAttestors extends \Google\Service\Resource
|
---|
39 | {
|
---|
40 | /**
|
---|
41 | * Creates an attestor, and returns a copy of the new attestor. Returns
|
---|
42 | * `NOT_FOUND` if the project does not exist, `INVALID_ARGUMENT` if the request
|
---|
43 | * is malformed, `ALREADY_EXISTS` if the attestor already exists.
|
---|
44 | * (attestors.create)
|
---|
45 | *
|
---|
46 | * @param string $parent Required. The parent of this attestor.
|
---|
47 | * @param Attestor $postBody
|
---|
48 | * @param array $optParams Optional parameters.
|
---|
49 | *
|
---|
50 | * @opt_param string attestorId Required. The attestors ID.
|
---|
51 | * @return Attestor
|
---|
52 | * @throws \Google\Service\Exception
|
---|
53 | */
|
---|
54 | public function create($parent, Attestor $postBody, $optParams = [])
|
---|
55 | {
|
---|
56 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
57 | $params = array_merge($params, $optParams);
|
---|
58 | return $this->call('create', [$params], Attestor::class);
|
---|
59 | }
|
---|
60 | /**
|
---|
61 | * Deletes an attestor. Returns `NOT_FOUND` if the attestor does not exist.
|
---|
62 | * (attestors.delete)
|
---|
63 | *
|
---|
64 | * @param string $name Required. The name of the attestors to delete, in the
|
---|
65 | * format `projects/attestors`.
|
---|
66 | * @param array $optParams Optional parameters.
|
---|
67 | * @return BinaryauthorizationEmpty
|
---|
68 | * @throws \Google\Service\Exception
|
---|
69 | */
|
---|
70 | public function delete($name, $optParams = [])
|
---|
71 | {
|
---|
72 | $params = ['name' => $name];
|
---|
73 | $params = array_merge($params, $optParams);
|
---|
74 | return $this->call('delete', [$params], BinaryauthorizationEmpty::class);
|
---|
75 | }
|
---|
76 | /**
|
---|
77 | * Gets an attestor. Returns `NOT_FOUND` if the attestor does not exist.
|
---|
78 | * (attestors.get)
|
---|
79 | *
|
---|
80 | * @param string $name Required. The name of the attestor to retrieve, in the
|
---|
81 | * format `projects/attestors`.
|
---|
82 | * @param array $optParams Optional parameters.
|
---|
83 | * @return Attestor
|
---|
84 | * @throws \Google\Service\Exception
|
---|
85 | */
|
---|
86 | public function get($name, $optParams = [])
|
---|
87 | {
|
---|
88 | $params = ['name' => $name];
|
---|
89 | $params = array_merge($params, $optParams);
|
---|
90 | return $this->call('get', [$params], Attestor::class);
|
---|
91 | }
|
---|
92 | /**
|
---|
93 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
94 | * resource exists and does not have a policy set. (attestors.getIamPolicy)
|
---|
95 | *
|
---|
96 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
97 | * requested. See [Resource
|
---|
98 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
99 | * appropriate value for this field.
|
---|
100 | * @param array $optParams Optional parameters.
|
---|
101 | *
|
---|
102 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
103 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
104 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
105 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
106 | * conditional role bindings may specify any valid value or leave the field
|
---|
107 | * unset. The policy in the response might use the policy version that you
|
---|
108 | * specified, or it might use a lower policy version. For example, if you
|
---|
109 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
110 | * response uses version 1. To learn which resources support conditions in their
|
---|
111 | * IAM policies, see the [IAM
|
---|
112 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
113 | * policies).
|
---|
114 | * @return IamPolicy
|
---|
115 | * @throws \Google\Service\Exception
|
---|
116 | */
|
---|
117 | public function getIamPolicy($resource, $optParams = [])
|
---|
118 | {
|
---|
119 | $params = ['resource' => $resource];
|
---|
120 | $params = array_merge($params, $optParams);
|
---|
121 | return $this->call('getIamPolicy', [$params], IamPolicy::class);
|
---|
122 | }
|
---|
123 | /**
|
---|
124 | * Lists attestors. Returns `INVALID_ARGUMENT` if the project does not exist.
|
---|
125 | * (attestors.listProjectsAttestors)
|
---|
126 | *
|
---|
127 | * @param string $parent Required. The resource name of the project associated
|
---|
128 | * with the attestors, in the format `projects`.
|
---|
129 | * @param array $optParams Optional parameters.
|
---|
130 | *
|
---|
131 | * @opt_param int pageSize Requested page size. The server may return fewer
|
---|
132 | * results than requested. If unspecified, the server will pick an appropriate
|
---|
133 | * default.
|
---|
134 | * @opt_param string pageToken A token identifying a page of results the server
|
---|
135 | * should return. Typically, this is the value of
|
---|
136 | * ListAttestorsResponse.next_page_token returned from the previous call to the
|
---|
137 | * `ListAttestors` method.
|
---|
138 | * @return ListAttestorsResponse
|
---|
139 | * @throws \Google\Service\Exception
|
---|
140 | */
|
---|
141 | public function listProjectsAttestors($parent, $optParams = [])
|
---|
142 | {
|
---|
143 | $params = ['parent' => $parent];
|
---|
144 | $params = array_merge($params, $optParams);
|
---|
145 | return $this->call('list', [$params], ListAttestorsResponse::class);
|
---|
146 | }
|
---|
147 | /**
|
---|
148 | * Sets the access control policy on the specified resource. Replaces any
|
---|
149 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
150 | * `PERMISSION_DENIED` errors. (attestors.setIamPolicy)
|
---|
151 | *
|
---|
152 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
153 | * specified. See [Resource
|
---|
154 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
155 | * appropriate value for this field.
|
---|
156 | * @param SetIamPolicyRequest $postBody
|
---|
157 | * @param array $optParams Optional parameters.
|
---|
158 | * @return IamPolicy
|
---|
159 | * @throws \Google\Service\Exception
|
---|
160 | */
|
---|
161 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
162 | {
|
---|
163 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
164 | $params = array_merge($params, $optParams);
|
---|
165 | return $this->call('setIamPolicy', [$params], IamPolicy::class);
|
---|
166 | }
|
---|
167 | /**
|
---|
168 | * Returns permissions that a caller has on the specified resource. If the
|
---|
169 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
170 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
171 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
172 | * This operation may "fail open" without warning.
|
---|
173 | * (attestors.testIamPermissions)
|
---|
174 | *
|
---|
175 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
176 | * being requested. See [Resource
|
---|
177 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
178 | * appropriate value for this field.
|
---|
179 | * @param TestIamPermissionsRequest $postBody
|
---|
180 | * @param array $optParams Optional parameters.
|
---|
181 | * @return TestIamPermissionsResponse
|
---|
182 | * @throws \Google\Service\Exception
|
---|
183 | */
|
---|
184 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
185 | {
|
---|
186 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
187 | $params = array_merge($params, $optParams);
|
---|
188 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
189 | }
|
---|
190 | /**
|
---|
191 | * Updates an attestor. Returns `NOT_FOUND` if the attestor does not exist.
|
---|
192 | * (attestors.update)
|
---|
193 | *
|
---|
194 | * @param string $name Required. The resource name, in the format:
|
---|
195 | * `projects/attestors`. This field may not be updated.
|
---|
196 | * @param Attestor $postBody
|
---|
197 | * @param array $optParams Optional parameters.
|
---|
198 | * @return Attestor
|
---|
199 | * @throws \Google\Service\Exception
|
---|
200 | */
|
---|
201 | public function update($name, Attestor $postBody, $optParams = [])
|
---|
202 | {
|
---|
203 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
204 | $params = array_merge($params, $optParams);
|
---|
205 | return $this->call('update', [$params], Attestor::class);
|
---|
206 | }
|
---|
207 | /**
|
---|
208 | * Returns whether the given `Attestation` for the given image URI was signed by
|
---|
209 | * the given `Attestor` (attestors.validateAttestationOccurrence)
|
---|
210 | *
|
---|
211 | * @param string $attestor Required. The resource name of the Attestor of the
|
---|
212 | * occurrence, in the format `projects/attestors`.
|
---|
213 | * @param ValidateAttestationOccurrenceRequest $postBody
|
---|
214 | * @param array $optParams Optional parameters.
|
---|
215 | * @return ValidateAttestationOccurrenceResponse
|
---|
216 | * @throws \Google\Service\Exception
|
---|
217 | */
|
---|
218 | public function validateAttestationOccurrence($attestor, ValidateAttestationOccurrenceRequest $postBody, $optParams = [])
|
---|
219 | {
|
---|
220 | $params = ['attestor' => $attestor, 'postBody' => $postBody];
|
---|
221 | $params = array_merge($params, $optParams);
|
---|
222 | return $this->call('validateAttestationOccurrence', [$params], ValidateAttestationOccurrenceResponse::class);
|
---|
223 | }
|
---|
224 | }
|
---|
225 |
|
---|
226 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
227 | class_alias(ProjectsAttestors::class, 'Google_Service_BinaryAuthorization_Resource_ProjectsAttestors');
|
---|