文档

ALIYUN::OSS::Directory

更新时间:

ALIYUN::OSS::Directory类型用于为指定Bucket新建目录。

语法

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

属性

属性名称

类型

必须

允许更新

描述

约束

BucketName

String

Bucket名称。

DeletionForce

Boolean

是否强制删除目录中的相对对象。  

取值:

  • true:强制删除目录中的相对对象。

  • false(默认值):不强制删除目录中的相对对象。

DirectoryName

String

目录名称。

目录命名规范:

  • 不允许使用表情符,请使用符合要求的UTF-8字符。

  • /用于分割路径,可快速创建子目录,但不要以/\开头,不要出现连续的/

  • 不允许出现名为..的子目录。

  • 总长度控制在 1~254 个字符。

返回值

Fn::GetAtt

  • BucketName:Bucket名称。

  • DirectoryName:目录名称。

示例

  • YAML格式

    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格式

    {
      "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"
            ]
          }
        }
      }
    }