Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi
cloudflare.getR2BucketCors
Explore with Pulumi AI
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:
- Account
Id string - Account ID
- Bucket
Name string - Name of the bucket
- Account
Id string - Account ID
- Bucket
Name string - Name of the bucket
- account
Id String - Account ID
- bucket
Name String - Name of the bucket
- account
Id string - Account ID
- bucket
Name string - Name of the bucket
- account_
id str - Account ID
- bucket_
name str - Name of the bucket
- account
Id String - Account ID
- bucket
Name String - Name of the bucket
getR2BucketCors Result
The following output properties are available:
- Account
Id string - Account ID
- Bucket
Name string - Name of the bucket
- Id string
- The provider-assigned unique ID for this managed resource.
- Rules
List<Get
R2Bucket Cors Rule>
- Account
Id string - Account ID
- Bucket
Name string - Name of the bucket
- Id string
- The provider-assigned unique ID for this managed resource.
- Rules
[]Get
R2Bucket Cors Rule
- account
Id String - Account ID
- bucket
Name String - Name of the bucket
- id String
- The provider-assigned unique ID for this managed resource.
- rules
List<Get
R2Bucket Cors Rule>
- account
Id string - Account ID
- bucket
Name string - Name of the bucket
- id string
- The provider-assigned unique ID for this managed resource.
- rules
Get
R2Bucket Cors Rule[]
- 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[Get
R2Bucket Cors Rule]
- account
Id String - Account ID
- bucket
Name String - Name of the bucket
- id String
- The provider-assigned unique ID for this managed resource.
- rules List<Property Map>
Supporting Types
GetR2BucketCorsRule
- Allowed
Get
R2Bucket Cors Rule Allowed - Object specifying allowed origins, methods and headers for this CORS rule.
- Expose
Headers 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
- Max
Age doubleSeconds - 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
Get
R2Bucket Cors Rule Allowed - Object specifying allowed origins, methods and headers for this CORS rule.
- Expose
Headers []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
- Max
Age float64Seconds - 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
Get
R2Bucket Cors Rule Allowed - Object specifying allowed origins, methods and headers for this CORS rule.
- expose
Headers 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
- max
Age DoubleSeconds - 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
Get
R2Bucket Cors Rule Allowed - Object specifying allowed origins, methods and headers for this CORS rule.
- expose
Headers 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
- max
Age numberSeconds - 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
Get
R2Bucket Cors Rule Allowed - 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_ floatseconds - 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.
- expose
Headers 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
- max
Age NumberSeconds - 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.