1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. getR2BucketCors
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

cloudflare.getR2BucketCors

Explore with Pulumi AI

cloudflare logo
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const exampleR2BucketCors = cloudflare.getR2BucketCors({
        accountId: "023e105f4ecef8ad9ca31a8372d0c353",
        bucketName: "example-bucket",
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example_r2_bucket_cors = cloudflare.get_r2_bucket_cors(account_id="023e105f4ecef8ad9ca31a8372d0c353",
        bucket_name="example-bucket")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v6/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudflare.LookupR2BucketCors(ctx, &cloudflare.LookupR2BucketCorsArgs{
    			AccountId:  "023e105f4ecef8ad9ca31a8372d0c353",
    			BucketName: "example-bucket",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleR2BucketCors = Cloudflare.GetR2BucketCors.Invoke(new()
        {
            AccountId = "023e105f4ecef8ad9ca31a8372d0c353",
            BucketName = "example-bucket",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.CloudflareFunctions;
    import com.pulumi.cloudflare.inputs.GetR2BucketCorsArgs;
    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 exampleR2BucketCors = CloudflareFunctions.getR2BucketCors(GetR2BucketCorsArgs.builder()
                .accountId("023e105f4ecef8ad9ca31a8372d0c353")
                .bucketName("example-bucket")
                .build());
    
        }
    }
    
    variables:
      exampleR2BucketCors:
        fn::invoke:
          function: cloudflare:getR2BucketCors
          arguments:
            accountId: 023e105f4ecef8ad9ca31a8372d0c353
            bucketName: example-bucket
    

    Using getR2BucketCors

    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 getR2BucketCors(args: GetR2BucketCorsArgs, opts?: InvokeOptions): Promise<GetR2BucketCorsResult>
    function getR2BucketCorsOutput(args: GetR2BucketCorsOutputArgs, opts?: InvokeOptions): Output<GetR2BucketCorsResult>
    def get_r2_bucket_cors(account_id: Optional[str] = None,
                           bucket_name: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetR2BucketCorsResult
    def get_r2_bucket_cors_output(account_id: Optional[pulumi.Input[str]] = None,
                           bucket_name: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetR2BucketCorsResult]
    func LookupR2BucketCors(ctx *Context, args *LookupR2BucketCorsArgs, opts ...InvokeOption) (*LookupR2BucketCorsResult, error)
    func LookupR2BucketCorsOutput(ctx *Context, args *LookupR2BucketCorsOutputArgs, opts ...InvokeOption) LookupR2BucketCorsResultOutput

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

    public static class GetR2BucketCors 
    {
        public static Task<GetR2BucketCorsResult> InvokeAsync(GetR2BucketCorsArgs args, InvokeOptions? opts = null)
        public static Output<GetR2BucketCorsResult> Invoke(GetR2BucketCorsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetR2BucketCorsResult> getR2BucketCors(GetR2BucketCorsArgs args, InvokeOptions options)
    public static Output<GetR2BucketCorsResult> getR2BucketCors(GetR2BucketCorsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: cloudflare:index/getR2BucketCors:getR2BucketCors
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AccountId string
    Account ID
    BucketName string
    Name of the bucket
    AccountId string
    Account ID
    BucketName string
    Name of the bucket
    accountId String
    Account ID
    bucketName String
    Name of the bucket
    accountId string
    Account ID
    bucketName string
    Name of the bucket
    account_id str
    Account ID
    bucket_name str
    Name of the bucket
    accountId String
    Account ID
    bucketName String
    Name of the bucket

    getR2BucketCors Result

    The following output properties are available:

    AccountId string
    Account ID
    BucketName string
    Name of the bucket
    Id string
    The provider-assigned unique ID for this managed resource.
    Rules List<GetR2BucketCorsRule>
    AccountId string
    Account ID
    BucketName string
    Name of the bucket
    Id string
    The provider-assigned unique ID for this managed resource.
    Rules []GetR2BucketCorsRule
    accountId String
    Account ID
    bucketName String
    Name of the bucket
    id String
    The provider-assigned unique ID for this managed resource.
    rules List<GetR2BucketCorsRule>
    accountId string
    Account ID
    bucketName string
    Name of the bucket
    id string
    The provider-assigned unique ID for this managed resource.
    rules GetR2BucketCorsRule[]
    account_id str
    Account ID
    bucket_name str
    Name of the bucket
    id str
    The provider-assigned unique ID for this managed resource.
    rules Sequence[GetR2BucketCorsRule]
    accountId String
    Account ID
    bucketName String
    Name of the bucket
    id String
    The provider-assigned unique ID for this managed resource.
    rules List<Property Map>

    Supporting Types

    GetR2BucketCorsRule

    Allowed GetR2BucketCorsRuleAllowed
    Object specifying allowed origins, methods and headers for this CORS rule.
    ExposeHeaders List<string>
    Specifies the headers that can be exposed back, and accessed by, the JavaScript making the cross-origin request. If you need to access headers beyond the safelisted response headers, such as Content-Encoding or cf-cache-status, you must specify it here.
    Id string
    Identifier for this rule
    MaxAgeSeconds double
    Specifies the amount of time (in seconds) browsers are allowed to cache CORS preflight responses. Browsers may limit this to 2 hours or less, even if the maximum value (86400) is specified.
    Allowed GetR2BucketCorsRuleAllowed
    Object specifying allowed origins, methods and headers for this CORS rule.
    ExposeHeaders []string
    Specifies the headers that can be exposed back, and accessed by, the JavaScript making the cross-origin request. If you need to access headers beyond the safelisted response headers, such as Content-Encoding or cf-cache-status, you must specify it here.
    Id string
    Identifier for this rule
    MaxAgeSeconds float64
    Specifies the amount of time (in seconds) browsers are allowed to cache CORS preflight responses. Browsers may limit this to 2 hours or less, even if the maximum value (86400) is specified.
    allowed GetR2BucketCorsRuleAllowed
    Object specifying allowed origins, methods and headers for this CORS rule.
    exposeHeaders List<String>
    Specifies the headers that can be exposed back, and accessed by, the JavaScript making the cross-origin request. If you need to access headers beyond the safelisted response headers, such as Content-Encoding or cf-cache-status, you must specify it here.
    id String
    Identifier for this rule
    maxAgeSeconds Double
    Specifies the amount of time (in seconds) browsers are allowed to cache CORS preflight responses. Browsers may limit this to 2 hours or less, even if the maximum value (86400) is specified.
    allowed GetR2BucketCorsRuleAllowed
    Object specifying allowed origins, methods and headers for this CORS rule.
    exposeHeaders string[]
    Specifies the headers that can be exposed back, and accessed by, the JavaScript making the cross-origin request. If you need to access headers beyond the safelisted response headers, such as Content-Encoding or cf-cache-status, you must specify it here.
    id string
    Identifier for this rule
    maxAgeSeconds number
    Specifies the amount of time (in seconds) browsers are allowed to cache CORS preflight responses. Browsers may limit this to 2 hours or less, even if the maximum value (86400) is specified.
    allowed GetR2BucketCorsRuleAllowed
    Object specifying allowed origins, methods and headers for this CORS rule.
    expose_headers Sequence[str]
    Specifies the headers that can be exposed back, and accessed by, the JavaScript making the cross-origin request. If you need to access headers beyond the safelisted response headers, such as Content-Encoding or cf-cache-status, you must specify it here.
    id str
    Identifier for this rule
    max_age_seconds float
    Specifies the amount of time (in seconds) browsers are allowed to cache CORS preflight responses. Browsers may limit this to 2 hours or less, even if the maximum value (86400) is specified.
    allowed Property Map
    Object specifying allowed origins, methods and headers for this CORS rule.
    exposeHeaders List<String>
    Specifies the headers that can be exposed back, and accessed by, the JavaScript making the cross-origin request. If you need to access headers beyond the safelisted response headers, such as Content-Encoding or cf-cache-status, you must specify it here.
    id String
    Identifier for this rule
    maxAgeSeconds Number
    Specifies the amount of time (in seconds) browsers are allowed to cache CORS preflight responses. Browsers may limit this to 2 hours or less, even if the maximum value (86400) is specified.

    GetR2BucketCorsRuleAllowed

    Headers List<string>
    Specifies the value for the Access-Control-Allow-Headers header R2 sets when requesting objects in this bucket from a browser. Cross-origin requests that include custom headers (e.g. x-user-id) should specify these headers as AllowedHeaders.
    Methods List<string>
    Specifies the value for the Access-Control-Allow-Methods header R2 sets when requesting objects in a bucket from a browser.
    Origins List<string>
    Specifies the value for the Access-Control-Allow-Origin header R2 sets when requesting objects in a bucket from a browser.
    Headers []string
    Specifies the value for the Access-Control-Allow-Headers header R2 sets when requesting objects in this bucket from a browser. Cross-origin requests that include custom headers (e.g. x-user-id) should specify these headers as AllowedHeaders.
    Methods []string
    Specifies the value for the Access-Control-Allow-Methods header R2 sets when requesting objects in a bucket from a browser.
    Origins []string
    Specifies the value for the Access-Control-Allow-Origin header R2 sets when requesting objects in a bucket from a browser.
    headers List<String>
    Specifies the value for the Access-Control-Allow-Headers header R2 sets when requesting objects in this bucket from a browser. Cross-origin requests that include custom headers (e.g. x-user-id) should specify these headers as AllowedHeaders.
    methods List<String>
    Specifies the value for the Access-Control-Allow-Methods header R2 sets when requesting objects in a bucket from a browser.
    origins List<String>
    Specifies the value for the Access-Control-Allow-Origin header R2 sets when requesting objects in a bucket from a browser.
    headers string[]
    Specifies the value for the Access-Control-Allow-Headers header R2 sets when requesting objects in this bucket from a browser. Cross-origin requests that include custom headers (e.g. x-user-id) should specify these headers as AllowedHeaders.
    methods string[]
    Specifies the value for the Access-Control-Allow-Methods header R2 sets when requesting objects in a bucket from a browser.
    origins string[]
    Specifies the value for the Access-Control-Allow-Origin header R2 sets when requesting objects in a bucket from a browser.
    headers Sequence[str]
    Specifies the value for the Access-Control-Allow-Headers header R2 sets when requesting objects in this bucket from a browser. Cross-origin requests that include custom headers (e.g. x-user-id) should specify these headers as AllowedHeaders.
    methods Sequence[str]
    Specifies the value for the Access-Control-Allow-Methods header R2 sets when requesting objects in a bucket from a browser.
    origins Sequence[str]
    Specifies the value for the Access-Control-Allow-Origin header R2 sets when requesting objects in a bucket from a browser.
    headers List<String>
    Specifies the value for the Access-Control-Allow-Headers header R2 sets when requesting objects in this bucket from a browser. Cross-origin requests that include custom headers (e.g. x-user-id) should specify these headers as AllowedHeaders.
    methods List<String>
    Specifies the value for the Access-Control-Allow-Methods header R2 sets when requesting objects in a bucket from a browser.
    origins List<String>
    Specifies the value for the Access-Control-Allow-Origin header R2 sets when requesting objects in a bucket from a browser.

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi