Skip to content

Commit 77490c8

Browse files
feat: Update the public IAM Deny v2beta API (#412)
- [ ] Regenerate this pull request now. BREAKING CHANGE: remove google.api.resource_reference annotations PiperOrigin-RevId: 468493946 Source-Link: googleapis/googleapis@fb22ccd Source-Link: https://github.com/googleapis/googleapis-gen/commit/fd818d2d7b17ade74aa84d7384e13cbe40ba320d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmQ4MThkMmQ3YjE3YWRlNzRhYTg0ZDczODRlMTNjYmU0MGJhMzIwZCJ9
1 parent 74d14e2 commit 77490c8

23 files changed

+1215
-531
lines changed

java-iam/google-iam-policy/pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
<groupId>com.google.api</groupId>
5959
<artifactId>gax-grpc</artifactId>
6060
</dependency>
61+
<dependency>
62+
<groupId>com.google.api</groupId>
63+
<artifactId>gax-httpjson</artifactId>
64+
</dependency>
6165
<dependency>
6266
<groupId>org.threeten</groupId>
6367
<artifactId>threetenbp</artifactId>
@@ -77,12 +81,24 @@
7781
<scope>test</scope>
7882
</dependency>
7983
<!-- Need testing utility classes for generated gRPC clients tests -->
84+
<dependency>
85+
<groupId>com.google.api</groupId>
86+
<artifactId>gax</artifactId>
87+
<classifier>testlib</classifier>
88+
<scope>test</scope>
89+
</dependency>
8090
<dependency>
8191
<groupId>com.google.api</groupId>
8292
<artifactId>gax-grpc</artifactId>
8393
<classifier>testlib</classifier>
8494
<scope>test</scope>
8595
</dependency>
96+
<dependency>
97+
<groupId>com.google.api</groupId>
98+
<artifactId>gax-httpjson</artifactId>
99+
<classifier>testlib</classifier>
100+
<scope>test</scope>
101+
</dependency>
86102
</dependencies>
87103

88104
<profiles>

java-iam/google-iam-policy/src/main/java/com/google/iam/v2beta/PoliciesClient.java

Lines changed: 41 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.google.api.core.ApiFutures;
2121
import com.google.api.core.BetaApi;
2222
import com.google.api.gax.core.BackgroundResource;
23+
import com.google.api.gax.httpjson.longrunning.OperationsClient;
2324
import com.google.api.gax.longrunning.OperationFuture;
2425
import com.google.api.gax.paging.AbstractFixedSizeCollection;
2526
import com.google.api.gax.paging.AbstractPage;
@@ -31,7 +32,6 @@
3132
import com.google.iam.v2beta.stub.PoliciesStub;
3233
import com.google.iam.v2beta.stub.PoliciesStubSettings;
3334
import com.google.longrunning.Operation;
34-
import com.google.longrunning.OperationsClient;
3535
import java.io.IOException;
3636
import java.util.List;
3737
import java.util.concurrent.TimeUnit;
@@ -48,7 +48,7 @@
4848
* // This snippet has been automatically generated for illustrative purposes only.
4949
* // It may require modifications to work in your environment.
5050
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
51-
* PolicyName name = PolicyName.of("[POLICY]");
51+
* String name = "name3373707";
5252
* Policy response = policiesClient.getPolicy(name);
5353
* }
5454
* }</pre>
@@ -101,14 +101,29 @@
101101
* PoliciesClient policiesClient = PoliciesClient.create(policiesSettings);
102102
* }</pre>
103103
*
104+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
105+
* the wire:
106+
*
107+
* <pre>{@code
108+
* // This snippet has been automatically generated for illustrative purposes only.
109+
* // It may require modifications to work in your environment.
110+
* PoliciesSettings policiesSettings =
111+
* PoliciesSettings.newBuilder()
112+
* .setTransportChannelProvider(
113+
* PoliciesSettings.defaultHttpJsonTransportProviderBuilder().build())
114+
* .build();
115+
* PoliciesClient policiesClient = PoliciesClient.create(policiesSettings);
116+
* }</pre>
117+
*
104118
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
105119
*/
106120
@BetaApi
107121
@Generated("by gapic-generator-java")
108122
public class PoliciesClient implements BackgroundResource {
109123
private final PoliciesSettings settings;
110124
private final PoliciesStub stub;
111-
private final OperationsClient operationsClient;
125+
private final OperationsClient httpJsonOperationsClient;
126+
private final com.google.longrunning.OperationsClient operationsClient;
112127

113128
/** Constructs an instance of PoliciesClient with default settings. */
114129
public static final PoliciesClient create() throws IOException {
@@ -138,13 +153,17 @@ public static final PoliciesClient create(PoliciesStub stub) {
138153
protected PoliciesClient(PoliciesSettings settings) throws IOException {
139154
this.settings = settings;
140155
this.stub = ((PoliciesStubSettings) settings.getStubSettings()).createStub();
141-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
156+
this.operationsClient =
157+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
158+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
142159
}
143160

144161
protected PoliciesClient(PoliciesStub stub) {
145162
this.settings = null;
146163
this.stub = stub;
147-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
164+
this.operationsClient =
165+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
166+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
148167
}
149168

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

185+
/**
186+
* Returns the OperationsClient that can be used to query the status of a long-running operation
187+
* returned by another API method call.
188+
*/
189+
@BetaApi
190+
public final OperationsClient getHttpJsonOperationsClient() {
191+
return httpJsonOperationsClient;
192+
}
193+
166194
// AUTO-GENERATED DOCUMENTATION AND METHOD.
167195
/**
168196
* Retrieves the policies of the specified kind that are attached to a resource.
@@ -305,37 +333,7 @@ public final UnaryCallable<ListPoliciesRequest, ListPoliciesResponse> listPolici
305333
* // This snippet has been automatically generated for illustrative purposes only.
306334
* // It may require modifications to work in your environment.
307335
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
308-
* PolicyName name = PolicyName.of("[POLICY]");
309-
* Policy response = policiesClient.getPolicy(name);
310-
* }
311-
* }</pre>
312-
*
313-
* @param name Required. The resource name of the policy to retrieve. Format:
314-
* `policies/{attachment_point}/denypolicies/{policy_id}`
315-
* <p>Use the URL-encoded full resource name, which means that the forward-slash character,
316-
* `/`, must be written as `%2F`. For example,
317-
* `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
318-
* <p>For organizations and folders, use the numeric ID in the full resource name. For
319-
* projects, you can use the alphanumeric or the numeric ID.
320-
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
321-
*/
322-
public final Policy getPolicy(PolicyName name) {
323-
GetPolicyRequest request =
324-
GetPolicyRequest.newBuilder().setName(name == null ? null : name.toString()).build();
325-
return getPolicy(request);
326-
}
327-
328-
// AUTO-GENERATED DOCUMENTATION AND METHOD.
329-
/**
330-
* Gets a policy.
331-
*
332-
* <p>Sample code:
333-
*
334-
* <pre>{@code
335-
* // This snippet has been automatically generated for illustrative purposes only.
336-
* // It may require modifications to work in your environment.
337-
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
338-
* String name = PolicyName.of("[POLICY]").toString();
336+
* String name = "name3373707";
339337
* Policy response = policiesClient.getPolicy(name);
340338
* }
341339
* }</pre>
@@ -364,8 +362,7 @@ public final Policy getPolicy(String name) {
364362
* // This snippet has been automatically generated for illustrative purposes only.
365363
* // It may require modifications to work in your environment.
366364
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
367-
* GetPolicyRequest request =
368-
* GetPolicyRequest.newBuilder().setName(PolicyName.of("[POLICY]").toString()).build();
365+
* GetPolicyRequest request = GetPolicyRequest.newBuilder().setName("name3373707").build();
369366
* Policy response = policiesClient.getPolicy(request);
370367
* }
371368
* }</pre>
@@ -387,8 +384,7 @@ public final Policy getPolicy(GetPolicyRequest request) {
387384
* // This snippet has been automatically generated for illustrative purposes only.
388385
* // It may require modifications to work in your environment.
389386
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
390-
* GetPolicyRequest request =
391-
* GetPolicyRequest.newBuilder().setName(PolicyName.of("[POLICY]").toString()).build();
387+
* GetPolicyRequest request = GetPolicyRequest.newBuilder().setName("name3373707").build();
392388
* ApiFuture<Policy> future = policiesClient.getPolicyCallable().futureCall(request);
393389
* // Do something.
394390
* Policy response = future.get();
@@ -630,37 +626,7 @@ public final UnaryCallable<UpdatePolicyRequest, Operation> updatePolicyCallable(
630626
* // This snippet has been automatically generated for illustrative purposes only.
631627
* // It may require modifications to work in your environment.
632628
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
633-
* PolicyName name = PolicyName.of("[POLICY]");
634-
* Policy response = policiesClient.deletePolicyAsync(name).get();
635-
* }
636-
* }</pre>
637-
*
638-
* @param name Required. The resource name of the policy to delete. Format:
639-
* `policies/{attachment_point}/denypolicies/{policy_id}`
640-
* <p>Use the URL-encoded full resource name, which means that the forward-slash character,
641-
* `/`, must be written as `%2F`. For example,
642-
* `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
643-
* <p>For organizations and folders, use the numeric ID in the full resource name. For
644-
* projects, you can use the alphanumeric or the numeric ID.
645-
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
646-
*/
647-
public final OperationFuture<Policy, PolicyOperationMetadata> deletePolicyAsync(PolicyName name) {
648-
DeletePolicyRequest request =
649-
DeletePolicyRequest.newBuilder().setName(name == null ? null : name.toString()).build();
650-
return deletePolicyAsync(request);
651-
}
652-
653-
// AUTO-GENERATED DOCUMENTATION AND METHOD.
654-
/**
655-
* Deletes a policy. This action is permanent.
656-
*
657-
* <p>Sample code:
658-
*
659-
* <pre>{@code
660-
* // This snippet has been automatically generated for illustrative purposes only.
661-
* // It may require modifications to work in your environment.
662-
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
663-
* String name = PolicyName.of("[POLICY]").toString();
629+
* String name = "name3373707";
664630
* Policy response = policiesClient.deletePolicyAsync(name).get();
665631
* }
666632
* }</pre>
@@ -690,10 +656,7 @@ public final OperationFuture<Policy, PolicyOperationMetadata> deletePolicyAsync(
690656
* // It may require modifications to work in your environment.
691657
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
692658
* DeletePolicyRequest request =
693-
* DeletePolicyRequest.newBuilder()
694-
* .setName(PolicyName.of("[POLICY]").toString())
695-
* .setEtag("etag3123477")
696-
* .build();
659+
* DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
697660
* Policy response = policiesClient.deletePolicyAsync(request).get();
698661
* }
699662
* }</pre>
@@ -717,10 +680,7 @@ public final OperationFuture<Policy, PolicyOperationMetadata> deletePolicyAsync(
717680
* // It may require modifications to work in your environment.
718681
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
719682
* DeletePolicyRequest request =
720-
* DeletePolicyRequest.newBuilder()
721-
* .setName(PolicyName.of("[POLICY]").toString())
722-
* .setEtag("etag3123477")
723-
* .build();
683+
* DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
724684
* OperationFuture<Policy, PolicyOperationMetadata> future =
725685
* policiesClient.deletePolicyOperationCallable().futureCall(request);
726686
* // Do something.
@@ -744,10 +704,7 @@ public final OperationFuture<Policy, PolicyOperationMetadata> deletePolicyAsync(
744704
* // It may require modifications to work in your environment.
745705
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
746706
* DeletePolicyRequest request =
747-
* DeletePolicyRequest.newBuilder()
748-
* .setName(PolicyName.of("[POLICY]").toString())
749-
* .setEtag("etag3123477")
750-
* .build();
707+
* DeletePolicyRequest.newBuilder().setName("name3373707").setEtag("etag3123477").build();
751708
* ApiFuture<Operation> future = policiesClient.deletePolicyCallable().futureCall(request);
752709
* // Do something.
753710
* Operation response = future.get();

java-iam/google-iam-policy/src/main/java/com/google/iam/v2beta/PoliciesSettings.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.api.gax.core.GoogleCredentialsProvider;
2424
import com.google.api.gax.core.InstantiatingExecutorProvider;
2525
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
26+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
2627
import com.google.api.gax.rpc.ApiClientHeaderProvider;
2728
import com.google.api.gax.rpc.ClientContext;
2829
import com.google.api.gax.rpc.ClientSettings;
@@ -141,11 +142,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
141142
return PoliciesStubSettings.defaultCredentialsProviderBuilder();
142143
}
143144

144-
/** Returns a builder for the default ChannelProvider for this service. */
145+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
145146
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
146147
return PoliciesStubSettings.defaultGrpcTransportProviderBuilder();
147148
}
148149

150+
/** Returns a builder for the default REST ChannelProvider for this service. */
151+
@BetaApi
152+
public static InstantiatingHttpJsonChannelProvider.Builder
153+
defaultHttpJsonTransportProviderBuilder() {
154+
return PoliciesStubSettings.defaultHttpJsonTransportProviderBuilder();
155+
}
156+
149157
public static TransportChannelProvider defaultTransportChannelProvider() {
150158
return PoliciesStubSettings.defaultTransportChannelProvider();
151159
}
@@ -155,11 +163,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
155163
return PoliciesStubSettings.defaultApiClientHeaderProviderBuilder();
156164
}
157165

158-
/** Returns a new builder for this class. */
166+
/** Returns a new gRPC builder for this class. */
159167
public static Builder newBuilder() {
160168
return Builder.createDefault();
161169
}
162170

171+
/** Returns a new REST builder for this class. */
172+
@BetaApi
173+
public static Builder newHttpJsonBuilder() {
174+
return Builder.createHttpJsonDefault();
175+
}
176+
163177
/** Returns a new builder for this class. */
164178
public static Builder newBuilder(ClientContext clientContext) {
165179
return new Builder(clientContext);
@@ -197,6 +211,11 @@ private static Builder createDefault() {
197211
return new Builder(PoliciesStubSettings.newBuilder());
198212
}
199213

214+
@BetaApi
215+
private static Builder createHttpJsonDefault() {
216+
return new Builder(PoliciesStubSettings.newHttpJsonBuilder());
217+
}
218+
200219
public PoliciesStubSettings.Builder getStubSettingsBuilder() {
201220
return ((PoliciesStubSettings.Builder) getStubSettings());
202221
}

java-iam/google-iam-policy/src/main/java/com/google/iam/v2beta/gapic_metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"methods": ["createPolicyAsync", "createPolicyAsync", "createPolicyOperationCallable", "createPolicyCallable"]
1515
},
1616
"DeletePolicy": {
17-
"methods": ["deletePolicyAsync", "deletePolicyAsync", "deletePolicyAsync", "deletePolicyOperationCallable", "deletePolicyCallable"]
17+
"methods": ["deletePolicyAsync", "deletePolicyAsync", "deletePolicyOperationCallable", "deletePolicyCallable"]
1818
},
1919
"GetPolicy": {
20-
"methods": ["getPolicy", "getPolicy", "getPolicy", "getPolicyCallable"]
20+
"methods": ["getPolicy", "getPolicy", "getPolicyCallable"]
2121
},
2222
"ListPolicies": {
2323
"methods": ["listPolicies", "listPolicies", "listPoliciesPagedCallable", "listPoliciesCallable"]

java-iam/google-iam-policy/src/main/java/com/google/iam/v2beta/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* // This snippet has been automatically generated for illustrative purposes only.
3030
* // It may require modifications to work in your environment.
3131
* try (PoliciesClient policiesClient = PoliciesClient.create()) {
32-
* PolicyName name = PolicyName.of("[POLICY]");
32+
* String name = "name3373707";
3333
* Policy response = policiesClient.getPolicy(name);
3434
* }
3535
* }</pre>

0 commit comments

Comments
 (0)