@Override public Map<String, String> extract(GetIamPolicyRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("resource", String.valueOf(request.getResource())); return params.build(); } })
/** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * * <p>Sample code: * * <pre><code> * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) { * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); * Policy response = keyManagementServiceClient.getIamPolicy(resource); * } * </code></pre> * * @param resource REQUIRED: The resource for which the policy is being requested. `resource` is * usually specified as a path. For example, a Project resource is specified as * `projects/{project}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy getIamPolicy(KeyName resource) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource(resource == null ? null : resource.toString()) .build(); return getIamPolicy(request); }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@Override public Map<String, String> extract(GetIamPolicyRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("resource", String.valueOf(request.getResource())); return params.build(); } })
/** * Gets the access control policy for a note or an occurrence resource. Requires * `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` * permission if the resource is a note or occurrence, respectively. * * <p>The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for notes and * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for occurrences. * * <p>Sample code: * * <pre><code> * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) { * IamResourceName resource = NoteName.of("[PROJECT]", "[NOTE]"); * Policy response = containerAnalysisV1Beta1Client.getIamPolicy(resource); * } * </code></pre> * * @param resource REQUIRED: The resource for which the policy is being requested. `resource` is * usually specified as a path. For example, a Project resource is specified as * `projects/{project}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy getIamPolicy(IamResourceName resource) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource(resource == null ? null : resource.toString()) .build(); return getIamPolicy(request); }
private static io.grpc.MethodDescriptor< com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> getGetIamPolicyMethodHelper() { io.grpc.MethodDescriptor<com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> getGetIamPolicyMethod; if ((getGetIamPolicyMethod = CloudTasksGrpc.getGetIamPolicyMethod) == null) { synchronized (CloudTasksGrpc.class) { if ((getGetIamPolicyMethod = CloudTasksGrpc.getGetIamPolicyMethod) == null) { CloudTasksGrpc.getGetIamPolicyMethod = getGetIamPolicyMethod = io.grpc.MethodDescriptor .<com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName( generateFullMethodName( "google.cloud.tasks.v2beta3.CloudTasks", "GetIamPolicy")) .setSampledToLocalTracing(true) .setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.iam.v1.Policy.getDefaultInstance())) .setSchemaDescriptor(new CloudTasksMethodDescriptorSupplier("GetIamPolicy")) .build(); } } } return getGetIamPolicyMethod; }
@Override public Map<String, String> extract(GetIamPolicyRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("resource", String.valueOf(request.getResource())); return params.build(); } })
/** * Gets the access control policy for an instance resource. Returns an empty policy if an instance * exists but does not have a policy set. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * String formattedResource = InstanceName.format("[PROJECT]", "[INSTANCE]"); * Policy response = baseBigtableInstanceAdminClient.getIamPolicy(formattedResource); * } * </code></pre> * * @param resource REQUIRED: The resource for which the policy is being requested. `resource` is * usually specified as a path. For example, a Project resource is specified as * `projects/{project}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy getIamPolicy(String resource) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); return getIamPolicy(request); }
private static io.grpc.MethodDescriptor< com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> getGetIamPolicyMethodHelper() { io.grpc.MethodDescriptor<com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> getGetIamPolicyMethod; if ((getGetIamPolicyMethod = CloudTasksGrpc.getGetIamPolicyMethod) == null) { synchronized (CloudTasksGrpc.class) { if ((getGetIamPolicyMethod = CloudTasksGrpc.getGetIamPolicyMethod) == null) { CloudTasksGrpc.getGetIamPolicyMethod = getGetIamPolicyMethod = io.grpc.MethodDescriptor .<com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName( generateFullMethodName( "google.cloud.tasks.v2beta2.CloudTasks", "GetIamPolicy")) .setSampledToLocalTracing(true) .setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.iam.v1.Policy.getDefaultInstance())) .setSchemaDescriptor(new CloudTasksMethodDescriptorSupplier("GetIamPolicy")) .build(); } } } return getGetIamPolicyMethod; }
@Override public Map<String, String> extract(GetIamPolicyRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("resource", String.valueOf(request.getResource())); return params.build(); } })
/** * Gets the access control policy on the specified Source. * * <p>Sample code: * * <pre><code> * try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { * SourceName resource = SourceName.of("[ORGANIZATION]", "[SOURCE]"); * Policy response = securityCenterClient.getIamPolicy(resource.toString()); * } * </code></pre> * * @param resource REQUIRED: The resource for which the policy is being requested. `resource` is * usually specified as a path. For example, a Project resource is specified as * `projects/{project}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy getIamPolicy(String resource) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); return getIamPolicy(request); }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@Override public Map<String, String> extract(GetIamPolicyRequest request) { ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); params.put("resource", String.valueOf(request.getResource())); return params.build(); } })
/** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * * <p>Sample code: * * <pre><code> * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) { * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); * Policy response = keyManagementServiceClient.getIamPolicy(resource.toString()); * } * </code></pre> * * @param resource REQUIRED: The resource for which the policy is being requested. `resource` is * usually specified as a path. For example, a Project resource is specified as * `projects/{project}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy getIamPolicy(String resource) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); return getIamPolicy(request); }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@Test @SuppressWarnings("all") public void getIamPolicyTest() { int version = 351608024; ByteString etag = ByteString.copyFromUtf8("21"); Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); mockDeviceManager.addResponse(expectedResponse); RegistryName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); Policy actualResponse = client.getIamPolicy(resource); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockDeviceManager.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
/** * Gets the access control policy for a resource. Returns an empty policy if the resource exists * and does not have a policy set. * * <p>Sample code: * * <pre><code> * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) { * String formattedResource = ProjectSubscriptionName.format("[PROJECT]", "[SUBSCRIPTION]"); * Policy response = subscriptionAdminClient.getIamPolicy(formattedResource); * } * </code></pre> * * @param resource REQUIRED: The resource for which the policy is being requested. `resource` is * usually specified as a path. For example, a Project resource is specified as * `projects/{project}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy getIamPolicy(String resource) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); return getIamPolicy(request); }
.setRequestMarshaller( io.grpc.protobuf.ProtoUtils.marshaller( com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller( io.grpc.protobuf.ProtoUtils.marshaller(
@Test @SuppressWarnings("all") public void getIamPolicyTest() { int version = 351608024; ByteString etag = ByteString.copyFromUtf8("21"); Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); mockCloudTasks.addResponse(expectedResponse); QueueName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]"); Policy actualResponse = client.getIamPolicy(resource); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockCloudTasks.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }