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\ServiceNetworking\Resource;
19
20use Google\Service\ServiceNetworking\AddSubnetworkRequest;
21use Google\Service\ServiceNetworking\DisableVpcServiceControlsRequest;
22use Google\Service\ServiceNetworking\EnableVpcServiceControlsRequest;
23use Google\Service\ServiceNetworking\Operation;
24use Google\Service\ServiceNetworking\SearchRangeRequest;
25use Google\Service\ServiceNetworking\ValidateConsumerConfigRequest;
26use Google\Service\ServiceNetworking\ValidateConsumerConfigResponse;
27
28/**
29 * The "services" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $servicenetworkingService = new Google\Service\ServiceNetworking(...);
33 *   $services = $servicenetworkingService->services;
34 *  </code>
35 */
36class Services extends \Google\Service\Resource
37{
38  /**
39   * For service producers, provisions a new subnet in a peered service's shared
40   * VPC network in the requested region and with the requested size that's
41   * expressed as a CIDR range (number of leading bits of ipV4 network mask). The
42   * method checks against the assigned allocated ranges to find a non-conflicting
43   * IP address range. The method will reuse a subnet if subsequent calls contain
44   * the same subnet name, region, and prefix length. This method will make
45   * producer's tenant project to be a shared VPC service project as needed.
46   * (services.addSubnetwork)
47   *
48   * @param string $parent Required. A tenant project in the service producer
49   * organization, in the following format: services/{service}/{collection-id
50   * }/{resource-id}. {collection-id} is the cloud resource collection type that
51   * represents the tenant project. Only `projects` are supported. {resource-id}
52   * is the tenant project numeric id, such as `123456`. {service} the name of the
53   * peering service, such as `service-peering.example.com`. This service must
54   * already be enabled in the service consumer's project.
55   * @param AddSubnetworkRequest $postBody
56   * @param array $optParams Optional parameters.
57   * @return Operation
58   */
59  public function addSubnetwork($parent, AddSubnetworkRequest $postBody, $optParams = [])
60  {
61    $params = ['parent' => $parent, 'postBody' => $postBody];
62    $params = array_merge($params, $optParams);
63    return $this->call('addSubnetwork', [$params], Operation::class);
64  }
65  /**
66   * Disables VPC service controls for a connection.
67   * (services.disableVpcServiceControls)
68   *
69   * @param string $parent The service that is managing peering connectivity for a
70   * service producer's organization. For Google services that support this
71   * functionality, this value is `services/servicenetworking.googleapis.com`.
72   * @param DisableVpcServiceControlsRequest $postBody
73   * @param array $optParams Optional parameters.
74   * @return Operation
75   */
76  public function disableVpcServiceControls($parent, DisableVpcServiceControlsRequest $postBody, $optParams = [])
77  {
78    $params = ['parent' => $parent, 'postBody' => $postBody];
79    $params = array_merge($params, $optParams);
80    return $this->call('disableVpcServiceControls', [$params], Operation::class);
81  }
82  /**
83   * Enables VPC service controls for a connection.
84   * (services.enableVpcServiceControls)
85   *
86   * @param string $parent The service that is managing peering connectivity for a
87   * service producer's organization. For Google services that support this
88   * functionality, this value is `services/servicenetworking.googleapis.com`.
89   * @param EnableVpcServiceControlsRequest $postBody
90   * @param array $optParams Optional parameters.
91   * @return Operation
92   */
93  public function enableVpcServiceControls($parent, EnableVpcServiceControlsRequest $postBody, $optParams = [])
94  {
95    $params = ['parent' => $parent, 'postBody' => $postBody];
96    $params = array_merge($params, $optParams);
97    return $this->call('enableVpcServiceControls', [$params], Operation::class);
98  }
99  /**
100   * Service producers can use this method to find a currently unused range within
101   * consumer allocated ranges. This returned range is not reserved, and not
102   * guaranteed to remain unused. It will validate previously provided allocated
103   * ranges, find non-conflicting sub-range of requested size (expressed in number
104   * of leading bits of ipv4 network mask, as in CIDR range notation).
105   * (services.searchRange)
106   *
107   * @param string $parent Required. This is in a form services/{service}.
108   * {service} the name of the private access management service, for example
109   * 'service-peering.example.com'.
110   * @param SearchRangeRequest $postBody
111   * @param array $optParams Optional parameters.
112   * @return Operation
113   */
114  public function searchRange($parent, SearchRangeRequest $postBody, $optParams = [])
115  {
116    $params = ['parent' => $parent, 'postBody' => $postBody];
117    $params = array_merge($params, $optParams);
118    return $this->call('searchRange', [$params], Operation::class);
119  }
120  /**
121   * Service producers use this method to validate if the consumer provided
122   * network, project and requested range are valid. This allows them to use a
123   * fail-fast mechanism for consumer requests, and not have to wait for
124   * AddSubnetwork operation completion to determine if user request is invalid.
125   * (services.validate)
126   *
127   * @param string $parent Required. This is in a form services/{service} where
128   * {service} is the name of the private access management service. For example
129   * 'service-peering.example.com'.
130   * @param ValidateConsumerConfigRequest $postBody
131   * @param array $optParams Optional parameters.
132   * @return ValidateConsumerConfigResponse
133   */
134  public function validate($parent, ValidateConsumerConfigRequest $postBody, $optParams = [])
135  {
136    $params = ['parent' => $parent, 'postBody' => $postBody];
137    $params = array_merge($params, $optParams);
138    return $this->call('validate', [$params], ValidateConsumerConfigResponse::class);
139  }
140}
141
142// Adding a class alias for backwards compatibility with the previous class name.
143class_alias(Services::class, 'Google_Service_ServiceNetworking_Resource_Services');
144