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\Compute\Resource;
19
20use Google\Service\Compute\Operation;
21use Google\Service\Compute\SecurityPolicy;
22use Google\Service\Compute\SecurityPolicyList;
23
24/**
25 * The "regionSecurityPolicies" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $computeService = new Google\Service\Compute(...);
29 *   $regionSecurityPolicies = $computeService->regionSecurityPolicies;
30 *  </code>
31 */
32class RegionSecurityPolicies extends \Google\Service\Resource
33{
34  /**
35   * Deletes the specified policy. (regionSecurityPolicies.delete)
36   *
37   * @param string $project Project ID for this request.
38   * @param string $region Name of the region scoping this request.
39   * @param string $securityPolicy Name of the security policy to delete.
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param string requestId An optional request ID to identify requests.
43   * Specify a unique request ID so that if you must retry your request, the
44   * server will know to ignore the request if it has already been completed. For
45   * example, consider a situation where you make an initial request and the
46   * request times out. If you make the request again with the same request ID,
47   * the server can check if original operation with the same request ID was
48   * received, and if so, will ignore the second request. This prevents clients
49   * from accidentally creating duplicate commitments. The request ID must be a
50   * valid UUID with the exception that zero UUID is not supported (
51   * 00000000-0000-0000-0000-000000000000).
52   * @return Operation
53   */
54  public function delete($project, $region, $securityPolicy, $optParams = [])
55  {
56    $params = ['project' => $project, 'region' => $region, 'securityPolicy' => $securityPolicy];
57    $params = array_merge($params, $optParams);
58    return $this->call('delete', [$params], Operation::class);
59  }
60  /**
61   * List all of the ordered rules present in a single specified policy.
62   * (regionSecurityPolicies.get)
63   *
64   * @param string $project Project ID for this request.
65   * @param string $region Name of the region scoping this request.
66   * @param string $securityPolicy Name of the security policy to get.
67   * @param array $optParams Optional parameters.
68   * @return SecurityPolicy
69   */
70  public function get($project, $region, $securityPolicy, $optParams = [])
71  {
72    $params = ['project' => $project, 'region' => $region, 'securityPolicy' => $securityPolicy];
73    $params = array_merge($params, $optParams);
74    return $this->call('get', [$params], SecurityPolicy::class);
75  }
76  /**
77   * Creates a new policy in the specified project using the data included in the
78   * request. (regionSecurityPolicies.insert)
79   *
80   * @param string $project Project ID for this request.
81   * @param string $region Name of the region scoping this request.
82   * @param SecurityPolicy $postBody
83   * @param array $optParams Optional parameters.
84   *
85   * @opt_param string requestId An optional request ID to identify requests.
86   * Specify a unique request ID so that if you must retry your request, the
87   * server will know to ignore the request if it has already been completed. For
88   * example, consider a situation where you make an initial request and the
89   * request times out. If you make the request again with the same request ID,
90   * the server can check if original operation with the same request ID was
91   * received, and if so, will ignore the second request. This prevents clients
92   * from accidentally creating duplicate commitments. The request ID must be a
93   * valid UUID with the exception that zero UUID is not supported (
94   * 00000000-0000-0000-0000-000000000000).
95   * @opt_param bool validateOnly If true, the request will not be committed.
96   * @return Operation
97   */
98  public function insert($project, $region, SecurityPolicy $postBody, $optParams = [])
99  {
100    $params = ['project' => $project, 'region' => $region, 'postBody' => $postBody];
101    $params = array_merge($params, $optParams);
102    return $this->call('insert', [$params], Operation::class);
103  }
104  /**
105   * List all the policies that have been configured for the specified project and
106   * region. (regionSecurityPolicies.listRegionSecurityPolicies)
107   *
108   * @param string $project Project ID for this request.
109   * @param string $region Name of the region scoping this request.
110   * @param array $optParams Optional parameters.
111   *
112   * @opt_param string filter A filter expression that filters resources listed in
113   * the response. The expression must specify the field name, an operator, and
114   * the value that you want to use for filtering. The value must be a string, a
115   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
116   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
117   * can exclude instances named `example-instance` by specifying `name !=
118   * example-instance`. The `:` operator can be used with string fields to match
119   * substrings. For non-string fields it is equivalent to the `=` operator. The
120   * `:*` comparison can be used to test whether a key has been defined. For
121   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
122   * You can also filter nested fields. For example, you could specify
123   * `scheduling.automaticRestart = false` to include instances only if they are
124   * not scheduled for automatic restarts. You can use filtering on nested fields
125   * to filter based on resource labels. To filter on multiple expressions,
126   * provide each separate expression within parentheses. For example: ```
127   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
128   * default, each expression is an `AND` expression. However, you can include
129   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
130   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
131   * (scheduling.automaticRestart = true) ```
132   * @opt_param string maxResults The maximum number of results per page that
133   * should be returned. If the number of available results is larger than
134   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
135   * get the next page of results in subsequent list requests. Acceptable values
136   * are `0` to `500`, inclusive. (Default: `500`)
137   * @opt_param string orderBy Sorts list results by a certain order. By default,
138   * results are returned in alphanumerical order based on the resource name. You
139   * can also sort results in descending order based on the creation timestamp
140   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
141   * `creationTimestamp` field in reverse chronological order (newest result
142   * first). Use this to sort resources like operations so that the newest
143   * operation is returned first. Currently, only sorting by `name` or
144   * `creationTimestamp desc` is supported.
145   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
146   * the `nextPageToken` returned by a previous list request to get the next page
147   * of results.
148   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
149   * which provides partial results in case of failure. The default value is
150   * false.
151   * @return SecurityPolicyList
152   */
153  public function listRegionSecurityPolicies($project, $region, $optParams = [])
154  {
155    $params = ['project' => $project, 'region' => $region];
156    $params = array_merge($params, $optParams);
157    return $this->call('list', [$params], SecurityPolicyList::class);
158  }
159  /**
160   * Patches the specified policy with the data included in the request.
161   * (regionSecurityPolicies.patch)
162   *
163   * @param string $project Project ID for this request.
164   * @param string $region Name of the region scoping this request.
165   * @param string $securityPolicy Name of the security policy to update.
166   * @param SecurityPolicy $postBody
167   * @param array $optParams Optional parameters.
168   *
169   * @opt_param string requestId An optional request ID to identify requests.
170   * Specify a unique request ID so that if you must retry your request, the
171   * server will know to ignore the request if it has already been completed. For
172   * example, consider a situation where you make an initial request and the
173   * request times out. If you make the request again with the same request ID,
174   * the server can check if original operation with the same request ID was
175   * received, and if so, will ignore the second request. This prevents clients
176   * from accidentally creating duplicate commitments. The request ID must be a
177   * valid UUID with the exception that zero UUID is not supported (
178   * 00000000-0000-0000-0000-000000000000).
179   * @return Operation
180   */
181  public function patch($project, $region, $securityPolicy, SecurityPolicy $postBody, $optParams = [])
182  {
183    $params = ['project' => $project, 'region' => $region, 'securityPolicy' => $securityPolicy, 'postBody' => $postBody];
184    $params = array_merge($params, $optParams);
185    return $this->call('patch', [$params], Operation::class);
186  }
187}
188
189// Adding a class alias for backwards compatibility with the previous class name.
190class_alias(RegionSecurityPolicies::class, 'Google_Service_Compute_Resource_RegionSecurityPolicies');
191