1. Packages
  2. Fastly Provider
  3. API Docs
  4. getVclSnippets
Fastly v8.11.1 published on Monday, Sep 16, 2024 by Pulumi

fastly.getVclSnippets

Explore with Pulumi AI

fastly logo
Fastly v8.11.1 published on Monday, Sep 16, 2024 by Pulumi

    VCL Snippets are blocks of VCL logic inserted into your service’s configuration that don’t require custom VCL.

    Use this data source to get a list of Fastly VCL Snippets for the specified service/version.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    const exampleServiceVcl = new fastly.ServiceVcl("example", {
        name: "Example Service",
        domains: [{
            name: "example.com",
        }],
        forceDestroy: true,
    });
    const example = fastly.getVclSnippetsOutput({
        serviceId: exampleServiceVcl.id,
        serviceVersion: exampleServiceVcl.activeVersion,
    });
    export const serviceVclSnippets = example;
    
    import pulumi
    import pulumi_fastly as fastly
    
    example_service_vcl = fastly.ServiceVcl("example",
        name="Example Service",
        domains=[{
            "name": "example.com",
        }],
        force_destroy=True)
    example = fastly.get_vcl_snippets_output(service_id=example_service_vcl.id,
        service_version=example_service_vcl.active_version)
    pulumi.export("serviceVclSnippets", example)
    
    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 {
    		exampleServiceVcl, err := fastly.NewServiceVcl(ctx, "example", &fastly.ServiceVclArgs{
    			Name: pulumi.String("Example Service"),
    			Domains: fastly.ServiceVclDomainArray{
    				&fastly.ServiceVclDomainArgs{
    					Name: pulumi.String("example.com"),
    				},
    			},
    			ForceDestroy: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		example := fastly.GetVclSnippetsOutput(ctx, fastly.GetVclSnippetsOutputArgs{
    			ServiceId:      exampleServiceVcl.ID(),
    			ServiceVersion: exampleServiceVcl.ActiveVersion,
    		}, nil)
    		ctx.Export("serviceVclSnippets", example)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleServiceVcl = new Fastly.ServiceVcl("example", new()
        {
            Name = "Example Service",
            Domains = new[]
            {
                new Fastly.Inputs.ServiceVclDomainArgs
                {
                    Name = "example.com",
                },
            },
            ForceDestroy = true,
        });
    
        var example = Fastly.GetVclSnippets.Invoke(new()
        {
            ServiceId = exampleServiceVcl.Id,
            ServiceVersion = exampleServiceVcl.ActiveVersion,
        });
    
        return new Dictionary<string, object?>
        {
            ["serviceVclSnippets"] = example,
        };
    });
    
    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.ServiceVclArgs;
    import com.pulumi.fastly.inputs.ServiceVclDomainArgs;
    import com.pulumi.fastly.FastlyFunctions;
    import com.pulumi.fastly.inputs.GetVclSnippetsArgs;
    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 exampleServiceVcl = new ServiceVcl("exampleServiceVcl", ServiceVclArgs.builder()
                .name("Example Service")
                .domains(ServiceVclDomainArgs.builder()
                    .name("example.com")
                    .build())
                .forceDestroy(true)
                .build());
    
            final var example = FastlyFunctions.getVclSnippets(GetVclSnippetsArgs.builder()
                .serviceId(exampleServiceVcl.id())
                .serviceVersion(exampleServiceVcl.activeVersion())
                .build());
    
            ctx.export("serviceVclSnippets", example.applyValue(getVclSnippetsResult -> getVclSnippetsResult));
        }
    }
    
    resources:
      exampleServiceVcl:
        type: fastly:ServiceVcl
        name: example
        properties:
          name: Example Service
          domains:
            - name: example.com
          forceDestroy: true
    variables:
      example:
        fn::invoke:
          Function: fastly:getVclSnippets
          Arguments:
            serviceId: ${exampleServiceVcl.id}
            serviceVersion: ${exampleServiceVcl.activeVersion}
    outputs:
      serviceVclSnippets: ${example}
    

    Using getVclSnippets

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getVclSnippets(args: GetVclSnippetsArgs, opts?: InvokeOptions): Promise<GetVclSnippetsResult>
    function getVclSnippetsOutput(args: GetVclSnippetsOutputArgs, opts?: InvokeOptions): Output<GetVclSnippetsResult>
    def get_vcl_snippets(service_id: Optional[str] = None,
                         service_version: Optional[int] = None,
                         opts: Optional[InvokeOptions] = None) -> GetVclSnippetsResult
    def get_vcl_snippets_output(service_id: Optional[pulumi.Input[str]] = None,
                         service_version: Optional[pulumi.Input[int]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetVclSnippetsResult]
    func GetVclSnippets(ctx *Context, args *GetVclSnippetsArgs, opts ...InvokeOption) (*GetVclSnippetsResult, error)
    func GetVclSnippetsOutput(ctx *Context, args *GetVclSnippetsOutputArgs, opts ...InvokeOption) GetVclSnippetsResultOutput

    > Note: This function is named GetVclSnippets in the Go SDK.

    public static class GetVclSnippets 
    {
        public static Task<GetVclSnippetsResult> InvokeAsync(GetVclSnippetsArgs args, InvokeOptions? opts = null)
        public static Output<GetVclSnippetsResult> Invoke(GetVclSnippetsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVclSnippetsResult> getVclSnippets(GetVclSnippetsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: fastly:index/getVclSnippets:getVclSnippets
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ServiceId string
    Alphanumeric string identifying the service.
    ServiceVersion int
    Integer identifying a service version.
    ServiceId string
    Alphanumeric string identifying the service.
    ServiceVersion int
    Integer identifying a service version.
    serviceId String
    Alphanumeric string identifying the service.
    serviceVersion Integer
    Integer identifying a service version.
    serviceId string
    Alphanumeric string identifying the service.
    serviceVersion number
    Integer identifying a service version.
    service_id str
    Alphanumeric string identifying the service.
    service_version int
    Integer identifying a service version.
    serviceId String
    Alphanumeric string identifying the service.
    serviceVersion Number
    Integer identifying a service version.

    getVclSnippets Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    ServiceId string
    Alphanumeric string identifying the service.
    ServiceVersion int
    Integer identifying a service version.
    VclSnippets List<GetVclSnippetsVclSnippet>
    List of all VCL snippets for the version of the service.
    Id string
    The provider-assigned unique ID for this managed resource.
    ServiceId string
    Alphanumeric string identifying the service.
    ServiceVersion int
    Integer identifying a service version.
    VclSnippets []GetVclSnippetsVclSnippet
    List of all VCL snippets for the version of the service.
    id String
    The provider-assigned unique ID for this managed resource.
    serviceId String
    Alphanumeric string identifying the service.
    serviceVersion Integer
    Integer identifying a service version.
    vclSnippets List<GetVclSnippetsVclSnippet>
    List of all VCL snippets for the version of the service.
    id string
    The provider-assigned unique ID for this managed resource.
    serviceId string
    Alphanumeric string identifying the service.
    serviceVersion number
    Integer identifying a service version.
    vclSnippets GetVclSnippetsVclSnippet[]
    List of all VCL snippets for the version of the service.
    id str
    The provider-assigned unique ID for this managed resource.
    service_id str
    Alphanumeric string identifying the service.
    service_version int
    Integer identifying a service version.
    vcl_snippets Sequence[GetVclSnippetsVclSnippet]
    List of all VCL snippets for the version of the service.
    id String
    The provider-assigned unique ID for this managed resource.
    serviceId String
    Alphanumeric string identifying the service.
    serviceVersion Number
    Integer identifying a service version.
    vclSnippets List<Property Map>
    List of all VCL snippets for the version of the service.

    Supporting Types

    GetVclSnippetsVclSnippet

    Content string
    The VCL code that specifies exactly what the snippet does.
    Id string
    Alphanumeric string identifying a VCL Snippet.
    Name string
    The name for the snippet.
    Priority int
    Priority determines execution order. Lower numbers execute first.
    Type string
    The location in generated VCL where the snippet should be placed.
    Content string
    The VCL code that specifies exactly what the snippet does.
    Id string
    Alphanumeric string identifying a VCL Snippet.
    Name string
    The name for the snippet.
    Priority int
    Priority determines execution order. Lower numbers execute first.
    Type string
    The location in generated VCL where the snippet should be placed.
    content String
    The VCL code that specifies exactly what the snippet does.
    id String
    Alphanumeric string identifying a VCL Snippet.
    name String
    The name for the snippet.
    priority Integer
    Priority determines execution order. Lower numbers execute first.
    type String
    The location in generated VCL where the snippet should be placed.
    content string
    The VCL code that specifies exactly what the snippet does.
    id string
    Alphanumeric string identifying a VCL Snippet.
    name string
    The name for the snippet.
    priority number
    Priority determines execution order. Lower numbers execute first.
    type string
    The location in generated VCL where the snippet should be placed.
    content str
    The VCL code that specifies exactly what the snippet does.
    id str
    Alphanumeric string identifying a VCL Snippet.
    name str
    The name for the snippet.
    priority int
    Priority determines execution order. Lower numbers execute first.
    type str
    The location in generated VCL where the snippet should be placed.
    content String
    The VCL code that specifies exactly what the snippet does.
    id String
    Alphanumeric string identifying a VCL Snippet.
    name String
    The name for the snippet.
    priority Number
    Priority determines execution order. Lower numbers execute first.
    type String
    The location in generated VCL where the snippet should be placed.

    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.11.1 published on Monday, Sep 16, 2024 by Pulumi