Skip to content

Commit

Permalink
feat: [cloudresourcemanager] add TagHolds, GetNamespacedTagKey, and G…
Browse files Browse the repository at this point in the history
…etNamespacedTagValue APIs. Adds support for project parented tags (#9369)

* feat: add TagHolds, GetNamespacedTagKey, and GetNamespacedTagValue APIs. Adds support for project parented tags

PiperOrigin-RevId: 525509112

Source-Link: googleapis/googleapis@4a23200

Source-Link: googleapis/googleapis-gen@9596987
Copy-Tag: eyJwIjoiamF2YS1yZXNvdXJjZW1hbmFnZXIvLk93bEJvdC55YW1sIiwiaCI6Ijk1OTY5ODc3ZWNhODM3ZjliNmRiMzJmY2U5NTY2NTY0OWNiZDhjOTAifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Apr 25, 2023
1 parent 4725324 commit b47972a
Show file tree
Hide file tree
Showing 175 changed files with 24,374 additions and 1,917 deletions.
4 changes: 2 additions & 2 deletions java-resourcemanager/README.md
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.11.0</version>
<version>26.12.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -336,7 +336,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-resourcemanager.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-resourcemanager/1.16.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-resourcemanager/1.17.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Expand Up @@ -342,10 +342,12 @@ public final UnaryCallable<GetFolderRequest, Folder> getFolderCallable() {
* }
* }</pre>
*
* @param parent Required. The resource name of the organization or folder whose folders are being
* listed. Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. Access to
* this method is controlled by checking the `resourcemanager.folders.list` permission on the
* `parent`.
* @param parent Required. The name of the parent resource whose folders are being listed. Only
* children of this parent resource are listed; descendants are not listed.
* <p>If the parent is a folder, use the value `folders/{folder_id}`. If the parent is an
* organization, use the value `organizations/{org_id}`.
* <p>Access to this method is controlled by checking the `resourcemanager.folders.list`
* permission on the `parent`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListFoldersPagedResponse listFolders(ResourceName parent) {
Expand Down Expand Up @@ -379,10 +381,12 @@ public final ListFoldersPagedResponse listFolders(ResourceName parent) {
* }
* }</pre>
*
* @param parent Required. The resource name of the organization or folder whose folders are being
* listed. Must be of the form `folders/{folder_id}` or `organizations/{org_id}`. Access to
* this method is controlled by checking the `resourcemanager.folders.list` permission on the
* `parent`.
* @param parent Required. The name of the parent resource whose folders are being listed. Only
* children of this parent resource are listed; descendants are not listed.
* <p>If the parent is a folder, use the value `folders/{folder_id}`. If the parent is an
* organization, use the value `organizations/{org_id}`.
* <p>Access to this method is controlled by checking the `resourcemanager.folders.list`
* permission on the `parent`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListFoldersPagedResponse listFolders(String parent) {
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -42,7 +42,7 @@
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Allow users to create and manage TagBindings between TagValues and different
* cloud resources throughout the GCP resource hierarchy.
* Google Cloud resources throughout the GCP resource hierarchy.
*
* <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:
Expand Down Expand Up @@ -206,7 +206,7 @@ public final OperationsClient getHttpJsonOperationsClient() {

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the TagBindings for the given cloud resource, as specified with `parent`.
* Lists the TagBindings for the given Google Cloud resource, as specified with `parent`.
*
* <p>NOTE: The `parent` field is expected to be a full resource name:
* https://cloud.google.com/apis/design/resource_names#full_resource_name
Expand Down Expand Up @@ -241,7 +241,7 @@ public final ListTagBindingsPagedResponse listTagBindings(ResourceName parent) {

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the TagBindings for the given cloud resource, as specified with `parent`.
* Lists the TagBindings for the given Google Cloud resource, as specified with `parent`.
*
* <p>NOTE: The `parent` field is expected to be a full resource name:
* https://cloud.google.com/apis/design/resource_names#full_resource_name
Expand Down Expand Up @@ -273,7 +273,7 @@ public final ListTagBindingsPagedResponse listTagBindings(String parent) {

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the TagBindings for the given cloud resource, as specified with `parent`.
* Lists the TagBindings for the given Google Cloud resource, as specified with `parent`.
*
* <p>NOTE: The `parent` field is expected to be a full resource name:
* https://cloud.google.com/apis/design/resource_names#full_resource_name
Expand Down Expand Up @@ -308,7 +308,7 @@ public final ListTagBindingsPagedResponse listTagBindings(ListTagBindingsRequest

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the TagBindings for the given cloud resource, as specified with `parent`.
* Lists the TagBindings for the given Google Cloud resource, as specified with `parent`.
*
* <p>NOTE: The `parent` field is expected to be a full resource name:
* https://cloud.google.com/apis/design/resource_names#full_resource_name
Expand Down Expand Up @@ -344,7 +344,7 @@ public final ListTagBindingsPagedResponse listTagBindings(ListTagBindingsRequest

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the TagBindings for the given cloud resource, as specified with `parent`.
* Lists the TagBindings for the given Google Cloud resource, as specified with `parent`.
*
* <p>NOTE: The `parent` field is expected to be a full resource name:
* https://cloud.google.com/apis/design/resource_names#full_resource_name
Expand Down Expand Up @@ -387,8 +387,7 @@ public final ListTagBindingsPagedResponse listTagBindings(ListTagBindingsRequest

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a TagBinding between a TagValue and a cloud resource (currently project, folder, or
* organization).
* Creates a TagBinding between a TagValue and a Google Cloud resource.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -416,8 +415,7 @@ public final OperationFuture<TagBinding, CreateTagBindingMetadata> createTagBind

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a TagBinding between a TagValue and a cloud resource (currently project, folder, or
* organization).
* Creates a TagBinding between a TagValue and a Google Cloud resource.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -447,8 +445,7 @@ public final OperationFuture<TagBinding, CreateTagBindingMetadata> createTagBind

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a TagBinding between a TagValue and a cloud resource (currently project, folder, or
* organization).
* Creates a TagBinding between a TagValue and a Google Cloud resource.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -478,8 +475,7 @@ public final OperationFuture<TagBinding, CreateTagBindingMetadata> createTagBind

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a TagBinding between a TagValue and a cloud resource (currently project, folder, or
* organization).
* Creates a TagBinding between a TagValue and a Google Cloud resource.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -650,6 +646,141 @@ public final UnaryCallable<DeleteTagBindingRequest, Operation> deleteTagBindingC
return stub.deleteTagBindingCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Return a list of effective tags for the given Google Cloud resource, as specified in `parent`.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (TagBindingsClient tagBindingsClient = TagBindingsClient.create()) {
* String parent = "parent-995424086";
* for (EffectiveTag element : tagBindingsClient.listEffectiveTags(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. The full resource name of a resource for which you want to list the
* effective tags. E.g. "//cloudresourcemanager.googleapis.com/projects/123"
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListEffectiveTagsPagedResponse listEffectiveTags(String parent) {
ListEffectiveTagsRequest request =
ListEffectiveTagsRequest.newBuilder().setParent(parent).build();
return listEffectiveTags(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Return a list of effective tags for the given Google Cloud resource, as specified in `parent`.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (TagBindingsClient tagBindingsClient = TagBindingsClient.create()) {
* ListEffectiveTagsRequest request =
* ListEffectiveTagsRequest.newBuilder()
* .setParent("parent-995424086")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (EffectiveTag element : tagBindingsClient.listEffectiveTags(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListEffectiveTagsPagedResponse listEffectiveTags(ListEffectiveTagsRequest request) {
return listEffectiveTagsPagedCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Return a list of effective tags for the given Google Cloud resource, as specified in `parent`.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (TagBindingsClient tagBindingsClient = TagBindingsClient.create()) {
* ListEffectiveTagsRequest request =
* ListEffectiveTagsRequest.newBuilder()
* .setParent("parent-995424086")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture<EffectiveTag> future =
* tagBindingsClient.listEffectiveTagsPagedCallable().futureCall(request);
* // Do something.
* for (EffectiveTag element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<ListEffectiveTagsRequest, ListEffectiveTagsPagedResponse>
listEffectiveTagsPagedCallable() {
return stub.listEffectiveTagsPagedCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Return a list of effective tags for the given Google Cloud resource, as specified in `parent`.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (TagBindingsClient tagBindingsClient = TagBindingsClient.create()) {
* ListEffectiveTagsRequest request =
* ListEffectiveTagsRequest.newBuilder()
* .setParent("parent-995424086")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListEffectiveTagsResponse response =
* tagBindingsClient.listEffectiveTagsCallable().call(request);
* for (EffectiveTag element : response.getEffectiveTagsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<ListEffectiveTagsRequest, ListEffectiveTagsResponse>
listEffectiveTagsCallable() {
return stub.listEffectiveTagsCallable();
}

@Override
public final void close() {
stub.close();
Expand Down Expand Up @@ -756,4 +887,84 @@ protected ListTagBindingsFixedSizeCollection createCollection(
return new ListTagBindingsFixedSizeCollection(pages, collectionSize);
}
}

public static class ListEffectiveTagsPagedResponse
extends AbstractPagedListResponse<
ListEffectiveTagsRequest,
ListEffectiveTagsResponse,
EffectiveTag,
ListEffectiveTagsPage,
ListEffectiveTagsFixedSizeCollection> {

public static ApiFuture<ListEffectiveTagsPagedResponse> createAsync(
PageContext<ListEffectiveTagsRequest, ListEffectiveTagsResponse, EffectiveTag> context,
ApiFuture<ListEffectiveTagsResponse> futureResponse) {
ApiFuture<ListEffectiveTagsPage> futurePage =
ListEffectiveTagsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListEffectiveTagsPagedResponse(input),
MoreExecutors.directExecutor());
}

private ListEffectiveTagsPagedResponse(ListEffectiveTagsPage page) {
super(page, ListEffectiveTagsFixedSizeCollection.createEmptyCollection());
}
}

public static class ListEffectiveTagsPage
extends AbstractPage<
ListEffectiveTagsRequest,
ListEffectiveTagsResponse,
EffectiveTag,
ListEffectiveTagsPage> {

private ListEffectiveTagsPage(
PageContext<ListEffectiveTagsRequest, ListEffectiveTagsResponse, EffectiveTag> context,
ListEffectiveTagsResponse response) {
super(context, response);
}

private static ListEffectiveTagsPage createEmptyPage() {
return new ListEffectiveTagsPage(null, null);
}

@Override
protected ListEffectiveTagsPage createPage(
PageContext<ListEffectiveTagsRequest, ListEffectiveTagsResponse, EffectiveTag> context,
ListEffectiveTagsResponse response) {
return new ListEffectiveTagsPage(context, response);
}

@Override
public ApiFuture<ListEffectiveTagsPage> createPageAsync(
PageContext<ListEffectiveTagsRequest, ListEffectiveTagsResponse, EffectiveTag> context,
ApiFuture<ListEffectiveTagsResponse> futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}

public static class ListEffectiveTagsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListEffectiveTagsRequest,
ListEffectiveTagsResponse,
EffectiveTag,
ListEffectiveTagsPage,
ListEffectiveTagsFixedSizeCollection> {

private ListEffectiveTagsFixedSizeCollection(
List<ListEffectiveTagsPage> pages, int collectionSize) {
super(pages, collectionSize);
}

private static ListEffectiveTagsFixedSizeCollection createEmptyCollection() {
return new ListEffectiveTagsFixedSizeCollection(null, 0);
}

@Override
protected ListEffectiveTagsFixedSizeCollection createCollection(
List<ListEffectiveTagsPage> pages, int collectionSize) {
return new ListEffectiveTagsFixedSizeCollection(pages, collectionSize);
}
}
}

0 comments on commit b47972a

Please sign in to comment.