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\GitHubEnterpriseConfig;
21use Google\Service\CloudBuild\ListGithubEnterpriseConfigsResponse;
22use Google\Service\CloudBuild\Operation;
23
24/**
25 * The "githubEnterpriseConfigs" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $cloudbuildService = new Google\Service\CloudBuild(...);
29 *   $githubEnterpriseConfigs = $cloudbuildService->githubEnterpriseConfigs;
30 *  </code>
31 */
32class ProjectsLocationsGithubEnterpriseConfigs extends \Google\Service\Resource
33{
34  /**
35   * Create an association between a GCP project and a GitHub Enterprise server.
36   * (githubEnterpriseConfigs.create)
37   *
38   * @param string $parent Name of the parent project. For example:
39   * projects/{$project_number} or projects/{$project_id}
40   * @param GitHubEnterpriseConfig $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string gheConfigId Optional. The ID to use for the
44   * GithubEnterpriseConfig, which will become the final component of the
45   * GithubEnterpriseConfig’s resource name. ghe_config_id must meet the following
46   * requirements: + They must contain only alphanumeric characters and dashes. +
47   * They can be 1-64 characters long. + They must begin and end with an
48   * alphanumeric character
49   * @opt_param string projectId ID of the project.
50   * @return Operation
51   */
52  public function create($parent, GitHubEnterpriseConfig $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 an association between a GCP project and a GitHub Enterprise server.
60   * (githubEnterpriseConfigs.delete)
61   *
62   * @param string $name This field should contain the name of the enterprise
63   * config resource. For example:
64   * "projects/{$project_id}/githubEnterpriseConfigs/{$config_id}"
65   * @param array $optParams Optional parameters.
66   *
67   * @opt_param string configId Unique identifier of the `GitHubEnterpriseConfig`
68   * @opt_param string projectId ID of the project
69   * @return Operation
70   */
71  public function delete($name, $optParams = [])
72  {
73    $params = ['name' => $name];
74    $params = array_merge($params, $optParams);
75    return $this->call('delete', [$params], Operation::class);
76  }
77  /**
78   * Retrieve a GitHubEnterpriseConfig. (githubEnterpriseConfigs.get)
79   *
80   * @param string $name This field should contain the name of the enterprise
81   * config resource. For example:
82   * "projects/{$project_id}/githubEnterpriseConfigs/{$config_id}"
83   * @param array $optParams Optional parameters.
84   *
85   * @opt_param string configId Unique identifier of the `GitHubEnterpriseConfig`
86   * @opt_param string projectId ID of the project
87   * @return GitHubEnterpriseConfig
88   */
89  public function get($name, $optParams = [])
90  {
91    $params = ['name' => $name];
92    $params = array_merge($params, $optParams);
93    return $this->call('get', [$params], GitHubEnterpriseConfig::class);
94  }
95  /**
96   * List all GitHubEnterpriseConfigs for a given project.
97   * (githubEnterpriseConfigs.listProjectsLocationsGithubEnterpriseConfigs)
98   *
99   * @param string $parent Name of the parent project. For example:
100   * projects/{$project_number} or projects/{$project_id}
101   * @param array $optParams Optional parameters.
102   *
103   * @opt_param string projectId ID of the project
104   * @return ListGithubEnterpriseConfigsResponse
105   */
106  public function listProjectsLocationsGithubEnterpriseConfigs($parent, $optParams = [])
107  {
108    $params = ['parent' => $parent];
109    $params = array_merge($params, $optParams);
110    return $this->call('list', [$params], ListGithubEnterpriseConfigsResponse::class);
111  }
112  /**
113   * Update an association between a GCP project and a GitHub Enterprise server.
114   * (githubEnterpriseConfigs.patch)
115   *
116   * @param string $name Optional. The full resource name for the
117   * GitHubEnterpriseConfig For example:
118   * "projects/{$project_id}/githubEnterpriseConfigs/{$config_id}"
119   * @param GitHubEnterpriseConfig $postBody
120   * @param array $optParams Optional parameters.
121   *
122   * @opt_param string updateMask Update mask for the resource. If this is set,
123   * the server will only update the fields specified in the field mask.
124   * Otherwise, a full update of the mutable resource fields will be performed.
125   * @return Operation
126   */
127  public function patch($name, GitHubEnterpriseConfig $postBody, $optParams = [])
128  {
129    $params = ['name' => $name, 'postBody' => $postBody];
130    $params = array_merge($params, $optParams);
131    return $this->call('patch', [$params], Operation::class);
132  }
133}
134
135// Adding a class alias for backwards compatibility with the previous class name.
136class_alias(ProjectsLocationsGithubEnterpriseConfigs::class, 'Google_Service_CloudBuild_Resource_ProjectsLocationsGithubEnterpriseConfigs');
137