1. Packages
  2. Scaleway
  3. API Docs
  4. object
  5. getBucketPolicy
Scaleway v1.26.0 published on Friday, Mar 28, 2025 by pulumiverse

scaleway.object.getBucketPolicy

Explore with Pulumi AI

The scaleway.object.BucketPolicy data source is used to retrieve information about the bucket policy of an Object Storage bucket.

Refer to the Object Storage documentation for more information.

Retrieve the bucket policy of a bucket

The following command allows you to retrieve a bucket policy by its bucket.

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumi/scaleway";

const main = scaleway.object.getBucketPolicy({
    bucket: "bucket.test.com",
});
Copy
import pulumi
import pulumi_scaleway as scaleway

main = scaleway.object.get_bucket_policy(bucket="bucket.test.com")
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/object"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := object.LookupBucketPolicy(ctx, &object.LookupBucketPolicyArgs{
			Bucket: "bucket.test.com",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumi.Scaleway;

return await Deployment.RunAsync(() => 
{
    var main = Scaleway.Object.GetBucketPolicy.Invoke(new()
    {
        Bucket = "bucket.test.com",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.object.ObjectFunctions;
import com.pulumi.scaleway.object.inputs.GetBucketPolicyArgs;
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 main = ObjectFunctions.getBucketPolicy(GetBucketPolicyArgs.builder()
            .bucket("bucket.test.com")
            .build());

    }
}
Copy
variables:
  main:
    fn::invoke:
      function: scaleway:object:getBucketPolicy
      arguments:
        bucket: bucket.test.com
Copy

Using getBucketPolicy

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 getBucketPolicy(args: GetBucketPolicyArgs, opts?: InvokeOptions): Promise<GetBucketPolicyResult>
function getBucketPolicyOutput(args: GetBucketPolicyOutputArgs, opts?: InvokeOptions): Output<GetBucketPolicyResult>
Copy
def get_bucket_policy(bucket: Optional[str] = None,
                      project_id: Optional[str] = None,
                      region: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetBucketPolicyResult
def get_bucket_policy_output(bucket: Optional[pulumi.Input[str]] = None,
                      project_id: Optional[pulumi.Input[str]] = None,
                      region: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetBucketPolicyResult]
Copy
func LookupBucketPolicy(ctx *Context, args *LookupBucketPolicyArgs, opts ...InvokeOption) (*LookupBucketPolicyResult, error)
func LookupBucketPolicyOutput(ctx *Context, args *LookupBucketPolicyOutputArgs, opts ...InvokeOption) LookupBucketPolicyResultOutput
Copy

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

public static class GetBucketPolicy 
{
    public static Task<GetBucketPolicyResult> InvokeAsync(GetBucketPolicyArgs args, InvokeOptions? opts = null)
    public static Output<GetBucketPolicyResult> Invoke(GetBucketPolicyInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetBucketPolicyResult> getBucketPolicy(GetBucketPolicyArgs args, InvokeOptions options)
public static Output<GetBucketPolicyResult> getBucketPolicy(GetBucketPolicyArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: scaleway:object/getBucketPolicy:getBucketPolicy
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Bucket This property is required. string
The name of the bucket.
ProjectId string
Region string
region) The region in which the Object Storage exists.
Bucket This property is required. string
The name of the bucket.
ProjectId string
Region string
region) The region in which the Object Storage exists.
bucket This property is required. String
The name of the bucket.
projectId String
region String
region) The region in which the Object Storage exists.
bucket This property is required. string
The name of the bucket.
projectId string
region string
region) The region in which the Object Storage exists.
bucket This property is required. str
The name of the bucket.
project_id str
region str
region) The region in which the Object Storage exists.
bucket This property is required. String
The name of the bucket.
projectId String
region String
region) The region in which the Object Storage exists.

getBucketPolicy Result

The following output properties are available:

Bucket string
Id string
The provider-assigned unique ID for this managed resource.
Policy string
The content of the bucket policy in JSON format.
ProjectId string
Region string
Bucket string
Id string
The provider-assigned unique ID for this managed resource.
Policy string
The content of the bucket policy in JSON format.
ProjectId string
Region string
bucket String
id String
The provider-assigned unique ID for this managed resource.
policy String
The content of the bucket policy in JSON format.
projectId String
region String
bucket string
id string
The provider-assigned unique ID for this managed resource.
policy string
The content of the bucket policy in JSON format.
projectId string
region string
bucket str
id str
The provider-assigned unique ID for this managed resource.
policy str
The content of the bucket policy in JSON format.
project_id str
region str
bucket String
id String
The provider-assigned unique ID for this managed resource.
policy String
The content of the bucket policy in JSON format.
projectId String
region String

Package Details

Repository
scaleway pulumiverse/pulumi-scaleway
License
Apache-2.0
Notes
This Pulumi package is based on the scaleway Terraform Provider.