Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
fix!: Fix the resource annotations for GetRepositoryRequest
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This will be a breaking change for languages that generate client libraries using resource annotations to provide overloads accepting resource names. Where previously such languages would have generated (in-pseudocode) GetRepository(LocationName) they will now (correctly) generate GetRepository(RepositoryName). Code using the older methods will be broken by this change, but would never have worked anyway.

PiperOrigin-RevId: 403028264

Source-Link: googleapis/googleapis@9bac62d

Source-Link: googleapis/googleapis-gen@4f54454
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGY1NDQ1NGI2NDliY2VkZWExNGJiMDE5NTVhNjU4NTBjZTkwNmQ5YiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Oct 19, 2021
1 parent 7991c2a commit 7452df5
Show file tree
Hide file tree
Showing 142 changed files with 11,706 additions and 17,526 deletions.

This file was deleted.

This file was deleted.

Expand Up @@ -43,19 +43,19 @@
* <p>The resources managed by this API are:
*
* <ul>
* <li>Repositories, which group packages and their data.
* <li>Packages, which group versions and their tags.
* <li>Versions, which are specific forms of a package.
* <li>Tags, which represent alternative names for versions.
* <li>Files, which contain content and are optionally associated with a Package or Version.
* <li> Repositories, which group packages and their data.
* <li> Packages, which group versions and their tags.
* <li> Versions, which are specific forms of a package.
* <li> Tags, which represent alternative names for versions.
* <li> Files, which contain content and are optionally associated with a Package or Version.
* </ul>
*
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
* LocationName name = LocationName.of("[PROJECT]", "[LOCATION]");
* RepositoryName name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]");
* Repository response = artifactRegistryClient.getRepository(name);
* }
* }</pre>
Expand All @@ -68,13 +68,13 @@
* methods:
*
* <ol>
* <li>A "flattened" method. With this type of method, the fields of the request type have been
* <li> A "flattened" method. With this type of method, the fields of the request type have been
* converted into function parameters. It may be the case that not all fields are available as
* parameters, and not every API method will have a flattened method entry point.
* <li>A "request object" method. This type of method only takes one parameter, a request object,
* <li> A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
* <li>A "callable" method. This type of method takes no parameters and returns an immutable API
* <li> A "callable" method. This type of method takes no parameters and returns an immutable API
* callable object, which can be used to initiate calls to the service.
* </ol>
*
Expand Down Expand Up @@ -424,15 +424,15 @@ public final ListRepositoriesPagedResponse listRepositories(ListRepositoriesRequ
*
* <pre>{@code
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
* LocationName name = LocationName.of("[PROJECT]", "[LOCATION]");
* RepositoryName name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]");
* Repository response = artifactRegistryClient.getRepository(name);
* }
* }</pre>
*
* @param name Required. The name of the repository to retrieve.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Repository getRepository(LocationName name) {
public final Repository getRepository(RepositoryName name) {
GetRepositoryRequest request =
GetRepositoryRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getRepository(request);
Expand Down Expand Up @@ -537,10 +537,7 @@ public boolean awaitTermination(long duration, TimeUnit unit) throws Interrupted

public static class ListDockerImagesPagedResponse
extends AbstractPagedListResponse<
ListDockerImagesRequest,
ListDockerImagesResponse,
DockerImage,
ListDockerImagesPage,
ListDockerImagesRequest, ListDockerImagesResponse, DockerImage, ListDockerImagesPage,
ListDockerImagesFixedSizeCollection> {

public static ApiFuture<ListDockerImagesPagedResponse> createAsync(
Expand Down Expand Up @@ -590,10 +587,7 @@ public ApiFuture<ListDockerImagesPage> createPageAsync(

public static class ListDockerImagesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListDockerImagesRequest,
ListDockerImagesResponse,
DockerImage,
ListDockerImagesPage,
ListDockerImagesRequest, ListDockerImagesResponse, DockerImage, ListDockerImagesPage,
ListDockerImagesFixedSizeCollection> {

private ListDockerImagesFixedSizeCollection(
Expand All @@ -614,10 +608,7 @@ protected ListDockerImagesFixedSizeCollection createCollection(

public static class ListRepositoriesPagedResponse
extends AbstractPagedListResponse<
ListRepositoriesRequest,
ListRepositoriesResponse,
Repository,
ListRepositoriesPage,
ListRepositoriesRequest, ListRepositoriesResponse, Repository, ListRepositoriesPage,
ListRepositoriesFixedSizeCollection> {

public static ApiFuture<ListRepositoriesPagedResponse> createAsync(
Expand Down Expand Up @@ -667,10 +658,7 @@ public ApiFuture<ListRepositoriesPage> createPageAsync(

public static class ListRepositoriesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListRepositoriesRequest,
ListRepositoriesResponse,
Repository,
ListRepositoriesPage,
ListRepositoriesRequest, ListRepositoriesResponse, Repository, ListRepositoriesPage,
ListRepositoriesFixedSizeCollection> {

private ListRepositoriesFixedSizeCollection(
Expand Down
Expand Up @@ -28,6 +28,7 @@
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.devtools.artifactregistry.v1.stub.ArtifactRegistryStubSettings;
Expand All @@ -42,10 +43,10 @@
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>The default service address (artifactregistry.googleapis.com) and default port (443) are
* <li> The default service address (artifactregistry.googleapis.com) and default port (443) are
* used.
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* <li> Credentials are acquired automatically through Application Default Credentials.
* <li> Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
Expand Down
Expand Up @@ -29,18 +29,18 @@
* <p>The resources managed by this API are:
*
* <ul>
* <li>Repositories, which group packages and their data.
* <li>Packages, which group versions and their tags.
* <li>Versions, which are specific forms of a package.
* <li>Tags, which represent alternative names for versions.
* <li>Files, which contain content and are optionally associated with a Package or Version.
* <li> Repositories, which group packages and their data.
* <li> Packages, which group versions and their tags.
* <li> Versions, which are specific forms of a package.
* <li> Tags, which represent alternative names for versions.
* <li> Files, which contain content and are optionally associated with a Package or Version.
* </ul>
*
* <p>Sample for ArtifactRegistryClient:
*
* <pre>{@code
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
* LocationName name = LocationName.of("[PROJECT]", "[LOCATION]");
* RepositoryName name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]");
* Repository response = artifactRegistryClient.getRepository(name);
* }
* }</pre>
Expand Down
Expand Up @@ -64,10 +64,10 @@
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>The default service address (artifactregistry.googleapis.com) and default port (443) are
* <li> The default service address (artifactregistry.googleapis.com) and default port (443) are
* used.
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* <li> Credentials are acquired automatically through Application Default Credentials.
* <li> Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
Expand Down
Expand Up @@ -36,6 +36,7 @@
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

Expand Down
Expand Up @@ -226,7 +226,7 @@ public void getRepositoryTest() throws Exception {
.build();
mockArtifactRegistry.addResponse(expectedResponse);

LocationName name = LocationName.of("[PROJECT]", "[LOCATION]");
RepositoryName name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]");

Repository actualResponse = client.getRepository(name);
Assert.assertEquals(expectedResponse, actualResponse);
Expand All @@ -248,7 +248,7 @@ public void getRepositoryExceptionTest() throws Exception {
mockArtifactRegistry.addException(exception);

try {
LocationName name = LocationName.of("[PROJECT]", "[LOCATION]");
RepositoryName name = RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]");
client.getRepository(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Expand Down

0 comments on commit 7452df5

Please sign in to comment.