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\CloudBuild\Resource;
19
20use Google\Service\CloudBuild\BitbucketServerConfig;
21use Google\Service\CloudBuild\CloudbuildEmpty;
22use Google\Service\CloudBuild\ListBitbucketServerConfigsResponse;
23use Google\Service\CloudBuild\Operation;
24use Google\Service\CloudBuild\RemoveBitbucketServerConnectedRepositoryRequest;
25
26/**
27 * The "bitbucketServerConfigs" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $cloudbuildService = new Google\Service\CloudBuild(...);
31 *   $bitbucketServerConfigs = $cloudbuildService->bitbucketServerConfigs;
32 *  </code>
33 */
34class ProjectsLocationsBitbucketServerConfigs extends \Google\Service\Resource
35{
36  /**
37   * Creates a new `BitbucketServerConfig`. This API is experimental.
38   * (bitbucketServerConfigs.create)
39   *
40   * @param string $parent Required. Name of the parent resource.
41   * @param BitbucketServerConfig $postBody
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string bitbucketServerConfigId Optional. The ID to use for the
45   * BitbucketServerConfig, which will become the final component of the
46   * BitbucketServerConfig's resource name. bitbucket_server_config_id must meet
47   * the following requirements: + They must contain only alphanumeric characters
48   * and dashes. + They can be 1-64 characters long. + They must begin and end
49   * with an alphanumeric character.
50   * @return Operation
51   */
52  public function create($parent, BitbucketServerConfig $postBody, $optParams = [])
53  {
54    $params = ['parent' => $parent, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('create', [$params], Operation::class);
57  }
58  /**
59   * Delete a `BitbucketServerConfig`. This API is experimental.
60   * (bitbucketServerConfigs.delete)
61   *
62   * @param string $name Required. The config resource name.
63   * @param array $optParams Optional parameters.
64   * @return Operation
65   */
66  public function delete($name, $optParams = [])
67  {
68    $params = ['name' => $name];
69    $params = array_merge($params, $optParams);
70    return $this->call('delete', [$params], Operation::class);
71  }
72  /**
73   * Retrieve a `BitbucketServerConfig`. This API is experimental.
74   * (bitbucketServerConfigs.get)
75   *
76   * @param string $name Required. The config resource name.
77   * @param array $optParams Optional parameters.
78   * @return BitbucketServerConfig
79   */
80  public function get($name, $optParams = [])
81  {
82    $params = ['name' => $name];
83    $params = array_merge($params, $optParams);
84    return $this->call('get', [$params], BitbucketServerConfig::class);
85  }
86  /**
87   * List all `BitbucketServerConfigs` for a given project. This API is
88   * experimental.
89   * (bitbucketServerConfigs.listProjectsLocationsBitbucketServerConfigs)
90   *
91   * @param string $parent Required. Name of the parent resource.
92   * @param array $optParams Optional parameters.
93   *
94   * @opt_param int pageSize The maximum number of configs to return. The service
95   * may return fewer than this value. If unspecified, at most 50 configs will be
96   * returned. The maximum value is 1000; values above 1000 will be coerced to
97   * 1000.
98   * @opt_param string pageToken A page token, received from a previous
99   * `ListBitbucketServerConfigsRequest` call. Provide this to retrieve the
100   * subsequent page. When paginating, all other parameters provided to
101   * `ListBitbucketServerConfigsRequest` must match the call that provided the
102   * page token.
103   * @return ListBitbucketServerConfigsResponse
104   */
105  public function listProjectsLocationsBitbucketServerConfigs($parent, $optParams = [])
106  {
107    $params = ['parent' => $parent];
108    $params = array_merge($params, $optParams);
109    return $this->call('list', [$params], ListBitbucketServerConfigsResponse::class);
110  }
111  /**
112   * Updates an existing `BitbucketServerConfig`. This API is experimental.
113   * (bitbucketServerConfigs.patch)
114   *
115   * @param string $name The resource name for the config.
116   * @param BitbucketServerConfig $postBody
117   * @param array $optParams Optional parameters.
118   *
119   * @opt_param string updateMask Update mask for the resource. If this is set,
120   * the server will only update the fields specified in the field mask.
121   * Otherwise, a full update of the mutable resource fields will be performed.
122   * @return Operation
123   */
124  public function patch($name, BitbucketServerConfig $postBody, $optParams = [])
125  {
126    $params = ['name' => $name, 'postBody' => $postBody];
127    $params = array_merge($params, $optParams);
128    return $this->call('patch', [$params], Operation::class);
129  }
130  /**
131   * Remove a Bitbucket Server repository from a given BitbucketServerConfig's
132   * connected repositories. This API is experimental.
133   * (bitbucketServerConfigs.removeBitbucketServerConnectedRepository)
134   *
135   * @param string $config Required. The name of the `BitbucketServerConfig` to
136   * remove a connected repository. Format:
137   * `projects/{project}/locations/{location}/bitbucketServerConfigs/{config}`
138   * @param RemoveBitbucketServerConnectedRepositoryRequest $postBody
139   * @param array $optParams Optional parameters.
140   * @return CloudbuildEmpty
141   */
142  public function removeBitbucketServerConnectedRepository($config, RemoveBitbucketServerConnectedRepositoryRequest $postBody, $optParams = [])
143  {
144    $params = ['config' => $config, 'postBody' => $postBody];
145    $params = array_merge($params, $optParams);
146    return $this->call('removeBitbucketServerConnectedRepository', [$params], CloudbuildEmpty::class);
147  }
148}
149
150// Adding a class alias for backwards compatibility with the previous class name.
151class_alias(ProjectsLocationsBitbucketServerConfigs::class, 'Google_Service_CloudBuild_Resource_ProjectsLocationsBitbucketServerConfigs');
152