Update SDK dependency (#177)
* Update dependencies * Update dependencies * Update dependencies * Update dependencies --------- Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
parent
506d1afdc2
commit
c7effac5c7
62 changed files with 382 additions and 382 deletions
|
|
@ -297,7 +297,7 @@ func mapFields(bucketResp *objectstorage.GetBucketResponse, model *Model) error
|
|||
}
|
||||
|
||||
type objectStorageClient interface {
|
||||
CreateProjectExecute(ctx context.Context, projectId string) (*objectstorage.GetProjectResponse, error)
|
||||
EnableServiceExecute(ctx context.Context, projectId string) (*objectstorage.ProjectStatus, error)
|
||||
}
|
||||
|
||||
// enableProject enables object storage for the specified project. If the project is already enabled, nothing happens
|
||||
|
|
@ -305,7 +305,7 @@ func enableProject(ctx context.Context, model *Model, client objectStorageClient
|
|||
projectId := model.ProjectId.ValueString()
|
||||
|
||||
// From the object storage OAS: Creation will also be successful if the project is already enabled, but will not create a duplicate
|
||||
_, err := client.CreateProjectExecute(ctx, projectId)
|
||||
_, err := client.EnableServiceExecute(ctx, projectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create object storage project: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ type objectStorageClientMocked struct {
|
|||
returnError bool
|
||||
}
|
||||
|
||||
func (c *objectStorageClientMocked) CreateProjectExecute(_ context.Context, projectId string) (*objectstorage.GetProjectResponse, error) {
|
||||
func (c *objectStorageClientMocked) EnableServiceExecute(_ context.Context, projectId string) (*objectstorage.ProjectStatus, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("create project failed")
|
||||
}
|
||||
|
||||
return &objectstorage.GetProjectResponse{
|
||||
return &objectstorage.ProjectStatus{
|
||||
Project: utils.Ptr(projectId),
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ func (r *credentialResource) ImportState(ctx context.Context, req resource.Impor
|
|||
}
|
||||
|
||||
type objectStorageClient interface {
|
||||
CreateProjectExecute(ctx context.Context, projectId string) (*objectstorage.GetProjectResponse, error)
|
||||
EnableServiceExecute(ctx context.Context, projectId string) (*objectstorage.ProjectStatus, error)
|
||||
}
|
||||
|
||||
// enableProject enables object storage for the specified project. If the project is already enabled, nothing happens
|
||||
|
|
@ -313,7 +313,7 @@ func enableProject(ctx context.Context, model *Model, client objectStorageClient
|
|||
projectId := model.ProjectId.ValueString()
|
||||
|
||||
// From the object storage OAS: Creation will also be successful if the project is already enabled, but will not create a duplicate
|
||||
_, err := client.CreateProjectExecute(ctx, projectId)
|
||||
_, err := client.EnableServiceExecute(ctx, projectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create object storage project: %w", err)
|
||||
}
|
||||
|
|
@ -394,7 +394,7 @@ func readCredentials(ctx context.Context, model *Model, client *objectstorage.AP
|
|||
credentialsGroupId := model.CredentialsGroupId.ValueString()
|
||||
credentialId := model.CredentialId.ValueString()
|
||||
|
||||
credentialsGroupResp, err := client.GetAccessKeys(ctx, projectId).CredentialsGroup(credentialsGroupId).Execute()
|
||||
credentialsGroupResp, err := client.ListAccessKeys(ctx, projectId).CredentialsGroup(credentialsGroupId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting credentials groups: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ type objectStorageClientMocked struct {
|
|||
returnError bool
|
||||
}
|
||||
|
||||
func (c *objectStorageClientMocked) CreateProjectExecute(_ context.Context, projectId string) (*objectstorage.GetProjectResponse, error) {
|
||||
func (c *objectStorageClientMocked) EnableServiceExecute(_ context.Context, projectId string) (*objectstorage.ProjectStatus, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("create project failed")
|
||||
}
|
||||
|
||||
return &objectstorage.GetProjectResponse{
|
||||
return &objectstorage.ProjectStatus{
|
||||
Project: utils.Ptr(projectId),
|
||||
}, nil
|
||||
}
|
||||
|
|
@ -212,14 +212,14 @@ func TestReadCredentials(t *testing.T) {
|
|||
|
||||
tests := []struct {
|
||||
description string
|
||||
mockedResp *objectstorage.GetAccessKeysResponse
|
||||
mockedResp *objectstorage.ListAccessKeysResponse
|
||||
expected Model
|
||||
getCredentialsFails bool
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("foo-cid"),
|
||||
|
|
@ -247,7 +247,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"simple_values",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("foo-cid"),
|
||||
|
|
@ -281,7 +281,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"expiration_timestamp_with_fractional_seconds",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("foo-cid"),
|
||||
|
|
@ -315,7 +315,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"empty_credentials",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{},
|
||||
},
|
||||
Model{},
|
||||
|
|
@ -331,7 +331,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"non_matching_credential",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("foo-cid"),
|
||||
|
|
@ -351,7 +351,7 @@ func TestReadCredentials(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"error_response",
|
||||
&objectstorage.GetAccessKeysResponse{
|
||||
&objectstorage.ListAccessKeysResponse{
|
||||
AccessKeys: &[]objectstorage.AccessKey{
|
||||
{
|
||||
KeyId: utils.Ptr("cid"),
|
||||
|
|
|
|||
|
|
@ -301,8 +301,8 @@ func mapCredentialsGroup(credentialsGroup objectstorage.CredentialsGroup, model
|
|||
}
|
||||
|
||||
type objectStorageClient interface {
|
||||
CreateProjectExecute(ctx context.Context, projectId string) (*objectstorage.GetProjectResponse, error)
|
||||
GetCredentialsGroupsExecute(ctx context.Context, projectId string) (*objectstorage.GetCredentialsGroupsResponse, error)
|
||||
EnableServiceExecute(ctx context.Context, projectId string) (*objectstorage.ProjectStatus, error)
|
||||
ListCredentialsGroupsExecute(ctx context.Context, projectId string) (*objectstorage.ListCredentialsGroupsResponse, error)
|
||||
}
|
||||
|
||||
// enableProject enables object storage for the specified project. If the project is already enabled, nothing happens
|
||||
|
|
@ -310,7 +310,7 @@ func enableProject(ctx context.Context, model *Model, client objectStorageClient
|
|||
projectId := model.ProjectId.ValueString()
|
||||
|
||||
// From the object storage OAS: Creation will also be successful if the project is already enabled, but will not create a duplicate
|
||||
_, err := client.CreateProjectExecute(ctx, projectId)
|
||||
_, err := client.EnableServiceExecute(ctx, projectId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create object storage project: %w", err)
|
||||
}
|
||||
|
|
@ -326,7 +326,7 @@ func readCredentialsGroups(ctx context.Context, model *Model, client objectStora
|
|||
return fmt.Errorf("missing configuration: either name or credentials group id must be provided")
|
||||
}
|
||||
|
||||
credentialsGroupsResp, err := client.GetCredentialsGroupsExecute(ctx, model.ProjectId.ValueString())
|
||||
credentialsGroupsResp, err := client.ListCredentialsGroupsExecute(ctx, model.ProjectId.ValueString())
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting credentials groups: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,26 +12,26 @@ import (
|
|||
)
|
||||
|
||||
type objectStorageClientMocked struct {
|
||||
returnError bool
|
||||
getCredentialsGroupsResp *objectstorage.GetCredentialsGroupsResponse
|
||||
returnError bool
|
||||
listCredentialsGroupsResp *objectstorage.ListCredentialsGroupsResponse
|
||||
}
|
||||
|
||||
func (c *objectStorageClientMocked) CreateProjectExecute(_ context.Context, projectId string) (*objectstorage.GetProjectResponse, error) {
|
||||
func (c *objectStorageClientMocked) EnableServiceExecute(_ context.Context, projectId string) (*objectstorage.ProjectStatus, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("create project failed")
|
||||
}
|
||||
|
||||
return &objectstorage.GetProjectResponse{
|
||||
return &objectstorage.ProjectStatus{
|
||||
Project: utils.Ptr(projectId),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *objectStorageClientMocked) GetCredentialsGroupsExecute(_ context.Context, _ string) (*objectstorage.GetCredentialsGroupsResponse, error) {
|
||||
func (c *objectStorageClientMocked) ListCredentialsGroupsExecute(_ context.Context, _ string) (*objectstorage.ListCredentialsGroupsResponse, error) {
|
||||
if c.returnError {
|
||||
return nil, fmt.Errorf("get credentials groups failed")
|
||||
}
|
||||
|
||||
return c.getCredentialsGroupsResp, nil
|
||||
return c.listCredentialsGroupsResp, nil
|
||||
}
|
||||
|
||||
func TestMapFields(t *testing.T) {
|
||||
|
|
@ -161,14 +161,14 @@ func TestEnableProject(t *testing.T) {
|
|||
func TestReadCredentialsGroups(t *testing.T) {
|
||||
tests := []struct {
|
||||
description string
|
||||
mockedResp *objectstorage.GetCredentialsGroupsResponse
|
||||
mockedResp *objectstorage.ListCredentialsGroupsResponse
|
||||
expected Model
|
||||
getCredentialsGroupsFails bool
|
||||
isValid bool
|
||||
}{
|
||||
{
|
||||
"default_values",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{
|
||||
{
|
||||
CredentialsGroupId: utils.Ptr("cid"),
|
||||
|
|
@ -190,7 +190,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"simple_values",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{
|
||||
{
|
||||
CredentialsGroupId: utils.Ptr("cid"),
|
||||
|
|
@ -216,7 +216,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"empty_credentials_groups",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{},
|
||||
},
|
||||
Model{},
|
||||
|
|
@ -225,7 +225,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"nil_credentials_groups",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: nil,
|
||||
},
|
||||
Model{},
|
||||
|
|
@ -241,7 +241,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"non_matching_credentials_group",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{
|
||||
{
|
||||
CredentialsGroupId: utils.Ptr("foo-other"),
|
||||
|
|
@ -256,7 +256,7 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"error_response",
|
||||
&objectstorage.GetCredentialsGroupsResponse{
|
||||
&objectstorage.ListCredentialsGroupsResponse{
|
||||
CredentialsGroups: &[]objectstorage.CredentialsGroup{
|
||||
{
|
||||
CredentialsGroupId: utils.Ptr("other_id"),
|
||||
|
|
@ -273,8 +273,8 @@ func TestReadCredentialsGroups(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.description, func(t *testing.T) {
|
||||
client := &objectStorageClientMocked{
|
||||
returnError: tt.getCredentialsGroupsFails,
|
||||
getCredentialsGroupsResp: tt.mockedResp,
|
||||
returnError: tt.getCredentialsGroupsFails,
|
||||
listCredentialsGroupsResp: tt.mockedResp,
|
||||
}
|
||||
model := &Model{
|
||||
ProjectId: tt.expected.ProjectId,
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ func testAccCheckObjectStorageDestroy(s *terraform.State) error {
|
|||
bucketsToDestroy = append(bucketsToDestroy, bucketName)
|
||||
}
|
||||
|
||||
bucketsResp, err := client.GetBuckets(ctx, testutil.ProjectId).Execute()
|
||||
bucketsResp, err := client.ListBuckets(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting bucketsResp: %w", err)
|
||||
}
|
||||
|
|
@ -281,7 +281,7 @@ func testAccCheckObjectStorageDestroy(s *terraform.State) error {
|
|||
credentialsGroupsToDestroy = append(credentialsGroupsToDestroy, credentialsGroupId)
|
||||
}
|
||||
|
||||
credentialsGroupsResp, err := client.GetCredentialsGroups(ctx, testutil.ProjectId).Execute()
|
||||
credentialsGroupsResp, err := client.ListCredentialsGroups(ctx, testutil.ProjectId).Execute()
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting bucketsResp: %w", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue