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\Appengine\Resource;
19
20use Google\Service\Appengine\AppengineEmpty;
21use Google\Service\Appengine\BatchUpdateIngressRulesRequest;
22use Google\Service\Appengine\BatchUpdateIngressRulesResponse;
23use Google\Service\Appengine\FirewallRule;
24use Google\Service\Appengine\ListIngressRulesResponse;
25
26/**
27 * The "ingressRules" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $appengineService = new Google\Service\Appengine(...);
31 *   $ingressRules = $appengineService->ingressRules;
32 *  </code>
33 */
34class AppsFirewallIngressRules extends \Google\Service\Resource
35{
36  /**
37   * Replaces the entire firewall ruleset in one bulk operation. This overrides
38   * and replaces the rules of an existing firewall with the new rules.If the
39   * final rule does not match traffic with the '*' wildcard IP range, then an
40   * "allow all" rule is explicitly added to the end of the list.
41   * (ingressRules.batchUpdate)
42   *
43   * @param string $appsId Part of `name`. Name of the Firewall collection to set.
44   * Example: apps/myapp/firewall/ingressRules.
45   * @param BatchUpdateIngressRulesRequest $postBody
46   * @param array $optParams Optional parameters.
47   * @return BatchUpdateIngressRulesResponse
48   */
49  public function batchUpdate($appsId, BatchUpdateIngressRulesRequest $postBody, $optParams = [])
50  {
51    $params = ['appsId' => $appsId, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('batchUpdate', [$params], BatchUpdateIngressRulesResponse::class);
54  }
55  /**
56   * Creates a firewall rule for the application. (ingressRules.create)
57   *
58   * @param string $appsId Part of `parent`. Name of the parent Firewall
59   * collection in which to create a new rule. Example:
60   * apps/myapp/firewall/ingressRules.
61   * @param FirewallRule $postBody
62   * @param array $optParams Optional parameters.
63   * @return FirewallRule
64   */
65  public function create($appsId, FirewallRule $postBody, $optParams = [])
66  {
67    $params = ['appsId' => $appsId, 'postBody' => $postBody];
68    $params = array_merge($params, $optParams);
69    return $this->call('create', [$params], FirewallRule::class);
70  }
71  /**
72   * Deletes the specified firewall rule. (ingressRules.delete)
73   *
74   * @param string $appsId Part of `name`. Name of the Firewall resource to
75   * delete. Example: apps/myapp/firewall/ingressRules/100.
76   * @param string $ingressRulesId Part of `name`. See documentation of `appsId`.
77   * @param array $optParams Optional parameters.
78   * @return AppengineEmpty
79   */
80  public function delete($appsId, $ingressRulesId, $optParams = [])
81  {
82    $params = ['appsId' => $appsId, 'ingressRulesId' => $ingressRulesId];
83    $params = array_merge($params, $optParams);
84    return $this->call('delete', [$params], AppengineEmpty::class);
85  }
86  /**
87   * Gets the specified firewall rule. (ingressRules.get)
88   *
89   * @param string $appsId Part of `name`. Name of the Firewall resource to
90   * retrieve. Example: apps/myapp/firewall/ingressRules/100.
91   * @param string $ingressRulesId Part of `name`. See documentation of `appsId`.
92   * @param array $optParams Optional parameters.
93   * @return FirewallRule
94   */
95  public function get($appsId, $ingressRulesId, $optParams = [])
96  {
97    $params = ['appsId' => $appsId, 'ingressRulesId' => $ingressRulesId];
98    $params = array_merge($params, $optParams);
99    return $this->call('get', [$params], FirewallRule::class);
100  }
101  /**
102   * Lists the firewall rules of an application.
103   * (ingressRules.listAppsFirewallIngressRules)
104   *
105   * @param string $appsId Part of `parent`. Name of the Firewall collection to
106   * retrieve. Example: apps/myapp/firewall/ingressRules.
107   * @param array $optParams Optional parameters.
108   *
109   * @opt_param string matchingAddress A valid IP Address. If set, only rules
110   * matching this address will be returned. The first returned rule will be the
111   * rule that fires on requests from this IP.
112   * @opt_param int pageSize Maximum results to return per page.
113   * @opt_param string pageToken Continuation token for fetching the next page of
114   * results.
115   * @return ListIngressRulesResponse
116   */
117  public function listAppsFirewallIngressRules($appsId, $optParams = [])
118  {
119    $params = ['appsId' => $appsId];
120    $params = array_merge($params, $optParams);
121    return $this->call('list', [$params], ListIngressRulesResponse::class);
122  }
123  /**
124   * Updates the specified firewall rule. (ingressRules.patch)
125   *
126   * @param string $appsId Part of `name`. Name of the Firewall resource to
127   * update. Example: apps/myapp/firewall/ingressRules/100.
128   * @param string $ingressRulesId Part of `name`. See documentation of `appsId`.
129   * @param FirewallRule $postBody
130   * @param array $optParams Optional parameters.
131   *
132   * @opt_param string updateMask Standard field mask for the set of fields to be
133   * updated.
134   * @return FirewallRule
135   */
136  public function patch($appsId, $ingressRulesId, FirewallRule $postBody, $optParams = [])
137  {
138    $params = ['appsId' => $appsId, 'ingressRulesId' => $ingressRulesId, 'postBody' => $postBody];
139    $params = array_merge($params, $optParams);
140    return $this->call('patch', [$params], FirewallRule::class);
141  }
142}
143
144// Adding a class alias for backwards compatibility with the previous class name.
145class_alias(AppsFirewallIngressRules::class, 'Google_Service_Appengine_Resource_AppsFirewallIngressRules');
146