Skip to content
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

Merged
merged 1 commit into from
Aug 27, 2020

Conversation

smilemusic
Copy link
Contributor

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

@smilemusic smilemusic force-pushed the obs-object branch 3 times, most recently from f947030 to 85c9055 Compare August 26, 2020 09:15
@@ -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(),
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

@niuzhenguo niuzhenguo left a 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.

@smilemusic smilemusic force-pushed the obs-object branch 2 times, most recently from efdb20c to af82f44 Compare August 27, 2020 02:49
huaweicloud/data_source_huaweicloud_obs_bucket_object.go Outdated Show resolved Hide resolved
Comment on lines 18 to 21
"body": {
Type: schema.TypeString,
Computed: true,
},
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 89 to 95
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))
}
Copy link
Collaborator

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) {
Copy link
Collaborator

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.

@ShiChangkuo ShiChangkuo merged commit ef0b657 into huaweicloud:master Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants