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\CloudKMS\Resource;
19
20use Google\Service\CloudKMS\GenerateRandomBytesRequest;
21use Google\Service\CloudKMS\GenerateRandomBytesResponse;
22use Google\Service\CloudKMS\ListLocationsResponse;
23use Google\Service\CloudKMS\Location;
24
25/**
26 * The "locations" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $cloudkmsService = new Google\Service\CloudKMS(...);
30 *   $locations = $cloudkmsService->locations;
31 *  </code>
32 */
33class ProjectsLocations extends \Google\Service\Resource
34{
35  /**
36   * Generate random bytes using the Cloud KMS randomness source in the provided
37   * location. (locations.generateRandomBytes)
38   *
39   * @param string $location The project-specific location in which to generate
40   * random bytes. For example, "projects/my-project/locations/us-central1".
41   * @param GenerateRandomBytesRequest $postBody
42   * @param array $optParams Optional parameters.
43   * @return GenerateRandomBytesResponse
44   */
45  public function generateRandomBytes($location, GenerateRandomBytesRequest $postBody, $optParams = [])
46  {
47    $params = ['location' => $location, 'postBody' => $postBody];
48    $params = array_merge($params, $optParams);
49    return $this->call('generateRandomBytes', [$params], GenerateRandomBytesResponse::class);
50  }
51  /**
52   * Gets information about a location. (locations.get)
53   *
54   * @param string $name Resource name for the location.
55   * @param array $optParams Optional parameters.
56   * @return Location
57   */
58  public function get($name, $optParams = [])
59  {
60    $params = ['name' => $name];
61    $params = array_merge($params, $optParams);
62    return $this->call('get', [$params], Location::class);
63  }
64  /**
65   * Lists information about the supported locations for this service.
66   * (locations.listProjectsLocations)
67   *
68   * @param string $name The resource that owns the locations collection, if
69   * applicable.
70   * @param array $optParams Optional parameters.
71   *
72   * @opt_param string filter A filter to narrow down results to a preferred
73   * subset. The filtering language accepts strings like `"displayName=tokyo"`,
74   * and is documented in more detail in [AIP-160](https://google.aip.dev/160).
75   * @opt_param int pageSize The maximum number of results to return. If not set,
76   * the service selects a default.
77   * @opt_param string pageToken A page token received from the `next_page_token`
78   * field in the response. Send that page token to receive the subsequent page.
79   * @return ListLocationsResponse
80   */
81  public function listProjectsLocations($name, $optParams = [])
82  {
83    $params = ['name' => $name];
84    $params = array_merge($params, $optParams);
85    return $this->call('list', [$params], ListLocationsResponse::class);
86  }
87}
88
89// Adding a class alias for backwards compatibility with the previous class name.
90class_alias(ProjectsLocations::class, 'Google_Service_CloudKMS_Resource_ProjectsLocations');
91