Class ServiceIamBinding


  • public class ServiceIamBinding
    extends com.pulumi.resources.CustomResource
    Three different resources help you manage your IAM policy for Cloud Endpoints Service. Each of these resources serves a different use case: * `gcp.endpoints.ServiceIamPolicy`: Authoritative. Sets the IAM policy for the service and replaces any existing policy already attached. * `gcp.endpoints.ServiceIamBinding`: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the service are preserved. * `gcp.endpoints.ServiceIamMember`: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the service are preserved. > **Note:** `gcp.endpoints.ServiceIamPolicy` **cannot** be used in conjunction with `gcp.endpoints.ServiceIamBinding` and `gcp.endpoints.ServiceIamMember` or they will fight over what your policy should be. > **Note:** `gcp.endpoints.ServiceIamBinding` resources **can be** used in conjunction with `gcp.endpoints.ServiceIamMember` resources **only if** they do not grant privilege to the same role. ## google\_endpoints\_service\_iam\_policy ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.organizations.OrganizationsFunctions; import com.pulumi.gcp.organizations.inputs.GetIAMPolicyArgs; import com.pulumi.gcp.endpoints.ServiceIamPolicy; import com.pulumi.gcp.endpoints.ServiceIamPolicyArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { final var admin = OrganizationsFunctions.getIAMPolicy(GetIAMPolicyArgs.builder() .bindings(GetIAMPolicyBindingArgs.builder() .role("roles/viewer") .members("user:[email protected]") .build()) .build()); var policy = new ServiceIamPolicy("policy", ServiceIamPolicyArgs.builder() .serviceName(google_endpoints_service.endpoints_service().service_name()) .policyData(admin.applyValue(getIAMPolicyResult -> getIAMPolicyResult.policyData())) .build()); } } ``` ## google\_endpoints\_service\_iam\_binding ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.endpoints.ServiceIamBinding; import com.pulumi.gcp.endpoints.ServiceIamBindingArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var binding = new ServiceIamBinding("binding", ServiceIamBindingArgs.builder() .serviceName(google_endpoints_service.endpoints_service().service_name()) .role("roles/viewer") .members("user:[email protected]") .build()); } } ``` ## google\_endpoints\_service\_iam\_member ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.endpoints.ServiceIamMember; import com.pulumi.gcp.endpoints.ServiceIamMemberArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var member = new ServiceIamMember("member", ServiceIamMemberArgs.builder() .serviceName(google_endpoints_service.endpoints_service().service_name()) .role("roles/viewer") .member("user:[email protected]") .build()); } } ``` ## Import For all import syntaxes, the "resource in question" can take any of the following forms* services/{{service_name}} * {{service_name}} Any variables not passed in the import command will be taken from the provider configuration. Cloud Endpoints service IAM resources can be imported using the resource identifiers, role, and member. IAM member imports use space-delimited identifiersthe resource in question, the role, and the member identity, e.g. ```sh $ pulumi import gcp:endpoints/serviceIamBinding:ServiceIamBinding editor "services/{{service_name}} roles/viewer user:[email protected]" ``` IAM binding imports use space-delimited identifiersthe resource in question and the role, e.g. ```sh $ pulumi import gcp:endpoints/serviceIamBinding:ServiceIamBinding editor "services/{{service_name}} roles/viewer" ``` IAM policy imports use the identifier of the resource in question, e.g. ```sh $ pulumi import gcp:endpoints/serviceIamBinding:ServiceIamBinding editor services/{{service_name}} ``` -> **Custom Roles**If you're importing a IAM resource with a custom role, make sure to use the full name of the custom role, e.g. `[projects/my-project|organizations/my-org]/roles/my-custom-role`.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.util.Optional<ServiceIamBindingCondition>> condition()  
      com.pulumi.core.Output<java.lang.String> etag()  
      static ServiceIamBinding get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ServiceIamBindingState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.util.List<java.lang.String>> members()  
      com.pulumi.core.Output<java.lang.String> role()  
      com.pulumi.core.Output<java.lang.String> serviceName()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ServiceIamBinding

        public ServiceIamBinding​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • ServiceIamBinding

        public ServiceIamBinding​(java.lang.String name,
                                 ServiceIamBindingArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • ServiceIamBinding

        public ServiceIamBinding​(java.lang.String name,
                                 ServiceIamBindingArgs args,
                                 @Nullable
                                 com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • etag

        public com.pulumi.core.Output<java.lang.String> etag()
        Returns:
        (Computed) The etag of the IAM policy.
      • members

        public com.pulumi.core.Output<java.util.List<java.lang.String>> members()
      • role

        public com.pulumi.core.Output<java.lang.String> role()
        Returns:
        The role that should be applied. Only one `gcp.endpoints.ServiceIamBinding` can be used per role. Note that custom roles must be of the format `[projects|organizations]/{parent-name}/roles/{role-name}`.
      • serviceName

        public com.pulumi.core.Output<java.lang.String> serviceName()
      • get

        public static ServiceIamBinding get​(java.lang.String name,
                                            com.pulumi.core.Output<java.lang.String> id,
                                            @Nullable
                                            ServiceIamBindingState state,
                                            @Nullable
                                            com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.