Skip to content

feat(objsto): upcloud_managed_object_storage_static_site resource#975

Open
villevsv-upcloud wants to merge 7 commits intofeat/v9-clientfrom
feat/v9-objsto-static-site
Open

feat(objsto): upcloud_managed_object_storage_static_site resource#975
villevsv-upcloud wants to merge 7 commits intofeat/v9-clientfrom
feat/v9-objsto-static-site

Conversation

@villevsv-upcloud
Copy link
Copy Markdown
Contributor

@villevsv-upcloud villevsv-upcloud commented Mar 27, 2026

No description provided.

kangasta and others added 4 commits March 26, 2026 09:23
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.
@villevsv-upcloud villevsv-upcloud changed the base branch from main to feat/v9-client April 2, 2026 08:50
@villevsv-upcloud villevsv-upcloud marked this pull request as ready for review April 2, 2026 10:24
@villevsv-upcloud villevsv-upcloud requested a review from a team as a code owner April 2, 2026 10:24
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{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

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