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

Commit

Permalink
feat: Update the public IAM Deny v2beta API (#412)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

BREAKING CHANGE: remove google.api.resource_reference annotations

PiperOrigin-RevId: 468493946

Source-Link: googleapis/googleapis@fb22ccd

Source-Link: googleapis/googleapis-gen@fd818d2
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmQ4MThkMmQ3YjE3YWRlNzRhYTg0ZDczODRlMTNjYmU0MGJhMzIwZCJ9
  • Loading branch information
gcf-owl-bot[bot] committed Aug 25, 2022
1 parent f4f695f commit 5894873
Show file tree
Hide file tree
Showing 23 changed files with 1,215 additions and 531 deletions.
16 changes: 16 additions & 0 deletions google-iam-policy/pom.xml
Expand Up @@ -58,6 +58,10 @@
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
Expand All @@ -77,12 +81,24 @@
<scope>test</scope>
</dependency>
<!-- Need testing utility classes for generated gRPC clients tests -->
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand Down
Expand Up @@ -20,6 +20,7 @@
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
Expand All @@ -31,7 +32,6 @@
import com.google.iam.v2beta.stub.PoliciesStub;
import com.google.iam.v2beta.stub.PoliciesStubSettings;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
Expand All @@ -48,7 +48,7 @@
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* PolicyName name = PolicyName.of("[POLICY]");
* String name = "name3373707";
* Policy response = policiesClient.getPolicy(name);
* }
* }</pre>
Expand Down Expand Up @@ -101,14 +101,29 @@
* PoliciesClient policiesClient = PoliciesClient.create(policiesSettings);
* }</pre>
*
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* PoliciesSettings policiesSettings =
* PoliciesSettings.newBuilder()
* .setTransportChannelProvider(
* PoliciesSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* PoliciesClient policiesClient = PoliciesClient.create(policiesSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
@Generated("by gapic-generator-java")
public class PoliciesClient implements BackgroundResource {
private final PoliciesSettings settings;
private final PoliciesStub stub;
private final OperationsClient operationsClient;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;

/** Constructs an instance of PoliciesClient with default settings. */
public static final PoliciesClient create() throws IOException {
Expand Down Expand Up @@ -138,13 +153,17 @@ public static final PoliciesClient create(PoliciesStub stub) {
protected PoliciesClient(PoliciesSettings settings) throws IOException {
this.settings = settings;
this.stub = ((PoliciesStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

protected PoliciesClient(PoliciesStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

public final PoliciesSettings getSettings() {
Expand All @@ -159,10 +178,19 @@ public PoliciesStub getStub() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final OperationsClient getOperationsClient() {
public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}

/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Retrieves the policies of the specified kind that are attached to a resource.
Expand Down Expand Up @@ -305,37 +333,7 @@ public final UnaryCallable<ListPoliciesRequest, ListPoliciesResponse> listPolici
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* PolicyName name = PolicyName.of("[POLICY]");
* Policy response = policiesClient.getPolicy(name);
* }
* }</pre>
*
* @param name Required. The resource name of the policy to retrieve. Format:
* `policies/{attachment_point}/denypolicies/{policy_id}`
* <p>Use the URL-encoded full resource name, which means that the forward-slash character,
* `/`, must be written as `%2F`. For example,
* `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
* <p>For organizations and folders, use the numeric ID in the full resource name. For
* projects, you can use the alphanumeric or the numeric ID.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Policy getPolicy(PolicyName name) {
GetPolicyRequest request =
GetPolicyRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getPolicy(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a policy.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* String name = PolicyName.of("[POLICY]").toString();
* String name = "name3373707";
* Policy response = policiesClient.getPolicy(name);
* }
* }</pre>
Expand Down Expand Up @@ -364,8 +362,7 @@ public final Policy getPolicy(String name) {
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* GetPolicyRequest request =
* GetPolicyRequest.newBuilder().setName(PolicyName.of("[POLICY]").toString()).build();
* GetPolicyRequest request = GetPolicyRequest.newBuilder().setName("name3373707").build();
* Policy response = policiesClient.getPolicy(request);
* }
* }</pre>
Expand All @@ -387,8 +384,7 @@ public final Policy getPolicy(GetPolicyRequest request) {
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* GetPolicyRequest request =
* GetPolicyRequest.newBuilder().setName(PolicyName.of("[POLICY]").toString()).build();
* GetPolicyRequest request = GetPolicyRequest.newBuilder().setName("name3373707").build();
* ApiFuture<Policy> future = policiesClient.getPolicyCallable().futureCall(request);
* // Do something.
* Policy response = future.get();
Expand Down Expand Up @@ -630,37 +626,7 @@ public final UnaryCallable<UpdatePolicyRequest, Operation> updatePolicyCallable(
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* PolicyName name = PolicyName.of("[POLICY]");
* Policy response = policiesClient.deletePolicyAsync(name).get();
* }
* }</pre>
*
* @param name Required. The resource name of the policy to delete. Format:
* `policies/{attachment_point}/denypolicies/{policy_id}`
* <p>Use the URL-encoded full resource name, which means that the forward-slash character,
* `/`, must be written as `%2F`. For example,
* `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
* <p>For organizations and folders, use the numeric ID in the full resource name. For
* projects, you can use the alphanumeric or the numeric ID.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Policy, PolicyOperationMetadata> deletePolicyAsync(PolicyName name) {
DeletePolicyRequest request =
DeletePolicyRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deletePolicyAsync(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a policy. This action is permanent.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* String name = PolicyName.of("[POLICY]").toString();
* String name = "name3373707";
* Policy response = policiesClient.deletePolicyAsync(name).get();
* }
* }</pre>
Expand Down Expand Up @@ -690,10 +656,7 @@ public final OperationFuture<Policy, PolicyOperationMetadata> deletePolicyAsync(
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* DeletePolicyRequest request =
* DeletePolicyRequest.newBuilder()
* .setName(PolicyName.of("[POLICY]").toString())
* .setEtag("etag3123477")
* .build();
* DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
* Policy response = policiesClient.deletePolicyAsync(request).get();
* }
* }</pre>
Expand All @@ -717,10 +680,7 @@ public final OperationFuture<Policy, PolicyOperationMetadata> deletePolicyAsync(
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* DeletePolicyRequest request =
* DeletePolicyRequest.newBuilder()
* .setName(PolicyName.of("[POLICY]").toString())
* .setEtag("etag3123477")
* .build();
* DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
* OperationFuture<Policy, PolicyOperationMetadata> future =
* policiesClient.deletePolicyOperationCallable().futureCall(request);
* // Do something.
Expand All @@ -744,10 +704,7 @@ public final OperationFuture<Policy, PolicyOperationMetadata> deletePolicyAsync(
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* DeletePolicyRequest request =
* DeletePolicyRequest.newBuilder()
* .setName(PolicyName.of("[POLICY]").toString())
* .setEtag("etag3123477")
* .build();
* DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
* ApiFuture<Operation> future = policiesClient.deletePolicyCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
Expand Down
Expand Up @@ -23,6 +23,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
Expand Down Expand Up @@ -141,11 +142,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return PoliciesStubSettings.defaultCredentialsProviderBuilder();
}

/** Returns a builder for the default ChannelProvider for this service. */
/** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return PoliciesStubSettings.defaultGrpcTransportProviderBuilder();
}

/** Returns a builder for the default REST ChannelProvider for this service. */
@BetaApi
public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder() {
return PoliciesStubSettings.defaultHttpJsonTransportProviderBuilder();
}

public static TransportChannelProvider defaultTransportChannelProvider() {
return PoliciesStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -155,11 +163,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return PoliciesStubSettings.defaultApiClientHeaderProviderBuilder();
}

/** Returns a new builder for this class. */
/** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}

/** Returns a new REST builder for this class. */
@BetaApi
public static Builder newHttpJsonBuilder() {
return Builder.createHttpJsonDefault();
}

/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
Expand Down Expand Up @@ -197,6 +211,11 @@ private static Builder createDefault() {
return new Builder(PoliciesStubSettings.newBuilder());
}

@BetaApi
private static Builder createHttpJsonDefault() {
return new Builder(PoliciesStubSettings.newHttpJsonBuilder());
}

public PoliciesStubSettings.Builder getStubSettingsBuilder() {
return ((PoliciesStubSettings.Builder) getStubSettings());
}
Expand Down
Expand Up @@ -14,10 +14,10 @@
"methods": ["createPolicyAsync", "createPolicyAsync", "createPolicyOperationCallable", "createPolicyCallable"]
},
"DeletePolicy": {
"methods": ["deletePolicyAsync", "deletePolicyAsync", "deletePolicyAsync", "deletePolicyOperationCallable", "deletePolicyCallable"]
"methods": ["deletePolicyAsync", "deletePolicyAsync", "deletePolicyOperationCallable", "deletePolicyCallable"]
},
"GetPolicy": {
"methods": ["getPolicy", "getPolicy", "getPolicy", "getPolicyCallable"]
"methods": ["getPolicy", "getPolicy", "getPolicyCallable"]
},
"ListPolicies": {
"methods": ["listPolicies", "listPolicies", "listPoliciesPagedCallable", "listPoliciesCallable"]
Expand Down
Expand Up @@ -29,7 +29,7 @@
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
* PolicyName name = PolicyName.of("[POLICY]");
* String name = "name3373707";
* Policy response = policiesClient.getPolicy(name);
* }
* }</pre>
Expand Down

0 comments on commit 5894873

Please sign in to comment.