2020import com .google .api .core .ApiFutures ;
2121import com .google .api .core .BetaApi ;
2222import com .google .api .gax .core .BackgroundResource ;
23+ import com .google .api .gax .httpjson .longrunning .OperationsClient ;
2324import com .google .api .gax .longrunning .OperationFuture ;
2425import com .google .api .gax .paging .AbstractFixedSizeCollection ;
2526import com .google .api .gax .paging .AbstractPage ;
3132import com .google .iam .v2beta .stub .PoliciesStub ;
3233import com .google .iam .v2beta .stub .PoliciesStubSettings ;
3334import com .google .longrunning .Operation ;
34- import com .google .longrunning .OperationsClient ;
3535import java .io .IOException ;
3636import java .util .List ;
3737import java .util .concurrent .TimeUnit ;
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>
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" )
108122public 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();
0 commit comments