Skip to content

Commit

Permalink
resource/alicloud_network_acl: Fixes the Throttling error when descri…
Browse files Browse the repository at this point in the history
…bing the resources
  • Loading branch information
xiaozhu36 committed Apr 14, 2021
1 parent 4c7d46e commit 2352a26
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 22 deletions.
2 changes: 1 addition & 1 deletion alicloud/resource_alicloud_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func resourceAliyunInstance() *schema.Resource {
Optional: true,
Computed: true,
DiffSuppressFunc: ecsInternetDiffSuppressFunc,
Deprecated: "The attribute is invalid and no any affect for the instance. So it has been deprecated from version v1.122.0.",
Deprecated: "The attribute is invalid and no any affect for the instance. So it has been deprecated from version v1.121.2.",
},
"internet_max_bandwidth_out": {
Type: schema.TypeInt,
Expand Down
27 changes: 19 additions & 8 deletions alicloud/service_alicloud_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -997,17 +997,28 @@ func (s *VpcService) DescribeNetworkAcl(id string) (networkAcl vpc.NetworkAcl, e
request.RegionId = s.client.RegionId
request.NetworkAclId = id

raw, err := s.client.WithVpcClient(func(vpcClient *vpc.Client) (interface{}, error) {
return vpcClient.DescribeNetworkAcls(request)
})
if err != nil {
if IsExpectedErrors(err, []string{"InvalidNetworkAcl.NotFound"}) {
return networkAcl, WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR)
wait := incrementalWait(3*time.Second, 3*time.Second)
var response *vpc.DescribeNetworkAclsResponse
if err = resource.Retry(5*time.Minute, func() *resource.RetryError {
raw, err := s.client.WithVpcClient(func(vpcClient *vpc.Client) (interface{}, error) {
return vpcClient.DescribeNetworkAcls(request)
})
if err != nil {
if NeedRetry(err) {
wait()
return resource.RetryableError(err)
}
if IsExpectedErrors(err, []string{"InvalidNetworkAcl.NotFound"}) {
return resource.NonRetryableError(WrapErrorf(err, NotFoundMsg, AlibabaCloudSdkGoERROR))
}
return resource.NonRetryableError(err)
}
response, _ = raw.(*vpc.DescribeNetworkAclsResponse)
addDebug(request.GetActionName(), raw, request.RpcRequest, request)
return nil
}); err != nil {
return networkAcl, WrapErrorf(err, DefaultErrorMsg, id, request.GetActionName(), AlibabaCloudSdkGoERROR)
}
response, _ := raw.(*vpc.DescribeNetworkAclsResponse)
addDebug(request.GetActionName(), raw, request.RpcRequest, request)
if len(response.NetworkAcls.NetworkAcl) <= 0 || response.NetworkAcls.NetworkAcl[0].NetworkAclId != id {
return networkAcl, WrapErrorf(Error(GetNotFoundMessage("NetworkAcl", id)), NotFoundMsg, ProviderERROR)
}
Expand Down
4 changes: 2 additions & 2 deletions website/docs/d/nas_file_systems.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ The following attributes are exported in addition to the arguments listed above:
* `storage_type` - StorageType block of the FileSystem.
* `metered_size` - MeteredSize of the FileSystem.
* `create_time` - Time of creation.
* `encrypt_type` - (Optional) Whether the file system is encrypted.Valid values: `0` and `1` and `2`.
* `kms_key_id` - (Optional) The File System Kms key ID.
* `encrypt_type` - (Optional, Available in v1.121.2+) Whether the file system is encrypted.Valid values: `0` and `1` and `2`.
* `kms_key_id` - (Optional, Available in v1.121.2+) The File System Kms key ID.
13 changes: 7 additions & 6 deletions website/docs/r/nas_file_system.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ The following arguments are supported:
* `protocol_type` - (Required, ForceNew) The Protocol Type of a File System. Valid values: `NFS` and `SMB`.
* `storage_type` - (Required, ForceNew) The Storage Type of a File System. Valid values: `Capacity` and `Performance`.
* `description` - (Optional) The File System description.
* `encrypt_type` - (Optional) Whether the file system is encrypted.Using kms service escrow key to encrypt and store the file system data. When reading and writing encrypted data, there is no need to decrypt.
Valid values:
0: The file system is not encrypted.
1: The file system is encrypted with a managed secret key.
2: The file system is encrypted with the user's secret key.
* `encrypt_type` - (Optional, Available in v1.121.2+) Whether the file system is encrypted.Using kms service escrow key to encrypt and store the file system data.
When reading and writing encrypted data, there is no need to decrypt.
Valid values:
0: The file system is not encrypted.
1: The file system is encrypted with a managed secret key.
2: The file system is encrypted with the user's secret key.

* `kms_key_id` - (Optional) The File System Kms key ID.If encrypt_type = 2, you need to pass this parameter
* `kms_key_id` - (Optional, Available in v1.121.2+) The File System Kms key ID.If encrypt_type = 2, you need to pass this parameter

## Attributes Reference

Expand Down
10 changes: 5 additions & 5 deletions website/docs/r/oss_bucket.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ The lifecycle_rule object supports the following:
* `enabled` - (Required, Type: bool) Specifies lifecycle rule status.
* `expiration` - (Optional, Type: set) Specifies a period in the object's expire (documented below).
* `transitions` - (Optional, Type: set, Available in 1.62.1+) Specifies the time when an object is converted to the IA or archive storage class during a valid life cycle. (documented below).
* `abort_multipart_upload` - (Optional, Type: set, Available in 1.122.0+) Specifies the number of days after initiating a multipart upload when the multipart upload must be completed (documented below).
* `noncurrent_version_expiration` - (Optional, Type: set, Available in 1.122.0+) Specifies when noncurrent object versions expire (documented below).
* `noncurrent_version_transition` - (Optional, Type: set, Available in 1.122.0+) Specifies when noncurrent object versions transitions (documented below).
* `abort_multipart_upload` - (Optional, Type: set, Available in 1.121.2+) Specifies the number of days after initiating a multipart upload when the multipart upload must be completed (documented below).
* `noncurrent_version_expiration` - (Optional, Type: set, Available in 1.121.2+) Specifies when noncurrent object versions expire (documented below).
* `noncurrent_version_transition` - (Optional, Type: set, Available in 1.121.2+) Specifies when noncurrent object versions transitions (documented below).

`NOTE`: At least one of expiration, transitions, abort_multipart_upload, noncurrent_version_expiration and noncurrent_version_transition should be configured.

Expand All @@ -348,8 +348,8 @@ The lifecycle_rule expiration object supports the following:

* `date` - (Optional) Specifies the date after which you want the corresponding action to take effect. The value obeys ISO8601 format like `2017-03-09`.
* `days` - (Optional, Type: int) Specifies the number of days after object creation when the specific rule action takes effect.
* `created_before_date` - (Optional, Available in 1.122.0+) Specifies the time before which the rules take effect. The date must conform to the ISO8601 format and always be UTC 00:00. For example: 2002-10-11T00:00:00.000Z indicates that objects updated before 2002-10-11T00:00:00.000Z are deleted or converted to another storage class, and objects updated after this time (including this time) are not deleted or converted.
* `expired_object_delete_markers` - (Optional, Type: bool, Available in 1.122.0+) On a versioned bucket (versioning-enabled or versioning-suspended bucket), you can add this element in the lifecycle configuration to direct OSS to delete expired object delete markers. This cannot be specified with Days, Date or CreatedBeforeDate in a Lifecycle Expiration Policy.
* `created_before_date` - (Optional, Available in 1.121.2+) Specifies the time before which the rules take effect. The date must conform to the ISO8601 format and always be UTC 00:00. For example: 2002-10-11T00:00:00.000Z indicates that objects updated before 2002-10-11T00:00:00.000Z are deleted or converted to another storage class, and objects updated after this time (including this time) are not deleted or converted.
* `expired_object_delete_markers` - (Optional, Type: bool, Available in 1.121.2+) On a versioned bucket (versioning-enabled or versioning-suspended bucket), you can add this element in the lifecycle configuration to direct OSS to delete expired object delete markers. This cannot be specified with Days, Date or CreatedBeforeDate in a Lifecycle Expiration Policy.

`NOTE`: One and only one of "date", "days", "created_before_date" and "expired_object_delete_markers" can be specified in one expiration configuration.

Expand Down

0 comments on commit 2352a26

Please sign in to comment.