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\ImportJob;
21use Google\Service\CloudKMS\ListImportJobsResponse;
22use Google\Service\CloudKMS\Policy;
23use Google\Service\CloudKMS\SetIamPolicyRequest;
24use Google\Service\CloudKMS\TestIamPermissionsRequest;
25use Google\Service\CloudKMS\TestIamPermissionsResponse;
26
27/**
28 * The "importJobs" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $cloudkmsService = new Google\Service\CloudKMS(...);
32 *   $importJobs = $cloudkmsService->importJobs;
33 *  </code>
34 */
35class ProjectsLocationsKeyRingsImportJobs extends \Google\Service\Resource
36{
37  /**
38   * Create a new ImportJob within a KeyRing. ImportJob.import_method is required.
39   * (importJobs.create)
40   *
41   * @param string $parent Required. The name of the KeyRing associated with the
42   * ImportJobs.
43   * @param ImportJob $postBody
44   * @param array $optParams Optional parameters.
45   *
46   * @opt_param string importJobId Required. It must be unique within a KeyRing
47   * and match the regular expression `[a-zA-Z0-9_-]{1,63}`
48   * @return ImportJob
49   */
50  public function create($parent, ImportJob $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], ImportJob::class);
55  }
56  /**
57   * Returns metadata for a given ImportJob. (importJobs.get)
58   *
59   * @param string $name Required. The name of the ImportJob to get.
60   * @param array $optParams Optional parameters.
61   * @return ImportJob
62   */
63  public function get($name, $optParams = [])
64  {
65    $params = ['name' => $name];
66    $params = array_merge($params, $optParams);
67    return $this->call('get', [$params], ImportJob::class);
68  }
69  /**
70   * Gets the access control policy for a resource. Returns an empty policy if the
71   * resource exists and does not have a policy set. (importJobs.getIamPolicy)
72   *
73   * @param string $resource REQUIRED: The resource for which the policy is being
74   * requested. See the operation documentation for the appropriate value for this
75   * field.
76   * @param array $optParams Optional parameters.
77   *
78   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
79   * version that will be used to format the policy. Valid values are 0, 1, and 3.
80   * Requests specifying an invalid value will be rejected. Requests for policies
81   * with any conditional role bindings must specify version 3. Policies with no
82   * conditional role bindings may specify any valid value or leave the field
83   * unset. The policy in the response might use the policy version that you
84   * specified, or it might use a lower policy version. For example, if you
85   * specify version 3, but the policy has no conditional role bindings, the
86   * response uses version 1. To learn which resources support conditions in their
87   * IAM policies, see the [IAM
88   * documentation](https://cloud.google.com/iam/help/conditions/resource-
89   * policies).
90   * @return Policy
91   */
92  public function getIamPolicy($resource, $optParams = [])
93  {
94    $params = ['resource' => $resource];
95    $params = array_merge($params, $optParams);
96    return $this->call('getIamPolicy', [$params], Policy::class);
97  }
98  /**
99   * Lists ImportJobs. (importJobs.listProjectsLocationsKeyRingsImportJobs)
100   *
101   * @param string $parent Required. The resource name of the KeyRing to list, in
102   * the format `projects/locations/keyRings`.
103   * @param array $optParams Optional parameters.
104   *
105   * @opt_param string filter Optional. Only include resources that match the
106   * filter in the response. For more information, see [Sorting and filtering list
107   * results](https://cloud.google.com/kms/docs/sorting-and-filtering).
108   * @opt_param string orderBy Optional. Specify how the results should be sorted.
109   * If not specified, the results will be sorted in the default order. For more
110   * information, see [Sorting and filtering list
111   * results](https://cloud.google.com/kms/docs/sorting-and-filtering).
112   * @opt_param int pageSize Optional. Optional limit on the number of ImportJobs
113   * to include in the response. Further ImportJobs can subsequently be obtained
114   * by including the ListImportJobsResponse.next_page_token in a subsequent
115   * request. If unspecified, the server will pick an appropriate default.
116   * @opt_param string pageToken Optional. Optional pagination token, returned
117   * earlier via ListImportJobsResponse.next_page_token.
118   * @return ListImportJobsResponse
119   */
120  public function listProjectsLocationsKeyRingsImportJobs($parent, $optParams = [])
121  {
122    $params = ['parent' => $parent];
123    $params = array_merge($params, $optParams);
124    return $this->call('list', [$params], ListImportJobsResponse::class);
125  }
126  /**
127   * Sets the access control policy on the specified resource. Replaces any
128   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
129   * `PERMISSION_DENIED` errors. (importJobs.setIamPolicy)
130   *
131   * @param string $resource REQUIRED: The resource for which the policy is being
132   * specified. See the operation documentation for the appropriate value for this
133   * field.
134   * @param SetIamPolicyRequest $postBody
135   * @param array $optParams Optional parameters.
136   * @return Policy
137   */
138  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
139  {
140    $params = ['resource' => $resource, 'postBody' => $postBody];
141    $params = array_merge($params, $optParams);
142    return $this->call('setIamPolicy', [$params], Policy::class);
143  }
144  /**
145   * Returns permissions that a caller has on the specified resource. If the
146   * resource does not exist, this will return an empty set of permissions, not a
147   * `NOT_FOUND` error. Note: This operation is designed to be used for building
148   * permission-aware UIs and command-line tools, not for authorization checking.
149   * This operation may "fail open" without warning.
150   * (importJobs.testIamPermissions)
151   *
152   * @param string $resource REQUIRED: The resource for which the policy detail is
153   * being requested. See the operation documentation for the appropriate value
154   * for this field.
155   * @param TestIamPermissionsRequest $postBody
156   * @param array $optParams Optional parameters.
157   * @return TestIamPermissionsResponse
158   */
159  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
160  {
161    $params = ['resource' => $resource, 'postBody' => $postBody];
162    $params = array_merge($params, $optParams);
163    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
164  }
165}
166
167// Adding a class alias for backwards compatibility with the previous class name.
168class_alias(ProjectsLocationsKeyRingsImportJobs::class, 'Google_Service_CloudKMS_Resource_ProjectsLocationsKeyRingsImportJobs');
169