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\Dns\Resource;
19
20use Google\Service\Dns\PoliciesListResponse;
21use Google\Service\Dns\PoliciesPatchResponse;
22use Google\Service\Dns\PoliciesUpdateResponse;
23use Google\Service\Dns\Policy;
24
25/**
26 * The "policies" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $dnsService = new Google\Service\Dns(...);
30 *   $policies = $dnsService->policies;
31 *  </code>
32 */
33class Policies extends \Google\Service\Resource
34{
35  /**
36   * Creates a new Policy. (policies.create)
37   *
38   * @param string $project Identifies the project addressed by this request.
39   * @param string $location Specifies the location of the resource. This
40   * information will be used for routing and will be part of the resource name.
41   * @param Policy $postBody
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string clientOperationId For mutating operation requests only. An
45   * optional identifier specified by the client. Must be unique for operation
46   * resources in the Operations collection.
47   * @return Policy
48   */
49  public function create($project, $location, Policy $postBody, $optParams = [])
50  {
51    $params = ['project' => $project, 'location' => $location, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], Policy::class);
54  }
55  /**
56   * Deletes a previously created Policy. Fails if the policy is still being
57   * referenced by a network. (policies.delete)
58   *
59   * @param string $project Identifies the project addressed by this request.
60   * @param string $location Specifies the location of the resource. This
61   * information will be used for routing and will be part of the resource name.
62   * @param string $policy User given friendly name of the policy addressed by
63   * this request.
64   * @param array $optParams Optional parameters.
65   *
66   * @opt_param string clientOperationId For mutating operation requests only. An
67   * optional identifier specified by the client. Must be unique for operation
68   * resources in the Operations collection.
69   */
70  public function delete($project, $location, $policy, $optParams = [])
71  {
72    $params = ['project' => $project, 'location' => $location, 'policy' => $policy];
73    $params = array_merge($params, $optParams);
74    return $this->call('delete', [$params]);
75  }
76  /**
77   * Fetches the representation of an existing Policy. (policies.get)
78   *
79   * @param string $project Identifies the project addressed by this request.
80   * @param string $location Specifies the location of the resource. This
81   * information will be used for routing and will be part of the resource name.
82   * @param string $policy User given friendly name of the policy addressed by
83   * this request.
84   * @param array $optParams Optional parameters.
85   *
86   * @opt_param string clientOperationId For mutating operation requests only. An
87   * optional identifier specified by the client. Must be unique for operation
88   * resources in the Operations collection.
89   * @return Policy
90   */
91  public function get($project, $location, $policy, $optParams = [])
92  {
93    $params = ['project' => $project, 'location' => $location, 'policy' => $policy];
94    $params = array_merge($params, $optParams);
95    return $this->call('get', [$params], Policy::class);
96  }
97  /**
98   * Enumerates all Policies associated with a project. (policies.listPolicies)
99   *
100   * @param string $project Identifies the project addressed by this request.
101   * @param string $location Specifies the location of the resource. This
102   * information will be used for routing and will be part of the resource name.
103   * @param array $optParams Optional parameters.
104   *
105   * @opt_param int maxResults Optional. Maximum number of results to be returned.
106   * If unspecified, the server decides how many results to return.
107   * @opt_param string pageToken Optional. A tag returned by a previous list
108   * request that was truncated. Use this parameter to continue a previous list
109   * request.
110   * @return PoliciesListResponse
111   */
112  public function listPolicies($project, $location, $optParams = [])
113  {
114    $params = ['project' => $project, 'location' => $location];
115    $params = array_merge($params, $optParams);
116    return $this->call('list', [$params], PoliciesListResponse::class);
117  }
118  /**
119   * Applies a partial update to an existing Policy. (policies.patch)
120   *
121   * @param string $project Identifies the project addressed by this request.
122   * @param string $location Specifies the location of the resource. This
123   * information will be used for routing and will be part of the resource name.
124   * @param string $policy User given friendly name of the policy addressed by
125   * this request.
126   * @param Policy $postBody
127   * @param array $optParams Optional parameters.
128   *
129   * @opt_param string clientOperationId For mutating operation requests only. An
130   * optional identifier specified by the client. Must be unique for operation
131   * resources in the Operations collection.
132   * @return PoliciesPatchResponse
133   */
134  public function patch($project, $location, $policy, Policy $postBody, $optParams = [])
135  {
136    $params = ['project' => $project, 'location' => $location, 'policy' => $policy, 'postBody' => $postBody];
137    $params = array_merge($params, $optParams);
138    return $this->call('patch', [$params], PoliciesPatchResponse::class);
139  }
140  /**
141   * Updates an existing Policy. (policies.update)
142   *
143   * @param string $project Identifies the project addressed by this request.
144   * @param string $location Specifies the location of the resource. This
145   * information will be used for routing and will be part of the resource name.
146   * @param string $policy User given friendly name of the policy addressed by
147   * this request.
148   * @param Policy $postBody
149   * @param array $optParams Optional parameters.
150   *
151   * @opt_param string clientOperationId For mutating operation requests only. An
152   * optional identifier specified by the client. Must be unique for operation
153   * resources in the Operations collection.
154   * @return PoliciesUpdateResponse
155   */
156  public function update($project, $location, $policy, Policy $postBody, $optParams = [])
157  {
158    $params = ['project' => $project, 'location' => $location, 'policy' => $policy, 'postBody' => $postBody];
159    $params = array_merge($params, $optParams);
160    return $this->call('update', [$params], PoliciesUpdateResponse::class);
161  }
162}
163
164// Adding a class alias for backwards compatibility with the previous class name.
165class_alias(Policies::class, 'Google_Service_Dns_Resource_Policies');
166