in alicloud/resource_alicloud_oss_bucket.go [17:493]
func resourceAlicloudOssBucket() *schema.Resource {
return &schema.Resource{
Create: resourceAlicloudOssBucketCreate,
Read: resourceAlicloudOssBucketRead,
Update: resourceAlicloudOssBucketUpdate,
Delete: resourceAlicloudOssBucketDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"bucket": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
ValidateFunc: StringLenBetween(3, 63),
},
"acl": {
Type: schema.TypeString,
Computed: true,
Optional: true,
ValidateFunc: StringInSlice([]string{"private", "public-read", "public-read-write"}, false),
Deprecated: "Field 'acl' has been deprecated since provider version 1.220.0. New resource 'alicloud_oss_bucket_acl' instead.",
},
"cors_rule": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"allowed_headers": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"allowed_methods": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"allowed_origins": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"expose_headers": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"max_age_seconds": {
Type: schema.TypeInt,
Optional: true,
},
},
},
MaxItems: 10,
},
"website": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"index_document": {
Type: schema.TypeString,
Required: true,
},
"error_document": {
Type: schema.TypeString,
Optional: true,
},
},
},
MaxItems: 1,
},
"logging": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"target_bucket": {
Type: schema.TypeString,
Required: true,
},
"target_prefix": {
Type: schema.TypeString,
Optional: true,
},
},
},
MaxItems: 1,
},
"logging_isenable": {
Type: schema.TypeBool,
Optional: true,
Deprecated: "Deprecated from 1.37.0. When `logging` is set, the bucket logging will be able.",
},
"referer_config": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"allow_empty": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
"referers": {
Type: schema.TypeList,
Required: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
MaxItems: 1,
},
"lifecycle_rule_allow_same_action_overlap": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"lifecycle_rule": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: StringLenBetween(0, 255),
},
"prefix": {
Type: schema.TypeString,
Optional: true,
Default: "",
},
"enabled": {
Type: schema.TypeBool,
Required: true,
},
"expiration": {
Type: schema.TypeSet,
Optional: true,
Set: expirationHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"date": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateOssBucketDateTimestamp,
},
"created_before_date": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateOssBucketDateTimestamp,
},
"days": {
Type: schema.TypeInt,
Optional: true,
},
"expired_object_delete_marker": {
Type: schema.TypeBool,
Optional: true,
},
},
},
},
"transitions": {
Type: schema.TypeSet,
Optional: true,
Set: transitionsHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"created_before_date": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateOssBucketDateTimestamp,
},
"days": {
Type: schema.TypeInt,
Optional: true,
},
"storage_class": {
Type: schema.TypeString,
Required: true,
ValidateFunc: StringInSlice([]string{
string(oss.StorageStandard),
string(oss.StorageIA),
string(oss.StorageArchive),
string(oss.StorageColdArchive),
string(oss.StorageDeepColdArchive),
}, false),
},
"is_access_time": {
Type: schema.TypeBool,
Optional: true,
},
"return_to_std_when_visit": {
Type: schema.TypeBool,
Optional: true,
},
},
},
},
"abort_multipart_upload": {
Type: schema.TypeSet,
Optional: true,
Set: abortMultipartUploadHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"created_before_date": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateOssBucketDateTimestamp,
},
"days": {
Type: schema.TypeInt,
Optional: true,
},
},
},
},
"noncurrent_version_expiration": {
Type: schema.TypeSet,
Optional: true,
Set: expirationHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"days": {
Type: schema.TypeInt,
Required: true,
},
},
},
},
"noncurrent_version_transition": {
Type: schema.TypeSet,
Optional: true,
Set: transitionsHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"days": {
Type: schema.TypeInt,
Required: true,
},
"storage_class": {
Type: schema.TypeString,
Required: true,
ValidateFunc: StringInSlice([]string{
string(oss.StorageStandard),
string(oss.StorageIA),
string(oss.StorageArchive),
string(oss.StorageColdArchive),
string(oss.StorageDeepColdArchive),
}, false),
},
"is_access_time": {
Type: schema.TypeBool,
Optional: true,
},
"return_to_std_when_visit": {
Type: schema.TypeBool,
Optional: true,
},
},
},
},
"tags": tagsSchema(),
"filter": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"not": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"prefix": {
Type: schema.TypeString,
Optional: true,
},
"tag": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Required: true,
},
"value": {
Type: schema.TypeString,
Required: true,
},
},
},
},
},
},
},
"object_size_greater_than": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: IntAtLeast(1),
},
"object_size_less_than": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: IntAtLeast(1),
},
},
},
},
},
},
MaxItems: 1000,
},
"policy": {
Type: schema.TypeString,
Optional: true,
},
"creation_date": {
Type: schema.TypeString,
Computed: true,
},
"extranet_endpoint": {
Type: schema.TypeString,
Computed: true,
},
"intranet_endpoint": {
Type: schema.TypeString,
Computed: true,
},
"location": {
Type: schema.TypeString,
Computed: true,
},
"owner": {
Type: schema.TypeString,
Computed: true,
},
"storage_class": {
Type: schema.TypeString,
Default: oss.StorageStandard,
Optional: true,
ForceNew: true,
ValidateFunc: StringInSlice([]string{
string(oss.StorageStandard),
string(oss.StorageIA),
string(oss.StorageArchive),
string(oss.StorageColdArchive),
string(oss.StorageDeepColdArchive),
}, false),
},
"redundancy_type": {
Type: schema.TypeString,
Default: oss.RedundancyLRS,
Optional: true,
ForceNew: true,
ValidateFunc: StringInSlice([]string{
string(oss.RedundancyLRS),
string(oss.RedundancyZRS),
}, false),
},
"server_side_encryption_rule": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"sse_algorithm": {
Type: schema.TypeString,
Required: true,
ValidateFunc: StringInSlice([]string{
ServerSideEncryptionAes256,
ServerSideEncryptionKMS,
ServerSideEncryptionSM4,
}, false),
},
"kms_master_key_id": {
Type: schema.TypeString,
Optional: true,
},
"kms_data_encryption": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: StringInSlice([]string{
ServerSideEncryptionSM4,
"",
}, false),
},
},
},
MaxItems: 1,
},
"tags": tagsSchema(),
"force_destroy": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"versioning": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"status": {
Type: schema.TypeString,
Required: true,
ValidateFunc: StringInSlice([]string{
"Enabled",
"Suspended",
}, false),
},
},
},
MaxItems: 1,
},
"transfer_acceleration": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Required: true,
},
},
},
MaxItems: 1,
},
"access_monitor": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"status": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: StringInSlice([]string{
"Enabled",
"Disabled",
}, false),
},
},
},
MaxItems: 1,
},
"resource_group_id": {
Type: schema.TypeString,
Computed: true,
Optional: true,
},
},
}
}