Skip to content

Commit

Permalink
fix: removed unnecessary string conversion
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Theuermann <[email protected]>
  • Loading branch information
mati007thm committed Jul 4, 2024
1 parent 8fc7f19 commit 02e136c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions internal/provider/integration_aws_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,15 @@ func (r *integrationAwsResource) ImportState(ctx context.Context, req resource.I

model := integrationAwsResourceModel{
SpaceId: types.StringValue(strings.Split(integration.Mrn, "/")[len(strings.Split(integration.Mrn, "/"))-3]),
Mrn: types.StringValue(string(integration.Mrn)),
Name: types.StringValue(string(integration.Name)),
Mrn: types.StringValue(integration.Mrn),
Name: types.StringValue(integration.Name),
Credential: integrationAwsCredentialModel{
Role: &roleCredentialModel{
RoleArn: types.StringValue(string(integration.ConfigurationOptions.HostedAwsConfigurationOptions.Role)),
RoleArn: types.StringValue(integration.ConfigurationOptions.HostedAwsConfigurationOptions.Role),
ExternalId: basetypes.NewStringNull(), // cannot be imported
},
Key: &accessKeyCredentialModel{
AccessKey: types.StringValue(string(integration.ConfigurationOptions.HostedAwsConfigurationOptions.AccessKeyId)),
AccessKey: types.StringValue(integration.ConfigurationOptions.HostedAwsConfigurationOptions.AccessKeyId),
SecretKey: basetypes.NewStringNull(), // cannot be imported
},
},
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/integration_azure_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ func (r *integrationAzureResource) ImportState(ctx context.Context, req resource

model := integrationAzureResourceModel{
SpaceId: types.StringValue(strings.Split(integration.Mrn, "/")[len(strings.Split(integration.Mrn, "/"))-3]),
Mrn: types.StringValue(string(integration.Mrn)),
Name: types.StringValue(string(integration.Name)),
Mrn: types.StringValue(integration.Mrn),
Name: types.StringValue(integration.Name),
ClientId: types.StringValue(integration.ConfigurationOptions.AzureConfigurationOptions.ClientId),
TenantId: types.StringValue(integration.ConfigurationOptions.AzureConfigurationOptions.TenantId),
SubscriptionAllowList: allowList,
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/integration_gcp_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ func (r *integrationGcpResource) ImportState(ctx context.Context, req resource.I
}

model := integrationGcpResourceModel{
Mrn: types.StringValue(string(integration.Mrn)),
Name: types.StringValue(string(integration.Name)),
Mrn: types.StringValue(integration.Mrn),
Name: types.StringValue(integration.Name),
SpaceId: types.StringValue(strings.Split(integration.Mrn, "/")[len(strings.Split(integration.Mrn, "/"))-3]),
ProjectId: types.StringValue(integration.ConfigurationOptions.GcpConfigurationOptions.ProjectId),
Credential: integrationGcpCredentialModel{
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/integration_ms365_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ func (r *integrationMs365Resource) ImportState(ctx context.Context, req resource
}

model := integrationMs365ResourceModel{
Mrn: types.StringValue(string(integration.Mrn)),
Name: types.StringValue(string(integration.Name)),
Mrn: types.StringValue(integration.Mrn),
Name: types.StringValue(integration.Name),
SpaceId: types.StringValue(strings.Split(integration.Mrn, "/")[len(strings.Split(integration.Mrn, "/"))-3]),
TenantId: types.StringValue(integration.ConfigurationOptions.Ms365ConfigurationOptions.TenantId),
ClientId: types.StringValue(integration.ConfigurationOptions.Ms365ConfigurationOptions.ClientId),
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/integration_slack_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ func (r *integrationSlackResource) ImportState(ctx context.Context, req resource
}

model := integrationSlackResourceModel{
Mrn: types.StringValue(string(integration.Mrn)),
Name: types.StringValue(string(integration.Name)),
Mrn: types.StringValue(integration.Mrn),
Name: types.StringValue(integration.Name),
SlackToken: types.StringPointerValue(nil),
SpaceId: types.StringValue(strings.Split(integration.Mrn, "/")[len(strings.Split(integration.Mrn, "/"))-3]),
}
Expand Down

0 comments on commit 02e136c

Please sign in to comment.