-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add data source of obs bucket object #482
Conversation
f947030
to
85c9055
Compare
huaweicloud/provider.go
Outdated
@@ -244,6 +244,7 @@ func Provider() terraform.ResourceProvider { | |||
"huaweicloud_identity_role_v3": dataSourceIdentityRoleV3(), | |||
"huaweicloud_cdm_flavors_v1": dataSourceCdmFlavorV1(), | |||
"huaweicloud_dis_partition_v2": dataSourceDisPartitionV2(), | |||
"huaweicloud_obs_bucket_object": dataSourceObsBucketObject(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to L202.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to L202.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a small suggestion inline.
efdb20c
to
af82f44
Compare
"body": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the recommended order in Schema: Required --> Optional --> Computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
if resp.Body != nil { | ||
body, err := ioutil.ReadAll(resp.Body) | ||
if err != nil { | ||
return getObsError("Error get body of OBS bucket object", bucket, err) | ||
} | ||
d.Set("body", string(body)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content of an object maybe very large, please do some test on a huge object, thanks
"github.com/huaweicloud/golangsdk/openstack/obs" | ||
) | ||
|
||
func TestAccHuaweiCloudObsBucketObjectDataSource_content(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems the TestAccHuaweiCloudObsBucketObjectDataSource_content
and TestAccHuaweiCloudObsBucketObjectDataSource_source
are the same testing case for data source.
make testacc TEST=./huaweicloud/ TESTARGS='-run TestAccDataSourceAWSObsBucketObject_allParams'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./huaweicloud/ -v -run TestAccDataSourceAWSObsBucketObject_allParams -timeout 360m
=== RUN TestAccDataSourceAWSObsBucketObject_allParams
--- PASS: TestAccDataSourceAWSObsBucketObject_allParams (17.63s)
PASS
ok github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud 17.662s
make testacc TEST=./huaweicloud/ TESTARGS='-run TestAccDataSourceObsBucketObject_source'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./huaweicloud/ -v -run TestAccDataSourceObsBucketObject_source -timeout 360m
=== RUN TestAccDataSourceObsBucketObject_source
--- PASS: TestAccDataSourceObsBucketObject_source (17.18s)
PASS
ok github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud 17.761s