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\Assuredworkloads\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Assuredworkloads\GoogleCloudAssuredworkloadsV1AnalyzeWorkloadMoveResponse;
|
---|
21 | use Google\Service\Assuredworkloads\GoogleCloudAssuredworkloadsV1EnableResourceMonitoringResponse;
|
---|
22 | use Google\Service\Assuredworkloads\GoogleCloudAssuredworkloadsV1ListWorkloadsResponse;
|
---|
23 | use Google\Service\Assuredworkloads\GoogleCloudAssuredworkloadsV1MutatePartnerPermissionsRequest;
|
---|
24 | use Google\Service\Assuredworkloads\GoogleCloudAssuredworkloadsV1RestrictAllowedResourcesRequest;
|
---|
25 | use Google\Service\Assuredworkloads\GoogleCloudAssuredworkloadsV1RestrictAllowedResourcesResponse;
|
---|
26 | use Google\Service\Assuredworkloads\GoogleCloudAssuredworkloadsV1Workload;
|
---|
27 | use Google\Service\Assuredworkloads\GoogleLongrunningOperation;
|
---|
28 | use Google\Service\Assuredworkloads\GoogleProtobufEmpty;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The "workloads" collection of methods.
|
---|
32 | * Typical usage is:
|
---|
33 | * <code>
|
---|
34 | * $assuredworkloadsService = new Google\Service\Assuredworkloads(...);
|
---|
35 | * $workloads = $assuredworkloadsService->organizations_locations_workloads;
|
---|
36 | * </code>
|
---|
37 | */
|
---|
38 | class OrganizationsLocationsWorkloads extends \Google\Service\Resource
|
---|
39 | {
|
---|
40 | /**
|
---|
41 | * Analyzes a hypothetical move of a source resource to a target workload to
|
---|
42 | * surface compliance risks. The analysis is best effort and is not guaranteed
|
---|
43 | * to be exhaustive. (workloads.analyzeWorkloadMove)
|
---|
44 | *
|
---|
45 | * @param string $target Required. The resource ID of the folder-based
|
---|
46 | * destination workload. This workload is where the source resource will
|
---|
47 | * hypothetically be moved to. Specify the workload's relative resource name,
|
---|
48 | * formatted as: "organizations/{ORGANIZATION_ID}/locations/{LOCATION_ID}/worklo
|
---|
49 | * ads/{WORKLOAD_ID}" For example: "organizations/123/locations/us-
|
---|
50 | * east1/workloads/assured-workload-2"
|
---|
51 | * @param array $optParams Optional parameters.
|
---|
52 | *
|
---|
53 | * @opt_param string assetTypes Optional. List of asset types to be analyzed,
|
---|
54 | * including and under the source resource. If empty, all assets are analyzed.
|
---|
55 | * The complete list of asset types is available
|
---|
56 | * [here](https://cloud.google.com/asset-inventory/docs/supported-asset-types).
|
---|
57 | * @opt_param int pageSize Optional. Page size. If a value is not specified, the
|
---|
58 | * default value of 10 is used.
|
---|
59 | * @opt_param string pageToken Optional. The page token from the previous
|
---|
60 | * response. It needs to be passed in the second and following requests.
|
---|
61 | * @opt_param string project The source type is a project. Specify the project's
|
---|
62 | * relative resource name, formatted as either a project number or a project ID:
|
---|
63 | * "projects/{PROJECT_NUMBER}" or "projects/{PROJECT_ID}" For example:
|
---|
64 | * "projects/951040570662" when specifying a project number, or "projects/my-
|
---|
65 | * project-123" when specifying a project ID.
|
---|
66 | * @return GoogleCloudAssuredworkloadsV1AnalyzeWorkloadMoveResponse
|
---|
67 | * @throws \Google\Service\Exception
|
---|
68 | */
|
---|
69 | public function analyzeWorkloadMove($target, $optParams = [])
|
---|
70 | {
|
---|
71 | $params = ['target' => $target];
|
---|
72 | $params = array_merge($params, $optParams);
|
---|
73 | return $this->call('analyzeWorkloadMove', [$params], GoogleCloudAssuredworkloadsV1AnalyzeWorkloadMoveResponse::class);
|
---|
74 | }
|
---|
75 | /**
|
---|
76 | * Creates Assured Workload. (workloads.create)
|
---|
77 | *
|
---|
78 | * @param string $parent Required. The resource name of the new Workload's
|
---|
79 | * parent. Must be of the form `organizations/{org_id}/locations/{location_id}`.
|
---|
80 | * @param GoogleCloudAssuredworkloadsV1Workload $postBody
|
---|
81 | * @param array $optParams Optional parameters.
|
---|
82 | *
|
---|
83 | * @opt_param string externalId Optional. A identifier associated with the
|
---|
84 | * workload and underlying projects which allows for the break down of billing
|
---|
85 | * costs for a workload. The value provided for the identifier will add a label
|
---|
86 | * to the workload and contained projects with the identifier as the value.
|
---|
87 | * @return GoogleLongrunningOperation
|
---|
88 | * @throws \Google\Service\Exception
|
---|
89 | */
|
---|
90 | public function create($parent, GoogleCloudAssuredworkloadsV1Workload $postBody, $optParams = [])
|
---|
91 | {
|
---|
92 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
93 | $params = array_merge($params, $optParams);
|
---|
94 | return $this->call('create', [$params], GoogleLongrunningOperation::class);
|
---|
95 | }
|
---|
96 | /**
|
---|
97 | * Deletes the workload. Make sure that workload's direct children are already
|
---|
98 | * in a deleted state, otherwise the request will fail with a
|
---|
99 | * FAILED_PRECONDITION error. In addition to assuredworkloads.workload.delete
|
---|
100 | * permission, the user should also have orgpolicy.policy.set permission on the
|
---|
101 | * deleted folder to remove Assured Workloads OrgPolicies. (workloads.delete)
|
---|
102 | *
|
---|
103 | * @param string $name Required. The `name` field is used to identify the
|
---|
104 | * workload. Format:
|
---|
105 | * organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
|
---|
106 | * @param array $optParams Optional parameters.
|
---|
107 | *
|
---|
108 | * @opt_param string etag Optional. The etag of the workload. If this is
|
---|
109 | * provided, it must match the server's etag.
|
---|
110 | * @return GoogleProtobufEmpty
|
---|
111 | * @throws \Google\Service\Exception
|
---|
112 | */
|
---|
113 | public function delete($name, $optParams = [])
|
---|
114 | {
|
---|
115 | $params = ['name' => $name];
|
---|
116 | $params = array_merge($params, $optParams);
|
---|
117 | return $this->call('delete', [$params], GoogleProtobufEmpty::class);
|
---|
118 | }
|
---|
119 | /**
|
---|
120 | * Enable resource violation monitoring for a workload.
|
---|
121 | * (workloads.enableResourceMonitoring)
|
---|
122 | *
|
---|
123 | * @param string $name Required. The `name` field is used to identify the
|
---|
124 | * workload. Format:
|
---|
125 | * organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
|
---|
126 | * @param array $optParams Optional parameters.
|
---|
127 | * @return GoogleCloudAssuredworkloadsV1EnableResourceMonitoringResponse
|
---|
128 | * @throws \Google\Service\Exception
|
---|
129 | */
|
---|
130 | public function enableResourceMonitoring($name, $optParams = [])
|
---|
131 | {
|
---|
132 | $params = ['name' => $name];
|
---|
133 | $params = array_merge($params, $optParams);
|
---|
134 | return $this->call('enableResourceMonitoring', [$params], GoogleCloudAssuredworkloadsV1EnableResourceMonitoringResponse::class);
|
---|
135 | }
|
---|
136 | /**
|
---|
137 | * Gets Assured Workload associated with a CRM Node (workloads.get)
|
---|
138 | *
|
---|
139 | * @param string $name Required. The resource name of the Workload to fetch.
|
---|
140 | * This is the workloads's relative path in the API, formatted as "organizations
|
---|
141 | * /{organization_id}/locations/{location_id}/workloads/{workload_id}". For
|
---|
142 | * example, "organizations/123/locations/us-east1/workloads/assured-workload-1".
|
---|
143 | * @param array $optParams Optional parameters.
|
---|
144 | * @return GoogleCloudAssuredworkloadsV1Workload
|
---|
145 | * @throws \Google\Service\Exception
|
---|
146 | */
|
---|
147 | public function get($name, $optParams = [])
|
---|
148 | {
|
---|
149 | $params = ['name' => $name];
|
---|
150 | $params = array_merge($params, $optParams);
|
---|
151 | return $this->call('get', [$params], GoogleCloudAssuredworkloadsV1Workload::class);
|
---|
152 | }
|
---|
153 | /**
|
---|
154 | * Lists Assured Workloads under a CRM Node.
|
---|
155 | * (workloads.listOrganizationsLocationsWorkloads)
|
---|
156 | *
|
---|
157 | * @param string $parent Required. Parent Resource to list workloads from. Must
|
---|
158 | * be of the form `organizations/{org_id}/locations/{location}`.
|
---|
159 | * @param array $optParams Optional parameters.
|
---|
160 | *
|
---|
161 | * @opt_param string filter A custom filter for filtering by properties of a
|
---|
162 | * workload. At this time, only filtering by labels is supported.
|
---|
163 | * @opt_param int pageSize Page size.
|
---|
164 | * @opt_param string pageToken Page token returned from previous request. Page
|
---|
165 | * token contains context from previous request. Page token needs to be passed
|
---|
166 | * in the second and following requests.
|
---|
167 | * @return GoogleCloudAssuredworkloadsV1ListWorkloadsResponse
|
---|
168 | * @throws \Google\Service\Exception
|
---|
169 | */
|
---|
170 | public function listOrganizationsLocationsWorkloads($parent, $optParams = [])
|
---|
171 | {
|
---|
172 | $params = ['parent' => $parent];
|
---|
173 | $params = array_merge($params, $optParams);
|
---|
174 | return $this->call('list', [$params], GoogleCloudAssuredworkloadsV1ListWorkloadsResponse::class);
|
---|
175 | }
|
---|
176 | /**
|
---|
177 | * Update the permissions settings for an existing partner workload. For force
|
---|
178 | * updates don't set etag field in the Workload. Only one update operation per
|
---|
179 | * workload can be in progress. (workloads.mutatePartnerPermissions)
|
---|
180 | *
|
---|
181 | * @param string $name Required. The `name` field is used to identify the
|
---|
182 | * workload. Format:
|
---|
183 | * organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
|
---|
184 | * @param GoogleCloudAssuredworkloadsV1MutatePartnerPermissionsRequest $postBody
|
---|
185 | * @param array $optParams Optional parameters.
|
---|
186 | * @return GoogleCloudAssuredworkloadsV1Workload
|
---|
187 | * @throws \Google\Service\Exception
|
---|
188 | */
|
---|
189 | public function mutatePartnerPermissions($name, GoogleCloudAssuredworkloadsV1MutatePartnerPermissionsRequest $postBody, $optParams = [])
|
---|
190 | {
|
---|
191 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
192 | $params = array_merge($params, $optParams);
|
---|
193 | return $this->call('mutatePartnerPermissions', [$params], GoogleCloudAssuredworkloadsV1Workload::class);
|
---|
194 | }
|
---|
195 | /**
|
---|
196 | * Updates an existing workload. Currently allows updating of workload
|
---|
197 | * display_name and labels. For force updates don't set etag field in the
|
---|
198 | * Workload. Only one update operation per workload can be in progress.
|
---|
199 | * (workloads.patch)
|
---|
200 | *
|
---|
201 | * @param string $name Optional. The resource name of the workload. Format:
|
---|
202 | * organizations/{organization}/locations/{location}/workloads/{workload} Read-
|
---|
203 | * only.
|
---|
204 | * @param GoogleCloudAssuredworkloadsV1Workload $postBody
|
---|
205 | * @param array $optParams Optional parameters.
|
---|
206 | *
|
---|
207 | * @opt_param string updateMask Required. The list of fields to be updated.
|
---|
208 | * @return GoogleCloudAssuredworkloadsV1Workload
|
---|
209 | * @throws \Google\Service\Exception
|
---|
210 | */
|
---|
211 | public function patch($name, GoogleCloudAssuredworkloadsV1Workload $postBody, $optParams = [])
|
---|
212 | {
|
---|
213 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
214 | $params = array_merge($params, $optParams);
|
---|
215 | return $this->call('patch', [$params], GoogleCloudAssuredworkloadsV1Workload::class);
|
---|
216 | }
|
---|
217 | /**
|
---|
218 | * Restrict the list of resources allowed in the Workload environment. The
|
---|
219 | * current list of allowed products can be found at
|
---|
220 | * https://cloud.google.com/assured-workloads/docs/supported-products In
|
---|
221 | * addition to assuredworkloads.workload.update permission, the user should also
|
---|
222 | * have orgpolicy.policy.set permission on the folder resource to use this
|
---|
223 | * functionality. (workloads.restrictAllowedResources)
|
---|
224 | *
|
---|
225 | * @param string $name Required. The resource name of the Workload. This is the
|
---|
226 | * workloads's relative path in the API, formatted as "organizations/{organizati
|
---|
227 | * on_id}/locations/{location_id}/workloads/{workload_id}". For example,
|
---|
228 | * "organizations/123/locations/us-east1/workloads/assured-workload-1".
|
---|
229 | * @param GoogleCloudAssuredworkloadsV1RestrictAllowedResourcesRequest $postBody
|
---|
230 | * @param array $optParams Optional parameters.
|
---|
231 | * @return GoogleCloudAssuredworkloadsV1RestrictAllowedResourcesResponse
|
---|
232 | * @throws \Google\Service\Exception
|
---|
233 | */
|
---|
234 | public function restrictAllowedResources($name, GoogleCloudAssuredworkloadsV1RestrictAllowedResourcesRequest $postBody, $optParams = [])
|
---|
235 | {
|
---|
236 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
237 | $params = array_merge($params, $optParams);
|
---|
238 | return $this->call('restrictAllowedResources', [$params], GoogleCloudAssuredworkloadsV1RestrictAllowedResourcesResponse::class);
|
---|
239 | }
|
---|
240 | }
|
---|
241 |
|
---|
242 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
243 | class_alias(OrganizationsLocationsWorkloads::class, 'Google_Service_Assuredworkloads_Resource_OrganizationsLocationsWorkloads');
|
---|