All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::OSS::Directory

Last Updated:Nov 23, 2023

ALIYUN::OSS::Directory is used to create a directory for a specified bucket.

Syntax

{
  "Type": "ALIYUN::OSS::Directory",
  "Properties": {
    "BucketName": String,
    "DeletionForce": Boolean,
    "DirectoryName": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

BucketName

String

Yes

No

The bucket name.

None.

DeletionForce

Boolean

No

Yes

Specifies whether to forcibly delete the relative object in the directory.   

Valid values:

  • true

  • false (default)

DirectoryName

String

Yes

No

The directory name.

Naming conventions:

  • The directory name must be UTF-8 characters and cannot contain emoticons.

  • Forward slashes (/) are used to separate multiple paths. You can use forward slashes (/) to quickly create subdirectories. The subdirectory name cannot start with a forward slash (/) or back slash (\), and also cannot contain consecutive forward slashes (/).

  • You cannot specify two consecutive periods (..) as a subdirectory name.

  • The directory name must be 1 to 254 characters in length.

Return values

Fn::GetAtt

  • BucketName: the bucket name.

  • DirectoryName: the directory name.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      BucketName:
        Description:
          en: bucket name.
        Type: String
        Default: ros-doc-***
      DeletionForce:
        Default: false
        Description:
          en: Whether force delete the relative objects in the directory. Default value
            is false.
        Type: Boolean
      DirectoryName:
        AllowedPattern: '[^\/\\](?!//)(.*){1,254}$'
        Description:
          en: Directory name
        Type: String
        Default: test
    Resources:
      Directory:
        Properties:
          BucketName:
            Ref: BucketName
          DeletionForce:
            Ref: DeletionForce
          DirectoryName:
            Ref: DirectoryName
        Type: ALIYUN::OSS::Directory
    Outputs:
      BucketName:
        Description: The name of Bucket
        Value:
          Fn::GetAtt:
          - Directory
          - BucketName
      DirectoryName:
        Description: The name of Directory
        Value:
          Fn::GetAtt:
          - Directory
          - DirectoryName
                            
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "BucketName": {
          "Description": {
            "en": "bucket name."
          },
          "Type": "String",
          "Default": "ros-doc-***"
        },
        "DeletionForce": {
          "Default": false,
          "Description": {
            "en": "Whether force delete the relative objects in the directory. Default value is false."
          },
          "Type": "Boolean"
        },
        "DirectoryName": {
          "AllowedPattern": "[^\\/\\\\](?!//)(.*){1,254}$",
          "Description": {
            "en": "Directory name"
          },
          "Type": "String",
          "Default": "test"
        }
      },
      "Resources": {
        "Directory": {
          "Properties": {
            "BucketName": {
              "Ref": "BucketName"
            },
            "DeletionForce": {
              "Ref": "DeletionForce"
            },
            "DirectoryName": {
              "Ref": "DirectoryName"
            }
          },
          "Type": "ALIYUN::OSS::Directory"
        }
      },
      "Outputs": {
        "BucketName": {
          "Description": "The name of Bucket",
          "Value": {
            "Fn::GetAtt": [
              "Directory",
              "BucketName"
            ]
          }
        },
        "DirectoryName": {
          "Description": "The name of Directory",
          "Value": {
            "Fn::GetAtt": [
              "Directory",
              "DirectoryName"
            ]
          }
        }
      }
    }