Skip to content

Bucket

This class encapsulates and extends the ROS resource type ALIYUN::OSS::Bucket.

Initializers

import ros_cdk_oss
ros_cdk_oss.Bucket(
  scope: Construct,
  id: str,
  bucket_name: typing.Union[str, IResolvable],
  access_control: typing.Union[str, IResolvable] = None,
  block_public_access: typing.Union[bool, IResolvable] = None,
  cors_configuration: typing.Union[IResolvable, CORSConfigurationProperty] = None,
  deletion_force: typing.Union[bool, IResolvable] = None,
  enable_oss_hdfs_service: typing.Union[bool, IResolvable] = None,
  lifecycle_configuration: typing.Union[IResolvable, LifecycleConfigurationProperty] = None,
  logging_configuration: typing.Union[IResolvable, LoggingConfigurationProperty] = None,
  policy: typing.Union[IResolvable, typing.Mapping[typing.Any]] = None,
  redundancy_type: typing.Union[str, IResolvable] = None,
  referer_configuration: typing.Union[IResolvable, RefererConfigurationProperty] = None,
  resource_group_id: typing.Union[str, IResolvable] = None,
  server_side_encryption_configuration: typing.Union[IResolvable, ServerSideEncryptionConfigurationProperty] = None,
  storage_class: typing.Union[str, IResolvable] = None,
  tags: typing.Mapping[typing.Any] = None,
  versioning_configuration: typing.Union[IResolvable, VersioningConfigurationProperty] = None,
  website_configuration_v2: typing.Union[IResolvable, WebsiteConfigurationV2Property] = None,
  enable_resource_property_constraint: bool = None
)
Name Type Description
scope ros_cdk_core.Construct No description.
id str No description.
bucket_name typing.Union[str, ros_cdk_core.IResolvable] Property bucketName: bucket name.
access_control typing.Union[str, ros_cdk_core.IResolvable] Property accessControl: The access control list.
block_public_access typing.Union[bool, ros_cdk_core.IResolvable] Property blockPublicAccess: Whether to block public access.
cors_configuration typing.Union[ros_cdk_core.IResolvable, CORSConfigurationProperty] Property corsConfiguration: Rules that define cross-origin resource sharing of objects in this bucket.
deletion_force typing.Union[bool, ros_cdk_core.IResolvable] Property deletionForce: Whether force delete the relative objects in the bucket.
enable_oss_hdfs_service typing.Union[bool, ros_cdk_core.IResolvable] Property enableOssHdfsService: Whether enable OSS-HDFS service.
lifecycle_configuration typing.Union[ros_cdk_core.IResolvable, LifecycleConfigurationProperty] Property lifecycleConfiguration: Rules that define how oss bucket manages objects during their lifetime.
logging_configuration typing.Union[ros_cdk_core.IResolvable, LoggingConfigurationProperty] Property loggingConfiguration: Settings that defines where logs are stored.
policy typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]] Property policy: Bucket policy.
redundancy_type typing.Union[str, ros_cdk_core.IResolvable] Property redundancyType: Specifies the data disaster recovery type of the storage space.
referer_configuration typing.Union[ros_cdk_core.IResolvable, RefererConfigurationProperty] Property refererConfiguration: undefined.
resource_group_id typing.Union[str, ros_cdk_core.IResolvable] Property resourceGroupId: The resource group id.
server_side_encryption_configuration typing.Union[ros_cdk_core.IResolvable, ServerSideEncryptionConfigurationProperty] Property serverSideEncryptionConfiguration: Specifies the bucket used to store the server-side encryption rule.
storage_class typing.Union[str, ros_cdk_core.IResolvable] Property storageClass: Specifies the storage class of the bucket.
tags typing.Mapping[typing.Any] Property tags: Bucket tags in k-v pairs format.
versioning_configuration typing.Union[ros_cdk_core.IResolvable, VersioningConfigurationProperty] Property versioningConfiguration: A state of versioning.
website_configuration_v2 typing.Union[ros_cdk_core.IResolvable, WebsiteConfigurationV2Property] Property websiteConfigurationV2: Website configuration.
enable_resource_property_constraint bool No description.

scopeRequired

  • Type: ros_cdk_core.Construct

idRequired

  • Type: str

bucket_nameRequired

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property bucketName: bucket name.


access_controlOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property accessControl: The access control list.


block_public_accessOptional

  • Type: typing.Union[bool, ros_cdk_core.IResolvable]

Property blockPublicAccess: Whether to block public access.


cors_configurationOptional

Property corsConfiguration: Rules that define cross-origin resource sharing of objects in this bucket.


deletion_forceOptional

  • Type: typing.Union[bool, ros_cdk_core.IResolvable]

Property deletionForce: Whether force delete the relative objects in the bucket.

Default value is false.


enable_oss_hdfs_serviceOptional

  • Type: typing.Union[bool, ros_cdk_core.IResolvable]

Property enableOssHdfsService: Whether enable OSS-HDFS service.

Note: Once it's enabled, it can't be disabled again.


lifecycle_configurationOptional

Property lifecycleConfiguration: Rules that define how oss bucket manages objects during their lifetime.


logging_configurationOptional

Property loggingConfiguration: Settings that defines where logs are stored.


policyOptional

  • Type: typing.Union[ros_cdk_core.IResolvable, typing.Mapping[typing.Any]]

Property policy: Bucket policy.


redundancy_typeOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property redundancyType: Specifies the data disaster recovery type of the storage space.

The value range is as follows: LRS (default): Local redundant LRS stores your data redundantly on different storage devices in the same availability zone, and can support data loss and normal access even when two storage devices are damaged concurrently. ZRS: Intra-city redundant ZRS adopts a data redundancy storage mechanism in multiple availability zones (AZ), and stores user data redundantly in multiple availability zones in the same region. When an availability zone is unavailable, normal access to data can still be guaranteed.


referer_configurationOptional

Property refererConfiguration: undefined.


resource_group_idOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property resourceGroupId: The resource group id.


server_side_encryption_configurationOptional

Property serverSideEncryptionConfiguration: Specifies the bucket used to store the server-side encryption rule.


storage_classOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property storageClass: Specifies the storage class of the bucket.

Default is "Standard".


tagsOptional

  • Type: typing.Mapping[typing.Any]

Property tags: Bucket tags in k-v pairs format.


versioning_configurationOptional

Property versioningConfiguration: A state of versioning.


website_configuration_v2Optional

Property websiteConfigurationV2: Website configuration.


enable_resource_property_constraintOptional

  • Type: bool

Methods

Name Description
to_string Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
add_condition No description.
add_count No description.
add_dependency No description.
add_resource_desc No description.
apply_removal_policy No description.
fetch_condition No description.
fetch_dependency No description.
fetch_resource_desc No description.
get_att No description.
set_metadata No description.
arn_for_objects Returns an ARN that represents all objects within the bucket that match the key pattern specified.
grant_full_access Grant an RAM principal (Role/Group/User) full control over this bucket.
grant_list Grant an RAM principal (Role/Group/User) permission to list resources for this bucket.
grant_read Grant an RAM principal (Role/Group/User) permission to list and read all resources for this bucket.
grant_read_write Grant an RAM principal (Role/Group/User) permission to read and write resources for this bucket.

to_string

def to_string() -> str

Returns a string representation of this construct.

synthesize

def synthesize(
  session: ISynthesisSession
) -> None

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

sessionRequired

  • Type: ros_cdk_core.ISynthesisSession

The synthesis session.


add_condition

def add_condition(
  condition: RosCondition
) -> None

conditionRequired

  • Type: ros_cdk_core.RosCondition

add_count

def add_count(
  count: typing.Union[typing.Union[int, float], IResolvable]
) -> None

countRequired

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

add_dependency

def add_dependency(
  resource: Resource
) -> None

resourceRequired

  • Type: ros_cdk_core.Resource

add_resource_desc

def add_resource_desc(
  desc: str
) -> None

descRequired

  • Type: str

apply_removal_policy

def apply_removal_policy(
  policy: RemovalPolicy
) -> None

policyRequired

  • Type: ros_cdk_core.RemovalPolicy

fetch_condition

def fetch_condition() -> RosCondition

fetch_dependency

def fetch_dependency() -> typing.List[str]

fetch_resource_desc

def fetch_resource_desc() -> str

get_att

def get_att(
  name: str
) -> IResolvable

nameRequired

  • Type: str

set_metadata

def set_metadata(
  key: str,
  value: typing.Any
) -> None

keyRequired

  • Type: str

valueRequired

  • Type: typing.Any

arn_for_objects

def arn_for_objects(
  key_pattern: str
) -> str

Returns an ARN that represents all objects within the bucket that match the key pattern specified.

To represent all keys, specify "*".

If you need to specify a keyPattern with multiple components, concatenate them into a single string, e.g.:

arnForObjects(home/${team}/${user}/*)

key_patternRequired

  • Type: str

grant_full_access

def grant_full_access(
  identity: IPrincipal,
  objects_key_pattern: str = None
) -> ManagedPolicy

Grant an RAM principal (Role/Group/User) full control over this bucket.

identityRequired

  • Type: ros_cdk_ram.IPrincipal

The principal.


objects_key_patternOptional

  • Type: str

Restrict the permission to a certain key pattern (default '*').


grant_list

def grant_list(
  identity: IPrincipal,
  objects_key_pattern: str = None
) -> ManagedPolicy

Grant an RAM principal (Role/Group/User) permission to list resources for this bucket.

identityRequired

  • Type: ros_cdk_ram.IPrincipal

The principal.


objects_key_patternOptional

  • Type: str

Restrict the permission to a certain key pattern (default '*').


grant_read

def grant_read(
  identity: IPrincipal,
  objects_key_pattern: str = None
) -> ManagedPolicy

Grant an RAM principal (Role/Group/User) permission to list and read all resources for this bucket.

identityRequired

  • Type: ros_cdk_ram.IPrincipal

The principal.


objects_key_patternOptional

  • Type: str

Restrict the permission to a certain key pattern (default '*').


grant_read_write

def grant_read_write(
  identity: IPrincipal,
  objects_key_pattern: str = None
) -> ManagedPolicy

Grant an RAM principal (Role/Group/User) permission to read and write resources for this bucket.

identityRequired

  • Type: ros_cdk_ram.IPrincipal

The principal.


objects_key_patternOptional

  • Type: str

Restrict the permission to a certain key pattern (default '*').


Static Functions

Name Description
is_construct Return whether the given object is a Construct.
validate_bucket_name Thrown an exception if the given bucket name is not valid.

is_construct

import ros_cdk_oss
ros_cdk_oss.Bucket.is_construct(
  x: typing.Any
)

Return whether the given object is a Construct.

xRequired

  • Type: typing.Any

validate_bucket_name

import ros_cdk_oss
ros_cdk_oss.Bucket.validate_bucket_name(
  physical_name: str
)

Thrown an exception if the given bucket name is not valid.

physical_nameRequired

  • Type: str

name of the bucket.


Properties

Name Type Description
node ros_cdk_core.ConstructNode The construct tree node associated with this construct.
env ros_cdk_core.IResourceEnvironment The environment this resource belongs to.
ref str No description.
stack ros_cdk_core.Stack The stack in which this resource is defined.
resource ros_cdk_core.RosResource No description.
attr_arn typing.Union[str, ros_cdk_core.IResolvable] Attribute Arn: The Alibaba Cloud Resource Name (ARN).
attr_domain_name typing.Union[str, ros_cdk_core.IResolvable] Attribute DomainName: The public DNS name of the specified bucket.
attr_internal_domain_name typing.Union[str, ros_cdk_core.IResolvable] Attribute InternalDomainName: The internal DNS name of the specified bucket.
attr_name typing.Union[str, ros_cdk_core.IResolvable] Attribute Name: The name of Bucket.
props BucketProps No description.

nodeRequired

node: ConstructNode
  • Type: ros_cdk_core.ConstructNode

The construct tree node associated with this construct.


envRequired

env: IResourceEnvironment
  • Type: ros_cdk_core.IResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


refRequired

ref: str
  • Type: str

stackRequired

stack: Stack
  • Type: ros_cdk_core.Stack

The stack in which this resource is defined.


resourceOptional

resource: RosResource
  • Type: ros_cdk_core.RosResource

attr_arnRequired

attr_arn: typing.Union[str, IResolvable]
  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Attribute Arn: The Alibaba Cloud Resource Name (ARN).


attr_domain_nameRequired

attr_domain_name: typing.Union[str, IResolvable]
  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Attribute DomainName: The public DNS name of the specified bucket.


attr_internal_domain_nameRequired

attr_internal_domain_name: typing.Union[str, IResolvable]
  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Attribute InternalDomainName: The internal DNS name of the specified bucket.


attr_nameRequired

attr_name: typing.Union[str, IResolvable]
  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Attribute Name: The name of Bucket.


propsRequired

props: BucketProps