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\Connection;
21use Google\Service\ServiceNetworking\DeleteConnectionRequest;
22use Google\Service\ServiceNetworking\ListConnectionsResponse;
23use Google\Service\ServiceNetworking\Operation;
24
25/**
26 * The "connections" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $servicenetworkingService = new Google\Service\ServiceNetworking(...);
30 *   $connections = $servicenetworkingService->connections;
31 *  </code>
32 */
33class ServicesConnections extends \Google\Service\Resource
34{
35  /**
36   * Creates a private connection that establishes a VPC Network Peering
37   * connection to a VPC network in the service producer's organization. The
38   * administrator of the service consumer's VPC network invokes this method. The
39   * administrator must assign one or more allocated IP ranges for provisioning
40   * subnetworks in the service producer's VPC network. This connection is used
41   * for all supported services in the service producer's organization, so it only
42   * needs to be invoked once. (connections.create)
43   *
44   * @param string $parent The service that is managing peering connectivity for a
45   * service producer's organization. For Google services that support this
46   * functionality, this value is `services/servicenetworking.googleapis.com`.
47   * @param Connection $postBody
48   * @param array $optParams Optional parameters.
49   * @return Operation
50   */
51  public function create($parent, Connection $postBody, $optParams = [])
52  {
53    $params = ['parent' => $parent, 'postBody' => $postBody];
54    $params = array_merge($params, $optParams);
55    return $this->call('create', [$params], Operation::class);
56  }
57  /**
58   * Deletes a private service access connection. (connections.deleteConnection)
59   *
60   * @param string $name Required. The private service connection that connects to
61   * a service producer organization. The name includes both the private service
62   * name and the VPC network peering name in the format of
63   * `services/{peering_service_name}/connections/{vpc_peering_name}`. For Google
64   * services that support this functionality, this is
65   * `services/servicenetworking.googleapis.com/connections/servicenetworking-
66   * googleapis-com`.
67   * @param DeleteConnectionRequest $postBody
68   * @param array $optParams Optional parameters.
69   * @return Operation
70   */
71  public function deleteConnection($name, DeleteConnectionRequest $postBody, $optParams = [])
72  {
73    $params = ['name' => $name, 'postBody' => $postBody];
74    $params = array_merge($params, $optParams);
75    return $this->call('deleteConnection', [$params], Operation::class);
76  }
77  /**
78   * List the private connections that are configured in a service consumer's VPC
79   * network. (connections.listServicesConnections)
80   *
81   * @param string $parent The service that is managing peering connectivity for a
82   * service producer's organization. For Google services that support this
83   * functionality, this value is `services/servicenetworking.googleapis.com`. If
84   * you specify `services/-` as the parameter value, all configured peering
85   * services are listed.
86   * @param array $optParams Optional parameters.
87   *
88   * @opt_param string network The name of service consumer's VPC network that's
89   * connected with service producer network through a private connection. The
90   * network name must be in the following format:
91   * `projects/{project}/global/networks/{network}`. {project} is a project
92   * number, such as in `12345` that includes the VPC service consumer's VPC
93   * network. {network} is the name of the service consumer's VPC network.
94   * @return ListConnectionsResponse
95   */
96  public function listServicesConnections($parent, $optParams = [])
97  {
98    $params = ['parent' => $parent];
99    $params = array_merge($params, $optParams);
100    return $this->call('list', [$params], ListConnectionsResponse::class);
101  }
102  /**
103   * Updates the allocated ranges that are assigned to a connection.
104   * (connections.patch)
105   *
106   * @param string $name The private service connection that connects to a service
107   * producer organization. The name includes both the private service name and
108   * the VPC network peering name in the format of
109   * `services/{peering_service_name}/connections/{vpc_peering_name}`. For Google
110   * services that support this functionality, this is
111   * `services/servicenetworking.googleapis.com/connections/servicenetworking-
112   * googleapis-com`.
113   * @param Connection $postBody
114   * @param array $optParams Optional parameters.
115   *
116   * @opt_param bool force If a previously defined allocated range is removed,
117   * force flag must be set to true.
118   * @opt_param string updateMask The update mask. If this is omitted, it defaults
119   * to "*". You can only update the listed peering ranges.
120   * @return Operation
121   */
122  public function patch($name, Connection $postBody, $optParams = [])
123  {
124    $params = ['name' => $name, 'postBody' => $postBody];
125    $params = array_merge($params, $optParams);
126    return $this->call('patch', [$params], Operation::class);
127  }
128}
129
130// Adding a class alias for backwards compatibility with the previous class name.
131class_alias(ServicesConnections::class, 'Google_Service_ServiceNetworking_Resource_ServicesConnections');
132