[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\ArtifactRegistry\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\ArtifactRegistry\DownloadFileResponse;
|
---|
| 21 | use Google\Service\ArtifactRegistry\GoogleDevtoolsArtifactregistryV1File;
|
---|
| 22 | use Google\Service\ArtifactRegistry\ListFilesResponse;
|
---|
| 23 | use Google\Service\ArtifactRegistry\Operation;
|
---|
| 24 | use Google\Service\ArtifactRegistry\UploadFileMediaResponse;
|
---|
| 25 | use Google\Service\ArtifactRegistry\UploadFileRequest;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * The "files" collection of methods.
|
---|
| 29 | * Typical usage is:
|
---|
| 30 | * <code>
|
---|
| 31 | * $artifactregistryService = new Google\Service\ArtifactRegistry(...);
|
---|
| 32 | * $files = $artifactregistryService->projects_locations_repositories_files;
|
---|
| 33 | * </code>
|
---|
| 34 | */
|
---|
| 35 | class ProjectsLocationsRepositoriesFiles extends \Google\Service\Resource
|
---|
| 36 | {
|
---|
| 37 | /**
|
---|
| 38 | * Deletes a file and all of its content. It is only allowed on generic
|
---|
| 39 | * repositories. The returned operation will complete once the file has been
|
---|
| 40 | * deleted. (files.delete)
|
---|
| 41 | *
|
---|
| 42 | * @param string $name Required. The name of the file to delete.
|
---|
| 43 | * @param array $optParams Optional parameters.
|
---|
| 44 | * @return Operation
|
---|
| 45 | * @throws \Google\Service\Exception
|
---|
| 46 | */
|
---|
| 47 | public function delete($name, $optParams = [])
|
---|
| 48 | {
|
---|
| 49 | $params = ['name' => $name];
|
---|
| 50 | $params = array_merge($params, $optParams);
|
---|
| 51 | return $this->call('delete', [$params], Operation::class);
|
---|
| 52 | }
|
---|
| 53 | /**
|
---|
| 54 | * Download a file. (files.download)
|
---|
| 55 | *
|
---|
| 56 | * @param string $name Required. The name of the file to download.
|
---|
| 57 | * @param array $optParams Optional parameters.
|
---|
| 58 | * @return DownloadFileResponse
|
---|
| 59 | * @throws \Google\Service\Exception
|
---|
| 60 | */
|
---|
| 61 | public function download($name, $optParams = [])
|
---|
| 62 | {
|
---|
| 63 | $params = ['name' => $name];
|
---|
| 64 | $params = array_merge($params, $optParams);
|
---|
| 65 | return $this->call('download', [$params], DownloadFileResponse::class);
|
---|
| 66 | }
|
---|
| 67 | /**
|
---|
| 68 | * Gets a file. (files.get)
|
---|
| 69 | *
|
---|
| 70 | * @param string $name Required. The name of the file to retrieve.
|
---|
| 71 | * @param array $optParams Optional parameters.
|
---|
| 72 | * @return GoogleDevtoolsArtifactregistryV1File
|
---|
| 73 | * @throws \Google\Service\Exception
|
---|
| 74 | */
|
---|
| 75 | public function get($name, $optParams = [])
|
---|
| 76 | {
|
---|
| 77 | $params = ['name' => $name];
|
---|
| 78 | $params = array_merge($params, $optParams);
|
---|
| 79 | return $this->call('get', [$params], GoogleDevtoolsArtifactregistryV1File::class);
|
---|
| 80 | }
|
---|
| 81 | /**
|
---|
| 82 | * Lists files. (files.listProjectsLocationsRepositoriesFiles)
|
---|
| 83 | *
|
---|
| 84 | * @param string $parent Required. The name of the repository whose files will
|
---|
| 85 | * be listed. For example: "projects/p1/locations/us-central1/repositories/repo1
|
---|
| 86 | * @param array $optParams Optional parameters.
|
---|
| 87 | *
|
---|
| 88 | * @opt_param string filter An expression for filtering the results of the
|
---|
| 89 | * request. Filter rules are case insensitive. The fields eligible for filtering
|
---|
| 90 | * are: * `name` * `owner` * `annotations` Examples of using a filter: To filter
|
---|
| 91 | * the results of your request to files with the name `my_file.txt` in project
|
---|
| 92 | * `my-project` in the `us-central` region, in repository `my-repo`, append the
|
---|
| 93 | * following filter expression to your request: * `name="projects/my-
|
---|
| 94 | * project/locations/us-central1/repositories/my-repo/files/my-file.txt"` You
|
---|
| 95 | * can also use wildcards to match any number of characters before or after the
|
---|
| 96 | * value: * `name="projects/my-project/locations/us-central1/repositories/my-
|
---|
| 97 | * repo/files/my-*"` * `name="projects/my-project/locations/us-
|
---|
| 98 | * central1/repositories/my-repo/filesfile.txt"` * `name="projects/my-
|
---|
| 99 | * project/locations/us-central1/repositories/my-repo/filesfile*"` To filter the
|
---|
| 100 | * results of your request to files owned by the version `1.0` in package
|
---|
| 101 | * `pkg1`, append the following filter expression to your request: *
|
---|
| 102 | * `owner="projects/my-project/locations/us-central1/repositories/my-
|
---|
| 103 | * repo/packages/my-package/versions/1.0"` To filter the results of your request
|
---|
| 104 | * to files with the annotation key-value pair [`external_link`:
|
---|
| 105 | * `external_link_value`], append the following filter expression to your
|
---|
| 106 | * request: * `"annotations.external_link:external_link_value"` To filter just
|
---|
| 107 | * for a specific annotation key `external_link`, append the following filter
|
---|
| 108 | * expression to your request: * `"annotations.external_link"` If the annotation
|
---|
| 109 | * key or value contains special characters, you can escape them by surrounding
|
---|
| 110 | * the value with backticks. For example, to filter the results of your request
|
---|
| 111 | * to files with the annotation key-value pair
|
---|
| 112 | * [`external.link`:`https://example.com/my-file`], append the following filter
|
---|
| 113 | * expression to your request: * ``
|
---|
| 114 | * "annotations.`external.link`:`https://example.com/my-file`" `` You can also
|
---|
| 115 | * filter with annotations with a wildcard to match any number of characters
|
---|
| 116 | * before or after the value: * `` "annotations.*_link:`*example.com*`" ``
|
---|
| 117 | * @opt_param string orderBy The field to order the results by.
|
---|
| 118 | * @opt_param int pageSize The maximum number of files to return. Maximum page
|
---|
| 119 | * size is 1,000.
|
---|
| 120 | * @opt_param string pageToken The next_page_token value returned from a
|
---|
| 121 | * previous list request, if any.
|
---|
| 122 | * @return ListFilesResponse
|
---|
| 123 | * @throws \Google\Service\Exception
|
---|
| 124 | */
|
---|
| 125 | public function listProjectsLocationsRepositoriesFiles($parent, $optParams = [])
|
---|
| 126 | {
|
---|
| 127 | $params = ['parent' => $parent];
|
---|
| 128 | $params = array_merge($params, $optParams);
|
---|
| 129 | return $this->call('list', [$params], ListFilesResponse::class);
|
---|
| 130 | }
|
---|
| 131 | /**
|
---|
| 132 | * Updates a file. (files.patch)
|
---|
| 133 | *
|
---|
| 134 | * @param string $name The name of the file, for example:
|
---|
| 135 | * `projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt`.
|
---|
| 136 | * If the file ID part contains slashes, they are escaped.
|
---|
| 137 | * @param GoogleDevtoolsArtifactregistryV1File $postBody
|
---|
| 138 | * @param array $optParams Optional parameters.
|
---|
| 139 | *
|
---|
| 140 | * @opt_param string updateMask Required. The update mask applies to the
|
---|
| 141 | * resource. For the `FieldMask` definition, see
|
---|
| 142 | * https://developers.google.com/protocol-
|
---|
| 143 | * buffers/docs/reference/google.protobuf#fieldmask
|
---|
| 144 | * @return GoogleDevtoolsArtifactregistryV1File
|
---|
| 145 | * @throws \Google\Service\Exception
|
---|
| 146 | */
|
---|
| 147 | public function patch($name, GoogleDevtoolsArtifactregistryV1File $postBody, $optParams = [])
|
---|
| 148 | {
|
---|
| 149 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 150 | $params = array_merge($params, $optParams);
|
---|
| 151 | return $this->call('patch', [$params], GoogleDevtoolsArtifactregistryV1File::class);
|
---|
| 152 | }
|
---|
| 153 | /**
|
---|
| 154 | * Directly uploads a file to a repository. The returned Operation will complete
|
---|
| 155 | * once the resources are uploaded. (files.upload)
|
---|
| 156 | *
|
---|
| 157 | * @param string $parent Required. The resource name of the repository where the
|
---|
| 158 | * file will be uploaded.
|
---|
| 159 | * @param UploadFileRequest $postBody
|
---|
| 160 | * @param array $optParams Optional parameters.
|
---|
| 161 | * @return UploadFileMediaResponse
|
---|
| 162 | * @throws \Google\Service\Exception
|
---|
| 163 | */
|
---|
| 164 | public function upload($parent, UploadFileRequest $postBody, $optParams = [])
|
---|
| 165 | {
|
---|
| 166 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 167 | $params = array_merge($params, $optParams);
|
---|
| 168 | return $this->call('upload', [$params], UploadFileMediaResponse::class);
|
---|
| 169 | }
|
---|
| 170 | }
|
---|
| 171 |
|
---|
| 172 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 173 | class_alias(ProjectsLocationsRepositoriesFiles::class, 'Google_Service_ArtifactRegistry_Resource_ProjectsLocationsRepositoriesFiles');
|
---|