feat(objsto): upcloud_managed_object_storage_static_site resource#975
Open
villevsv-upcloud wants to merge 7 commits intofeat/v9-clientfrom
Open
feat(objsto): upcloud_managed_object_storage_static_site resource#975villevsv-upcloud wants to merge 7 commits intofeat/v9-clientfrom
villevsv-upcloud wants to merge 7 commits intofeat/v9-clientfrom
Conversation
Contains schama and model definitions. Commented methods are copy-pasted from custom domain resource. Some naming related find-and-replace already done, but no other work yet done.
# Conflicts: # internal/service/managedobjectstorage/custom_domain.go
| MarkdownDescription: "Custom error pages served when the storage backend returns an error status.", | ||
| NestedObject: schema.NestedBlockObject{ | ||
| Attributes: map[string]schema.Attribute{ | ||
| "status_code": schema.Int64Attribute{ |
Contributor
There was a problem hiding this comment.
Here we are going to need a custom validator to make sure that this definition from the api stands:
"Either status_code or both status_range.start and status_range.end must be provided, but not both"
| return | ||
| } | ||
|
|
||
| var dest v9.ObjectStorage2CreateStaticWebsite201 |
Contributor
There was a problem hiding this comment.
This unmarshal business is not done in other resources. For instance, in user.go we do this
apiResp, err := r.client.CreateObjectStorageUserWithResponse(ctx, svcUUID, v9.CreateObjectStorageUserJSONRequestBody{
Username: data.Username.ValueString(),
})
if err != nil {
resp.Diagnostics.AddError(
"Unable to create managed object storage user",
utils.ErrorDiagnosticDetail(err),
)
return
}
if apiResp.JSON201 == nil {
resp.Diagnostics.AddError(
"Unable to create managed object storage user",
utils.ErrorDiagnosticDetail(fmt.Errorf("unexpected response: %s", apiResp.HTTPResponse.Status)),
)
return
}
We assume the json201 contains the response. If there are cases that is not true then we will have to review them. I am also aware that we should always check the statusCode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.