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\Assuredworkloads\Resource;
19
20use Google\Service\Assuredworkloads\GoogleCloudAssuredworkloadsV1ListWorkloadsResponse;
21use Google\Service\Assuredworkloads\GoogleCloudAssuredworkloadsV1Workload;
22use Google\Service\Assuredworkloads\GoogleLongrunningOperation;
23use Google\Service\Assuredworkloads\GoogleProtobufEmpty;
24
25/**
26 * The "workloads" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $assuredworkloadsService = new Google\Service\Assuredworkloads(...);
30 *   $workloads = $assuredworkloadsService->workloads;
31 *  </code>
32 */
33class OrganizationsLocationsWorkloads extends \Google\Service\Resource
34{
35  /**
36   * Creates Assured Workload. (workloads.create)
37   *
38   * @param string $parent Required. The resource name of the new Workload's
39   * parent. Must be of the form `organizations/{org_id}/locations/{location_id}`.
40   * @param GoogleCloudAssuredworkloadsV1Workload $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string externalId Optional. A identifier associated with the
44   * workload and underlying projects which allows for the break down of billing
45   * costs for a workload. The value provided for the identifier will add a label
46   * to the workload and contained projects with the identifier as the value.
47   * @return GoogleLongrunningOperation
48   */
49  public function create($parent, GoogleCloudAssuredworkloadsV1Workload $postBody, $optParams = [])
50  {
51    $params = ['parent' => $parent, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], GoogleLongrunningOperation::class);
54  }
55  /**
56   * Deletes the workload. Make sure that workload's direct children are already
57   * in a deleted state, otherwise the request will fail with a
58   * FAILED_PRECONDITION error. (workloads.delete)
59   *
60   * @param string $name Required. The `name` field is used to identify the
61   * workload. Format:
62   * organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
63   * @param array $optParams Optional parameters.
64   *
65   * @opt_param string etag Optional. The etag of the workload. If this is
66   * provided, it must match the server's etag.
67   * @return GoogleProtobufEmpty
68   */
69  public function delete($name, $optParams = [])
70  {
71    $params = ['name' => $name];
72    $params = array_merge($params, $optParams);
73    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
74  }
75  /**
76   * Gets Assured Workload associated with a CRM Node (workloads.get)
77   *
78   * @param string $name Required. The resource name of the Workload to fetch.
79   * This is the workloads's relative path in the API, formatted as "organizations
80   * /{organization_id}/locations/{location_id}/workloads/{workload_id}". For
81   * example, "organizations/123/locations/us-east1/workloads/assured-workload-1".
82   * @param array $optParams Optional parameters.
83   * @return GoogleCloudAssuredworkloadsV1Workload
84   */
85  public function get($name, $optParams = [])
86  {
87    $params = ['name' => $name];
88    $params = array_merge($params, $optParams);
89    return $this->call('get', [$params], GoogleCloudAssuredworkloadsV1Workload::class);
90  }
91  /**
92   * Lists Assured Workloads under a CRM Node.
93   * (workloads.listOrganizationsLocationsWorkloads)
94   *
95   * @param string $parent Required. Parent Resource to list workloads from. Must
96   * be of the form `organizations/{org_id}/locations/{location}`.
97   * @param array $optParams Optional parameters.
98   *
99   * @opt_param string filter A custom filter for filtering by properties of a
100   * workload. At this time, only filtering by labels is supported.
101   * @opt_param int pageSize Page size.
102   * @opt_param string pageToken Page token returned from previous request. Page
103   * token contains context from previous request. Page token needs to be passed
104   * in the second and following requests.
105   * @return GoogleCloudAssuredworkloadsV1ListWorkloadsResponse
106   */
107  public function listOrganizationsLocationsWorkloads($parent, $optParams = [])
108  {
109    $params = ['parent' => $parent];
110    $params = array_merge($params, $optParams);
111    return $this->call('list', [$params], GoogleCloudAssuredworkloadsV1ListWorkloadsResponse::class);
112  }
113  /**
114   * Updates an existing workload. Currently allows updating of workload
115   * display_name and labels. For force updates don't set etag field in the
116   * Workload. Only one update operation per workload can be in progress.
117   * (workloads.patch)
118   *
119   * @param string $name Optional. The resource name of the workload. Format:
120   * organizations/{organization}/locations/{location}/workloads/{workload} Read-
121   * only.
122   * @param GoogleCloudAssuredworkloadsV1Workload $postBody
123   * @param array $optParams Optional parameters.
124   *
125   * @opt_param string updateMask Required. The list of fields to be updated.
126   * @return GoogleCloudAssuredworkloadsV1Workload
127   */
128  public function patch($name, GoogleCloudAssuredworkloadsV1Workload $postBody, $optParams = [])
129  {
130    $params = ['name' => $name, 'postBody' => $postBody];
131    $params = array_merge($params, $optParams);
132    return $this->call('patch', [$params], GoogleCloudAssuredworkloadsV1Workload::class);
133  }
134}
135
136// Adding a class alias for backwards compatibility with the previous class name.
137class_alias(OrganizationsLocationsWorkloads::class, 'Google_Service_Assuredworkloads_Resource_OrganizationsLocationsWorkloads');
138