1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. oss
  5. BucketStyle
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.oss.BucketStyle

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

    Provides a OSS Bucket Style resource.

    Image styles that contain single or multiple image processing parameters.

    For information about OSS Bucket Style and how to use it, see What is Bucket Style.

    NOTE: Available since v1.245.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = new random.index.Integer("default", {
        min: 10000,
        max: 99999,
    });
    const createBucket = new alicloud.oss.Bucket("CreateBucket", {
        storageClass: "Standard",
        bucket: `${name}-${_default.result}`,
    });
    const defaultBucketStyle = new alicloud.oss.BucketStyle("default", {
        bucket: createBucket.id,
        styleName: "style-933",
        content: "image/resize,p_75,w_75",
        category: "document",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = random.index.Integer("default",
        min=10000,
        max=99999)
    create_bucket = alicloud.oss.Bucket("CreateBucket",
        storage_class="Standard",
        bucket=f"{name}-{default['result']}")
    default_bucket_style = alicloud.oss.BucketStyle("default",
        bucket=create_bucket.id,
        style_name="style-933",
        content="image/resize,p_75,w_75",
        category="document")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oss"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Min: 10000,
    			Max: 99999,
    		})
    		if err != nil {
    			return err
    		}
    		createBucket, err := oss.NewBucket(ctx, "CreateBucket", &oss.BucketArgs{
    			StorageClass: pulumi.String("Standard"),
    			Bucket:       pulumi.Sprintf("%v-%v", name, _default.Result),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = oss.NewBucketStyle(ctx, "default", &oss.BucketStyleArgs{
    			Bucket:    createBucket.ID(),
    			StyleName: pulumi.String("style-933"),
    			Content:   pulumi.String("image/resize,p_75,w_75"),
    			Category:  pulumi.String("document"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = new Random.Index.Integer("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var createBucket = new AliCloud.Oss.Bucket("CreateBucket", new()
        {
            StorageClass = "Standard",
            BucketName = $"{name}-{@default.Result}",
        });
    
        var defaultBucketStyle = new AliCloud.Oss.BucketStyle("default", new()
        {
            Bucket = createBucket.Id,
            StyleName = "style-933",
            Content = "image/resize,p_75,w_75",
            Category = "document",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.oss.Bucket;
    import com.pulumi.alicloud.oss.BucketArgs;
    import com.pulumi.alicloud.oss.BucketStyle;
    import com.pulumi.alicloud.oss.BucketStyleArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var default_ = new Integer("default", IntegerArgs.builder()
                .min(10000)
                .max(99999)
                .build());
    
            var createBucket = new Bucket("createBucket", BucketArgs.builder()
                .storageClass("Standard")
                .bucket(String.format("%s-%s", name,default_.result()))
                .build());
    
            var defaultBucketStyle = new BucketStyle("defaultBucketStyle", BucketStyleArgs.builder()
                .bucket(createBucket.id())
                .styleName("style-933")
                .content("image/resize,p_75,w_75")
                .category("document")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      default:
        type: random:integer
        properties:
          min: 10000
          max: 99999
      createBucket:
        type: alicloud:oss:Bucket
        name: CreateBucket
        properties:
          storageClass: Standard
          bucket: ${name}-${default.result}
      defaultBucketStyle:
        type: alicloud:oss:BucketStyle
        name: default
        properties:
          bucket: ${createBucket.id}
          styleName: style-933
          content: image/resize,p_75,w_75
          category: document
    

    Create BucketStyle Resource

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

    Constructor syntax

    new BucketStyle(name: string, args: BucketStyleArgs, opts?: CustomResourceOptions);
    @overload
    def BucketStyle(resource_name: str,
                    args: BucketStyleArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def BucketStyle(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    bucket: Optional[str] = None,
                    content: Optional[str] = None,
                    style_name: Optional[str] = None,
                    category: Optional[str] = None)
    func NewBucketStyle(ctx *Context, name string, args BucketStyleArgs, opts ...ResourceOption) (*BucketStyle, error)
    public BucketStyle(string name, BucketStyleArgs args, CustomResourceOptions? opts = null)
    public BucketStyle(String name, BucketStyleArgs args)
    public BucketStyle(String name, BucketStyleArgs args, CustomResourceOptions options)
    
    type: alicloud:oss:BucketStyle
    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 BucketStyleArgs
    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 BucketStyleArgs
    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 BucketStyleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BucketStyleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BucketStyleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var bucketStyleResource = new AliCloud.Oss.BucketStyle("bucketStyleResource", new()
    {
        Bucket = "string",
        Content = "string",
        StyleName = "string",
        Category = "string",
    });
    
    example, err := oss.NewBucketStyle(ctx, "bucketStyleResource", &oss.BucketStyleArgs{
    	Bucket:    pulumi.String("string"),
    	Content:   pulumi.String("string"),
    	StyleName: pulumi.String("string"),
    	Category:  pulumi.String("string"),
    })
    
    var bucketStyleResource = new BucketStyle("bucketStyleResource", BucketStyleArgs.builder()
        .bucket("string")
        .content("string")
        .styleName("string")
        .category("string")
        .build());
    
    bucket_style_resource = alicloud.oss.BucketStyle("bucketStyleResource",
        bucket="string",
        content="string",
        style_name="string",
        category="string")
    
    const bucketStyleResource = new alicloud.oss.BucketStyle("bucketStyleResource", {
        bucket: "string",
        content: "string",
        styleName: "string",
        category: "string",
    });
    
    type: alicloud:oss:BucketStyle
    properties:
        bucket: string
        category: string
        content: string
        styleName: string
    

    BucketStyle Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The BucketStyle resource accepts the following input properties:

    Bucket string
    Storage space to which the picture style belongs
    Content string
    The Image style content can contain single or multiple image processing parameters.
    StyleName string
    Image Style Name
    Category string
    Style category, valid values: image, document, video.
    Bucket string
    Storage space to which the picture style belongs
    Content string
    The Image style content can contain single or multiple image processing parameters.
    StyleName string
    Image Style Name
    Category string
    Style category, valid values: image, document, video.
    bucket String
    Storage space to which the picture style belongs
    content String
    The Image style content can contain single or multiple image processing parameters.
    styleName String
    Image Style Name
    category String
    Style category, valid values: image, document, video.
    bucket string
    Storage space to which the picture style belongs
    content string
    The Image style content can contain single or multiple image processing parameters.
    styleName string
    Image Style Name
    category string
    Style category, valid values: image, document, video.
    bucket str
    Storage space to which the picture style belongs
    content str
    The Image style content can contain single or multiple image processing parameters.
    style_name str
    Image Style Name
    category str
    Style category, valid values: image, document, video.
    bucket String
    Storage space to which the picture style belongs
    content String
    The Image style content can contain single or multiple image processing parameters.
    styleName String
    Image Style Name
    category String
    Style category, valid values: image, document, video.

    Outputs

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

    CreateTime string
    Image Style Creation Time
    Id string
    The provider-assigned unique ID for this managed resource.
    CreateTime string
    Image Style Creation Time
    Id string
    The provider-assigned unique ID for this managed resource.
    createTime String
    Image Style Creation Time
    id String
    The provider-assigned unique ID for this managed resource.
    createTime string
    Image Style Creation Time
    id string
    The provider-assigned unique ID for this managed resource.
    create_time str
    Image Style Creation Time
    id str
    The provider-assigned unique ID for this managed resource.
    createTime String
    Image Style Creation Time
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing BucketStyle Resource

    Get an existing BucketStyle 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?: BucketStyleState, opts?: CustomResourceOptions): BucketStyle
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket: Optional[str] = None,
            category: Optional[str] = None,
            content: Optional[str] = None,
            create_time: Optional[str] = None,
            style_name: Optional[str] = None) -> BucketStyle
    func GetBucketStyle(ctx *Context, name string, id IDInput, state *BucketStyleState, opts ...ResourceOption) (*BucketStyle, error)
    public static BucketStyle Get(string name, Input<string> id, BucketStyleState? state, CustomResourceOptions? opts = null)
    public static BucketStyle get(String name, Output<String> id, BucketStyleState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:oss:BucketStyle    get:      id: ${id}
    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:
    Bucket string
    Storage space to which the picture style belongs
    Category string
    Style category, valid values: image, document, video.
    Content string
    The Image style content can contain single or multiple image processing parameters.
    CreateTime string
    Image Style Creation Time
    StyleName string
    Image Style Name
    Bucket string
    Storage space to which the picture style belongs
    Category string
    Style category, valid values: image, document, video.
    Content string
    The Image style content can contain single or multiple image processing parameters.
    CreateTime string
    Image Style Creation Time
    StyleName string
    Image Style Name
    bucket String
    Storage space to which the picture style belongs
    category String
    Style category, valid values: image, document, video.
    content String
    The Image style content can contain single or multiple image processing parameters.
    createTime String
    Image Style Creation Time
    styleName String
    Image Style Name
    bucket string
    Storage space to which the picture style belongs
    category string
    Style category, valid values: image, document, video.
    content string
    The Image style content can contain single or multiple image processing parameters.
    createTime string
    Image Style Creation Time
    styleName string
    Image Style Name
    bucket str
    Storage space to which the picture style belongs
    category str
    Style category, valid values: image, document, video.
    content str
    The Image style content can contain single or multiple image processing parameters.
    create_time str
    Image Style Creation Time
    style_name str
    Image Style Name
    bucket String
    Storage space to which the picture style belongs
    category String
    Style category, valid values: image, document, video.
    content String
    The Image style content can contain single or multiple image processing parameters.
    createTime String
    Image Style Creation Time
    styleName String
    Image Style Name

    Import

    OSS Bucket Style can be imported using the id, e.g.

    $ pulumi import alicloud:oss/bucketStyle:BucketStyle example <bucket>:<style_name>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi