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\BinaryauthorizationEmpty;
|
---|
21 | use Google\Service\BinaryAuthorization\ListPlatformPoliciesResponse;
|
---|
22 | use Google\Service\BinaryAuthorization\PlatformPolicy;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "policies" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $binaryauthorizationService = new Google\Service\BinaryAuthorization(...);
|
---|
29 | * $policies = $binaryauthorizationService->projects_platforms_policies;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class ProjectsPlatformsPolicies extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Creates a platform policy, and returns a copy of it. Returns `NOT_FOUND` if
|
---|
36 | * the project or platform doesn't exist, `INVALID_ARGUMENT` if the request is
|
---|
37 | * malformed, `ALREADY_EXISTS` if the policy already exists, and
|
---|
38 | * `INVALID_ARGUMENT` if the policy contains a platform-specific policy that
|
---|
39 | * does not match the platform value specified in the URL. (policies.create)
|
---|
40 | *
|
---|
41 | * @param string $parent Required. The parent of this platform policy.
|
---|
42 | * @param PlatformPolicy $postBody
|
---|
43 | * @param array $optParams Optional parameters.
|
---|
44 | *
|
---|
45 | * @opt_param string policyId Required. The platform policy ID.
|
---|
46 | * @return PlatformPolicy
|
---|
47 | * @throws \Google\Service\Exception
|
---|
48 | */
|
---|
49 | public function create($parent, PlatformPolicy $postBody, $optParams = [])
|
---|
50 | {
|
---|
51 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
52 | $params = array_merge($params, $optParams);
|
---|
53 | return $this->call('create', [$params], PlatformPolicy::class);
|
---|
54 | }
|
---|
55 | /**
|
---|
56 | * Deletes a platform policy. Returns `NOT_FOUND` if the policy doesn't exist.
|
---|
57 | * (policies.delete)
|
---|
58 | *
|
---|
59 | * @param string $name Required. The name of the platform policy to delete, in
|
---|
60 | * the format `projects/platforms/policies`.
|
---|
61 | * @param array $optParams Optional parameters.
|
---|
62 | *
|
---|
63 | * @opt_param string etag Optional. Used to prevent deleting the policy when
|
---|
64 | * another request has updated it since it was retrieved.
|
---|
65 | * @return BinaryauthorizationEmpty
|
---|
66 | * @throws \Google\Service\Exception
|
---|
67 | */
|
---|
68 | public function delete($name, $optParams = [])
|
---|
69 | {
|
---|
70 | $params = ['name' => $name];
|
---|
71 | $params = array_merge($params, $optParams);
|
---|
72 | return $this->call('delete', [$params], BinaryauthorizationEmpty::class);
|
---|
73 | }
|
---|
74 | /**
|
---|
75 | * Gets a platform policy. Returns `NOT_FOUND` if the policy doesn't exist.
|
---|
76 | * (policies.get)
|
---|
77 | *
|
---|
78 | * @param string $name Required. The name of the platform policy to retrieve in
|
---|
79 | * the format `projects/platforms/policies`.
|
---|
80 | * @param array $optParams Optional parameters.
|
---|
81 | * @return PlatformPolicy
|
---|
82 | * @throws \Google\Service\Exception
|
---|
83 | */
|
---|
84 | public function get($name, $optParams = [])
|
---|
85 | {
|
---|
86 | $params = ['name' => $name];
|
---|
87 | $params = array_merge($params, $optParams);
|
---|
88 | return $this->call('get', [$params], PlatformPolicy::class);
|
---|
89 | }
|
---|
90 | /**
|
---|
91 | * Lists platform policies owned by a project in the specified platform. Returns
|
---|
92 | * `INVALID_ARGUMENT` if the project or the platform doesn't exist.
|
---|
93 | * (policies.listProjectsPlatformsPolicies)
|
---|
94 | *
|
---|
95 | * @param string $parent Required. The resource name of the platform associated
|
---|
96 | * with the platform policies using the format `projects/platforms`.
|
---|
97 | * @param array $optParams Optional parameters.
|
---|
98 | *
|
---|
99 | * @opt_param int pageSize Requested page size. The server may return fewer
|
---|
100 | * results than requested. If unspecified, the server picks an appropriate
|
---|
101 | * default.
|
---|
102 | * @opt_param string pageToken A token identifying a page of results the server
|
---|
103 | * should return. Typically, this is the value of
|
---|
104 | * ListPlatformPoliciesResponse.next_page_token returned from the previous call
|
---|
105 | * to the `ListPlatformPolicies` method.
|
---|
106 | * @return ListPlatformPoliciesResponse
|
---|
107 | * @throws \Google\Service\Exception
|
---|
108 | */
|
---|
109 | public function listProjectsPlatformsPolicies($parent, $optParams = [])
|
---|
110 | {
|
---|
111 | $params = ['parent' => $parent];
|
---|
112 | $params = array_merge($params, $optParams);
|
---|
113 | return $this->call('list', [$params], ListPlatformPoliciesResponse::class);
|
---|
114 | }
|
---|
115 | /**
|
---|
116 | * Replaces a platform policy. Returns `NOT_FOUND` if the policy doesn't exist.
|
---|
117 | * (policies.replacePlatformPolicy)
|
---|
118 | *
|
---|
119 | * @param string $name Output only. The relative resource name of the Binary
|
---|
120 | * Authorization platform policy, in the form of `projects/platforms/policies`.
|
---|
121 | * @param PlatformPolicy $postBody
|
---|
122 | * @param array $optParams Optional parameters.
|
---|
123 | * @return PlatformPolicy
|
---|
124 | * @throws \Google\Service\Exception
|
---|
125 | */
|
---|
126 | public function replacePlatformPolicy($name, PlatformPolicy $postBody, $optParams = [])
|
---|
127 | {
|
---|
128 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
129 | $params = array_merge($params, $optParams);
|
---|
130 | return $this->call('replacePlatformPolicy', [$params], PlatformPolicy::class);
|
---|
131 | }
|
---|
132 | }
|
---|
133 |
|
---|
134 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
135 | class_alias(ProjectsPlatformsPolicies::class, 'Google_Service_BinaryAuthorization_Resource_ProjectsPlatformsPolicies');
|
---|