[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\VMwareEngine\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\VMwareEngine\FetchNetworkPolicyExternalAddressesResponse;
|
---|
| 21 | use Google\Service\VMwareEngine\ListNetworkPoliciesResponse;
|
---|
| 22 | use Google\Service\VMwareEngine\NetworkPolicy;
|
---|
| 23 | use Google\Service\VMwareEngine\Operation;
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * The "networkPolicies" collection of methods.
|
---|
| 27 | * Typical usage is:
|
---|
| 28 | * <code>
|
---|
| 29 | * $vmwareengineService = new Google\Service\VMwareEngine(...);
|
---|
| 30 | * $networkPolicies = $vmwareengineService->projects_locations_networkPolicies;
|
---|
| 31 | * </code>
|
---|
| 32 | */
|
---|
| 33 | class ProjectsLocationsNetworkPolicies extends \Google\Service\Resource
|
---|
| 34 | {
|
---|
| 35 | /**
|
---|
| 36 | * Creates a new network policy in a given VMware Engine network of a project
|
---|
| 37 | * and location (region). A new network policy cannot be created if another
|
---|
| 38 | * network policy already exists in the same scope. (networkPolicies.create)
|
---|
| 39 | *
|
---|
| 40 | * @param string $parent Required. The resource name of the location (region) to
|
---|
| 41 | * create the new network policy in. Resource names are schemeless URIs that
|
---|
| 42 | * follow the conventions in
|
---|
| 43 | * https://cloud.google.com/apis/design/resource_names. For example:
|
---|
| 44 | * `projects/my-project/locations/us-central1`
|
---|
| 45 | * @param NetworkPolicy $postBody
|
---|
| 46 | * @param array $optParams Optional parameters.
|
---|
| 47 | *
|
---|
| 48 | * @opt_param string networkPolicyId Required. The user-provided identifier of
|
---|
| 49 | * the network policy to be created. This identifier must be unique within
|
---|
| 50 | * parent `projects/{my-project}/locations/{us-central1}/networkPolicies` and
|
---|
| 51 | * becomes the final token in the name URI. The identifier must meet the
|
---|
| 52 | * following requirements: * Only contains 1-63 alphanumeric characters and
|
---|
| 53 | * hyphens * Begins with an alphabetical character * Ends with a non-hyphen
|
---|
| 54 | * character * Not formatted as a UUID * Complies with [RFC
|
---|
| 55 | * 1034](https://datatracker.ietf.org/doc/html/rfc1034) (section 3.5)
|
---|
| 56 | * @opt_param string requestId Optional. A request ID to identify requests.
|
---|
| 57 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 58 | * server will know to ignore the request if it has already been completed. The
|
---|
| 59 | * server guarantees that a request doesn't result in creation of duplicate
|
---|
| 60 | * commitments for at least 60 minutes. For example, consider a situation where
|
---|
| 61 | * you make an initial request and the request times out. If you make the
|
---|
| 62 | * request again with the same request ID, the server can check if original
|
---|
| 63 | * operation with the same request ID was received, and if so, will ignore the
|
---|
| 64 | * second request. This prevents clients from accidentally creating duplicate
|
---|
| 65 | * commitments. The request ID must be a valid UUID with the exception that zero
|
---|
| 66 | * UUID is not supported (00000000-0000-0000-0000-000000000000).
|
---|
| 67 | * @return Operation
|
---|
| 68 | * @throws \Google\Service\Exception
|
---|
| 69 | */
|
---|
| 70 | public function create($parent, NetworkPolicy $postBody, $optParams = [])
|
---|
| 71 | {
|
---|
| 72 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 73 | $params = array_merge($params, $optParams);
|
---|
| 74 | return $this->call('create', [$params], Operation::class);
|
---|
| 75 | }
|
---|
| 76 | /**
|
---|
| 77 | * Deletes a `NetworkPolicy` resource. A network policy cannot be deleted when
|
---|
| 78 | * `NetworkService.state` is set to `RECONCILING` for either its external IP or
|
---|
| 79 | * internet access service. (networkPolicies.delete)
|
---|
| 80 | *
|
---|
| 81 | * @param string $name Required. The resource name of the network policy to
|
---|
| 82 | * delete. Resource names are schemeless URIs that follow the conventions in
|
---|
| 83 | * https://cloud.google.com/apis/design/resource_names. For example:
|
---|
| 84 | * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy`
|
---|
| 85 | * @param array $optParams Optional parameters.
|
---|
| 86 | *
|
---|
| 87 | * @opt_param string requestId Optional. A request ID to identify requests.
|
---|
| 88 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 89 | * server will know to ignore the request if it has already been completed. The
|
---|
| 90 | * server guarantees that a request doesn't result in creation of duplicate
|
---|
| 91 | * commitments for at least 60 minutes. For example, consider a situation where
|
---|
| 92 | * you make an initial request and the request times out. If you make the
|
---|
| 93 | * request again with the same request ID, the server can check if original
|
---|
| 94 | * operation with the same request ID was received, and if so, will ignore the
|
---|
| 95 | * second request. This prevents clients from accidentally creating duplicate
|
---|
| 96 | * commitments. The request ID must be a valid UUID with the exception that zero
|
---|
| 97 | * UUID is not supported (00000000-0000-0000-0000-000000000000).
|
---|
| 98 | * @return Operation
|
---|
| 99 | * @throws \Google\Service\Exception
|
---|
| 100 | */
|
---|
| 101 | public function delete($name, $optParams = [])
|
---|
| 102 | {
|
---|
| 103 | $params = ['name' => $name];
|
---|
| 104 | $params = array_merge($params, $optParams);
|
---|
| 105 | return $this->call('delete', [$params], Operation::class);
|
---|
| 106 | }
|
---|
| 107 | /**
|
---|
| 108 | * Lists external IP addresses assigned to VMware workload VMs within the scope
|
---|
| 109 | * of the given network policy. (networkPolicies.fetchExternalAddresses)
|
---|
| 110 | *
|
---|
| 111 | * @param string $networkPolicy Required. The resource name of the network
|
---|
| 112 | * policy to query for assigned external IP addresses. Resource names are
|
---|
| 113 | * schemeless URIs that follow the conventions in
|
---|
| 114 | * https://cloud.google.com/apis/design/resource_names. For example:
|
---|
| 115 | * `projects/my-project/locations/us-central1/networkPolicies/my-policy`
|
---|
| 116 | * @param array $optParams Optional parameters.
|
---|
| 117 | *
|
---|
| 118 | * @opt_param int pageSize The maximum number of external IP addresses to return
|
---|
| 119 | * in one page. The service may return fewer than this value. The maximum value
|
---|
| 120 | * is coerced to 1000. The default value of this field is 500.
|
---|
| 121 | * @opt_param string pageToken A page token, received from a previous
|
---|
| 122 | * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the
|
---|
| 123 | * subsequent page. When paginating, all parameters provided to
|
---|
| 124 | * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and
|
---|
| 125 | * `page_token`, must match the call that provided the page token.
|
---|
| 126 | * @return FetchNetworkPolicyExternalAddressesResponse
|
---|
| 127 | * @throws \Google\Service\Exception
|
---|
| 128 | */
|
---|
| 129 | public function fetchExternalAddresses($networkPolicy, $optParams = [])
|
---|
| 130 | {
|
---|
| 131 | $params = ['networkPolicy' => $networkPolicy];
|
---|
| 132 | $params = array_merge($params, $optParams);
|
---|
| 133 | return $this->call('fetchExternalAddresses', [$params], FetchNetworkPolicyExternalAddressesResponse::class);
|
---|
| 134 | }
|
---|
| 135 | /**
|
---|
| 136 | * Retrieves a `NetworkPolicy` resource by its resource name.
|
---|
| 137 | * (networkPolicies.get)
|
---|
| 138 | *
|
---|
| 139 | * @param string $name Required. The resource name of the network policy to
|
---|
| 140 | * retrieve. Resource names are schemeless URIs that follow the conventions in
|
---|
| 141 | * https://cloud.google.com/apis/design/resource_names. For example:
|
---|
| 142 | * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy`
|
---|
| 143 | * @param array $optParams Optional parameters.
|
---|
| 144 | * @return NetworkPolicy
|
---|
| 145 | * @throws \Google\Service\Exception
|
---|
| 146 | */
|
---|
| 147 | public function get($name, $optParams = [])
|
---|
| 148 | {
|
---|
| 149 | $params = ['name' => $name];
|
---|
| 150 | $params = array_merge($params, $optParams);
|
---|
| 151 | return $this->call('get', [$params], NetworkPolicy::class);
|
---|
| 152 | }
|
---|
| 153 | /**
|
---|
| 154 | * Lists `NetworkPolicy` resources in a specified project and location.
|
---|
| 155 | * (networkPolicies.listProjectsLocationsNetworkPolicies)
|
---|
| 156 | *
|
---|
| 157 | * @param string $parent Required. The resource name of the location (region) to
|
---|
| 158 | * query for network policies. Resource names are schemeless URIs that follow
|
---|
| 159 | * the conventions in https://cloud.google.com/apis/design/resource_names. For
|
---|
| 160 | * example: `projects/my-project/locations/us-central1`
|
---|
| 161 | * @param array $optParams Optional parameters.
|
---|
| 162 | *
|
---|
| 163 | * @opt_param string filter A filter expression that matches resources returned
|
---|
| 164 | * in the response. The expression must specify the field name, a comparison
|
---|
| 165 | * operator, and the value that you want to use for filtering. The value must be
|
---|
| 166 | * a string, a number, or a boolean. The comparison operator must be `=`, `!=`,
|
---|
| 167 | * `>`, or `<`. For example, if you are filtering a list of network policies,
|
---|
| 168 | * you can exclude the ones named `example-policy` by specifying `name !=
|
---|
| 169 | * "example-policy"`. To filter on multiple expressions, provide each separate
|
---|
| 170 | * expression within parentheses. For example: ``` (name = "example-policy")
|
---|
| 171 | * (createTime > "2021-04-12T08:15:10.40Z") ``` By default, each expression is
|
---|
| 172 | * an `AND` expression. However, you can include `AND` and `OR` expressions
|
---|
| 173 | * explicitly. For example: ``` (name = "example-policy-1") AND (createTime >
|
---|
| 174 | * "2021-04-12T08:15:10.40Z") OR (name = "example-policy-2") ```
|
---|
| 175 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
| 176 | * returned results are ordered by `name` in ascending order. You can also sort
|
---|
| 177 | * results in descending order based on the `name` value using `orderBy="name
|
---|
| 178 | * desc"`. Currently, only ordering by `name` is supported.
|
---|
| 179 | * @opt_param int pageSize The maximum number of network policies to return in
|
---|
| 180 | * one page. The service may return fewer than this value. The maximum value is
|
---|
| 181 | * coerced to 1000. The default value of this field is 500.
|
---|
| 182 | * @opt_param string pageToken A page token, received from a previous
|
---|
| 183 | * `ListNetworkPolicies` call. Provide this to retrieve the subsequent page.
|
---|
| 184 | * When paginating, all other parameters provided to `ListNetworkPolicies` must
|
---|
| 185 | * match the call that provided the page token.
|
---|
| 186 | * @return ListNetworkPoliciesResponse
|
---|
| 187 | * @throws \Google\Service\Exception
|
---|
| 188 | */
|
---|
| 189 | public function listProjectsLocationsNetworkPolicies($parent, $optParams = [])
|
---|
| 190 | {
|
---|
| 191 | $params = ['parent' => $parent];
|
---|
| 192 | $params = array_merge($params, $optParams);
|
---|
| 193 | return $this->call('list', [$params], ListNetworkPoliciesResponse::class);
|
---|
| 194 | }
|
---|
| 195 | /**
|
---|
| 196 | * Modifies a `NetworkPolicy` resource. Only the following fields can be
|
---|
| 197 | * updated: `internet_access`, `external_ip`, `edge_services_cidr`. Only fields
|
---|
| 198 | * specified in `updateMask` are applied. When updating a network policy, the
|
---|
| 199 | * external IP network service can only be disabled if there are no external IP
|
---|
| 200 | * addresses present in the scope of the policy. Also, a `NetworkService` cannot
|
---|
| 201 | * be updated when `NetworkService.state` is set to `RECONCILING`. During
|
---|
| 202 | * operation processing, the resource is temporarily in the `ACTIVE` state
|
---|
| 203 | * before the operation fully completes. For that period of time, you can't
|
---|
| 204 | * update the resource. Use the operation status to determine when the
|
---|
| 205 | * processing fully completes. (networkPolicies.patch)
|
---|
| 206 | *
|
---|
| 207 | * @param string $name Output only. Identifier. The resource name of this
|
---|
| 208 | * network policy. Resource names are schemeless URIs that follow the
|
---|
| 209 | * conventions in https://cloud.google.com/apis/design/resource_names. For
|
---|
| 210 | * example: `projects/my-project/locations/us-central1/networkPolicies/my-
|
---|
| 211 | * network-policy`
|
---|
| 212 | * @param NetworkPolicy $postBody
|
---|
| 213 | * @param array $optParams Optional parameters.
|
---|
| 214 | *
|
---|
| 215 | * @opt_param string requestId Optional. A request ID to identify requests.
|
---|
| 216 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 217 | * server will know to ignore the request if it has already been completed. The
|
---|
| 218 | * server guarantees that a request doesn't result in creation of duplicate
|
---|
| 219 | * commitments for at least 60 minutes. For example, consider a situation where
|
---|
| 220 | * you make an initial request and the request times out. If you make the
|
---|
| 221 | * request again with the same request ID, the server can check if original
|
---|
| 222 | * operation with the same request ID was received, and if so, will ignore the
|
---|
| 223 | * second request. This prevents clients from accidentally creating duplicate
|
---|
| 224 | * commitments. The request ID must be a valid UUID with the exception that zero
|
---|
| 225 | * UUID is not supported (00000000-0000-0000-0000-000000000000).
|
---|
| 226 | * @opt_param string updateMask Required. Field mask is used to specify the
|
---|
| 227 | * fields to be overwritten in the `NetworkPolicy` resource by the update. The
|
---|
| 228 | * fields specified in the `update_mask` are relative to the resource, not the
|
---|
| 229 | * full request. A field will be overwritten if it is in the mask. If the user
|
---|
| 230 | * does not provide a mask then all fields will be overwritten.
|
---|
| 231 | * @return Operation
|
---|
| 232 | * @throws \Google\Service\Exception
|
---|
| 233 | */
|
---|
| 234 | public function patch($name, NetworkPolicy $postBody, $optParams = [])
|
---|
| 235 | {
|
---|
| 236 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 237 | $params = array_merge($params, $optParams);
|
---|
| 238 | return $this->call('patch', [$params], Operation::class);
|
---|
| 239 | }
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 243 | class_alias(ProjectsLocationsNetworkPolicies::class, 'Google_Service_VMwareEngine_Resource_ProjectsLocationsNetworkPolicies');
|
---|