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

CDPCP-9924 Fixed IdBroker Mapping deletion and Datalake tags #28

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions resources/datalake/resource_aws_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,18 @@ func toAwsDatalakeRequest(ctx context.Context, model *awsDatalakeResourceModel)
}
req.Runtime = model.Runtime.ValueString()
req.Scale = datalakemodels.DatalakeScaleType(model.Scale.ValueString())
req.Tags = make([]*datalakemodels.DatalakeResourceTagRequest, len(model.Tags.Elements()))
i := 0
for k, v := range model.Tags.Elements() {
val, diag := v.(basetypes.StringValuable).ToStringValue(ctx)
if !diag.HasError() {
req.Tags[i] = &datalakemodels.DatalakeResourceTagRequest{
Key: &k,
Value: val.ValueStringPointer(),
if !model.Tags.IsNull() {
req.Tags = make([]*datalakemodels.DatalakeResourceTagRequest, len(model.Tags.Elements()))
i := 0
for k, v := range model.Tags.Elements() {
val, diag := v.(basetypes.StringValuable).ToStringValue(ctx)
if !diag.HasError() {
req.Tags[i] = &datalakemodels.DatalakeResourceTagRequest{
Key: &k,
Value: val.ValueStringPointer(),
}
}
i++
}
}
return req
Expand Down Expand Up @@ -367,9 +370,6 @@ func datalakeDetailsToAwsDatalakeResourceModel(ctx context.Context, resp *datala
if model.CertificateExpirationState.IsUnknown() {
model.CertificateExpirationState = types.StringNull()
}
if model.Tags.IsUnknown() {
model.Tags = types.MapNull(types.StringType)
}
}

func (r *awsDatalakeResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
Expand Down
22 changes: 11 additions & 11 deletions resources/datalake/resource_azure_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,18 @@ func toAzureDatalakeRequest(ctx context.Context, model *azureDatalakeResourceMod
}
req.Runtime = model.Runtime.ValueString()
req.Scale = datalakemodels.DatalakeScaleType(model.Scale.ValueString())
req.Tags = make([]*datalakemodels.DatalakeResourceTagRequest, len(model.Tags.Elements()))
i := 0
for k, v := range model.Tags.Elements() {
val, diag := v.(basetypes.StringValuable).ToStringValue(ctx)
if !diag.HasError() {
req.Tags[i] = &datalakemodels.DatalakeResourceTagRequest{
Key: &k,
Value: val.ValueStringPointer(),
if !model.Tags.IsNull() {
req.Tags = make([]*datalakemodels.DatalakeResourceTagRequest, len(model.Tags.Elements()))
i := 0
for k, v := range model.Tags.Elements() {
val, diag := v.(basetypes.StringValuable).ToStringValue(ctx)
if !diag.HasError() {
req.Tags[i] = &datalakemodels.DatalakeResourceTagRequest{
Key: &k,
Value: val.ValueStringPointer(),
}
}
i++
}
}
return req
Expand Down Expand Up @@ -324,9 +327,6 @@ func datalakeDetailsToAzureDatalakeResourceModel(ctx context.Context, resp *data
if model.CertificateExpirationState.IsUnknown() {
model.CertificateExpirationState = types.StringNull()
}
if model.Tags.IsUnknown() {
model.Tags = types.MapNull(types.StringType)
}
}

func (r *azureDatalakeResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
Expand Down
1 change: 0 additions & 1 deletion resources/datalake/schema_aws_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ var awsDatalakeResourceSchema schema.Schema = schema.Schema{
},
"tags": schema.MapAttribute{
Optional: true,
Computed: true,
ElementType: types.StringType,
},
},
Expand Down
1 change: 0 additions & 1 deletion resources/datalake/schema_azure_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ var azureDatalakeResourceSchema schema.Schema = schema.Schema{
},
"tags": schema.MapAttribute{
Optional: true,
Computed: true,
ElementType: types.StringType,
},
},
Expand Down
4 changes: 4 additions & 0 deletions resources/environments/resource_id_broker_mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ func (r *idBrokerMappingsResource) Delete(ctx context.Context, req resource.Dele

params := operations.NewSetIDBrokerMappingsParamsWithContext(ctx)
input := &environmentsmodels.SetIDBrokerMappingsRequest{}
input.EnvironmentName = state.EnvironmentName.ValueStringPointer()
input.DataAccessRole = state.DataAccessRole.ValueStringPointer()
input.RangerAuditRole = state.RangerAuditRole.ValueString()
input.Mappings = make([]*environmentsmodels.IDBrokerMappingRequest, 0)
input.SetEmptyMappings = &emptyMappings
params.WithInput(input)
_, err := client.Operations.SetIDBrokerMappings(params)
Expand Down
Loading