1. Packages
  2. Fastly
  3. API Docs
  4. ServiceAuthorization
Fastly v8.5.3 published on Wednesday, Apr 17, 2024 by Pulumi

fastly.ServiceAuthorization

Explore with Pulumi AI

fastly logo
Fastly v8.5.3 published on Wednesday, Apr 17, 2024 by Pulumi

    Configures authorization with granular permissions to services. Users can be granted rights for services on different levels.

    The Service Authorization resource requires a user id, service id and an optional permission.

    Example Usage

    Basic usage:

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    const demo = new fastly.ServiceVcl("demo", {});
    //...
    const user = new fastly.User("user", {});
    // ...
    const auth = new fastly.ServiceAuthorization("auth", {
        serviceId: demo.id,
        userId: user.id,
        permission: "purge_all",
    });
    
    import pulumi
    import pulumi_fastly as fastly
    
    demo = fastly.ServiceVcl("demo")
    #...
    user = fastly.User("user")
    # ...
    auth = fastly.ServiceAuthorization("auth",
        service_id=demo.id,
        user_id=user.id,
        permission="purge_all")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-fastly/sdk/v8/go/fastly"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		demo, err := fastly.NewServiceVcl(ctx, "demo", nil)
    		if err != nil {
    			return err
    		}
    		user, err := fastly.NewUser(ctx, "user", nil)
    		if err != nil {
    			return err
    		}
    		_, err = fastly.NewServiceAuthorization(ctx, "auth", &fastly.ServiceAuthorizationArgs{
    			ServiceId:  demo.ID(),
    			UserId:     user.ID(),
    			Permission: pulumi.String("purge_all"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var demo = new Fastly.ServiceVcl("demo");
    
        //...
        var user = new Fastly.User("user");
    
        // ...
        var auth = new Fastly.ServiceAuthorization("auth", new()
        {
            ServiceId = demo.Id,
            UserId = user.Id,
            Permission = "purge_all",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.fastly.ServiceVcl;
    import com.pulumi.fastly.User;
    import com.pulumi.fastly.ServiceAuthorization;
    import com.pulumi.fastly.ServiceAuthorizationArgs;
    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 demo = new ServiceVcl("demo");
    
            //...
            var user = new User("user");
    
            // ...
            var auth = new ServiceAuthorization("auth", ServiceAuthorizationArgs.builder()        
                .serviceId(demo.id())
                .userId(user.id())
                .permission("purge_all")
                .build());
    
        }
    }
    
    resources:
      demo:
        type: fastly:ServiceVcl
      user:
        type: fastly:User
      auth:
        type: fastly:ServiceAuthorization
        properties:
          serviceId: ${demo.id}
          userId: ${user.id}
          permission: purge_all
    

    Create ServiceAuthorization Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ServiceAuthorization(name: string, args: ServiceAuthorizationArgs, opts?: CustomResourceOptions);
    @overload
    def ServiceAuthorization(resource_name: str,
                             args: ServiceAuthorizationArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServiceAuthorization(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             permission: Optional[str] = None,
                             service_id: Optional[str] = None,
                             user_id: Optional[str] = None)
    func NewServiceAuthorization(ctx *Context, name string, args ServiceAuthorizationArgs, opts ...ResourceOption) (*ServiceAuthorization, error)
    public ServiceAuthorization(string name, ServiceAuthorizationArgs args, CustomResourceOptions? opts = null)
    public ServiceAuthorization(String name, ServiceAuthorizationArgs args)
    public ServiceAuthorization(String name, ServiceAuthorizationArgs args, CustomResourceOptions options)
    
    type: fastly:ServiceAuthorization
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ServiceAuthorizationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ServiceAuthorizationArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ServiceAuthorizationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceAuthorizationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceAuthorizationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var serviceAuthorizationResource = new Fastly.ServiceAuthorization("serviceAuthorizationResource", new()
    {
        Permission = "string",
        ServiceId = "string",
        UserId = "string",
    });
    
    example, err := fastly.NewServiceAuthorization(ctx, "serviceAuthorizationResource", &fastly.ServiceAuthorizationArgs{
    	Permission: pulumi.String("string"),
    	ServiceId:  pulumi.String("string"),
    	UserId:     pulumi.String("string"),
    })
    
    var serviceAuthorizationResource = new ServiceAuthorization("serviceAuthorizationResource", ServiceAuthorizationArgs.builder()        
        .permission("string")
        .serviceId("string")
        .userId("string")
        .build());
    
    service_authorization_resource = fastly.ServiceAuthorization("serviceAuthorizationResource",
        permission="string",
        service_id="string",
        user_id="string")
    
    const serviceAuthorizationResource = new fastly.ServiceAuthorization("serviceAuthorizationResource", {
        permission: "string",
        serviceId: "string",
        userId: "string",
    });
    
    type: fastly:ServiceAuthorization
    properties:
        permission: string
        serviceId: string
        userId: string
    

    ServiceAuthorization Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ServiceAuthorization resource accepts the following input properties:

    Permission string
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    ServiceId string
    The ID of the service to grant permissions for.
    UserId string
    The ID of the user which will receive the granted permissions.
    Permission string
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    ServiceId string
    The ID of the service to grant permissions for.
    UserId string
    The ID of the user which will receive the granted permissions.
    permission String
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    serviceId String
    The ID of the service to grant permissions for.
    userId String
    The ID of the user which will receive the granted permissions.
    permission string
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    serviceId string
    The ID of the service to grant permissions for.
    userId string
    The ID of the user which will receive the granted permissions.
    permission str
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    service_id str
    The ID of the service to grant permissions for.
    user_id str
    The ID of the user which will receive the granted permissions.
    permission String
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    serviceId String
    The ID of the service to grant permissions for.
    userId String
    The ID of the user which will receive the granted permissions.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ServiceAuthorization resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ServiceAuthorization Resource

    Get an existing ServiceAuthorization resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ServiceAuthorizationState, opts?: CustomResourceOptions): ServiceAuthorization
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            permission: Optional[str] = None,
            service_id: Optional[str] = None,
            user_id: Optional[str] = None) -> ServiceAuthorization
    func GetServiceAuthorization(ctx *Context, name string, id IDInput, state *ServiceAuthorizationState, opts ...ResourceOption) (*ServiceAuthorization, error)
    public static ServiceAuthorization Get(string name, Input<string> id, ServiceAuthorizationState? state, CustomResourceOptions? opts = null)
    public static ServiceAuthorization get(String name, Output<String> id, ServiceAuthorizationState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Permission string
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    ServiceId string
    The ID of the service to grant permissions for.
    UserId string
    The ID of the user which will receive the granted permissions.
    Permission string
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    ServiceId string
    The ID of the service to grant permissions for.
    UserId string
    The ID of the user which will receive the granted permissions.
    permission String
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    serviceId String
    The ID of the service to grant permissions for.
    userId String
    The ID of the user which will receive the granted permissions.
    permission string
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    serviceId string
    The ID of the service to grant permissions for.
    userId string
    The ID of the user which will receive the granted permissions.
    permission str
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    service_id str
    The ID of the service to grant permissions for.
    user_id str
    The ID of the user which will receive the granted permissions.
    permission String
    The permissions to grant the user. Can be full, read_only, purge_select or purge_all.
    serviceId String
    The ID of the service to grant permissions for.
    userId String
    The ID of the user which will receive the granted permissions.

    Import

    A Fastly Service Authorization can be imported using their user ID, e.g.

    $ pulumi import fastly:index/serviceAuthorization:ServiceAuthorization demo xxxxxxxxxxxxxxxxxxxx
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Fastly pulumi/pulumi-fastly
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the fastly Terraform Provider.
    fastly logo
    Fastly v8.5.3 published on Wednesday, Apr 17, 2024 by Pulumi