Skip to content

Commit

Permalink
Fix updating owners
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmay-db committed Jan 31, 2024
1 parent 510fd60 commit 7932c78
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions catalog/resource_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ func ResourceCatalog() *schema.Resource {
}
}

if !d.HasChangeExcept("owner") {
return nil
}

updateCatalogRequest.Owner = ""
ci, err := w.Catalogs.Update(ctx, updateCatalogRequest)

Expand Down
4 changes: 4 additions & 0 deletions catalog/resource_external_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func ResourceExternalLocation() *schema.Resource {
}
}

if !d.HasChangeExcept("owner") {
return nil
}

updateExternalLocationRequest.Owner = ""
_, err = w.ExternalLocations.Update(ctx, updateExternalLocationRequest)
if err != nil {
Expand Down
10 changes: 10 additions & 0 deletions catalog/resource_metastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ func ResourceMetastore() *schema.Resource {
return err
}
}

if !d.HasChangeExcept("owner") {
return nil
}

update.Owner = ""
_, err := acc.Metastores.Update(ctx, catalog.AccountsUpdateMetastore{
MetastoreId: d.Id(),
Expand Down Expand Up @@ -171,6 +176,11 @@ func ResourceMetastore() *schema.Resource {
return err
}
}

if !d.HasChangeExcept("owner") {
return nil
}

update.Owner = ""
_, err := w.Metastores.Update(ctx, update)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions catalog/resource_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ func ResourceSchema() *schema.Resource {
}
}

if !d.HasChangeExcept("owner") {
return nil
}

updateSchemaRequest.Owner = ""
schema, err := w.Schemas.Update(ctx, updateSchemaRequest)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions catalog/resource_share.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ func ResourceShare() *schema.Resource {
}
}

if !d.HasChangeExcept("owner") {
return nil
}

err = NewSharesAPI(ctx, c).update(d.Id(), ShareUpdates{
Updates: changes,
})
Expand Down
5 changes: 5 additions & 0 deletions catalog/resource_storage_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ func ResourceStorageCredential() *schema.Resource {
return err
}
}

if !d.HasChangeExcept("owner") {
return nil
}

update.Owner = ""
_, err := acc.StorageCredentials.Update(ctx, catalog.AccountsUpdateStorageCredential{
CredentialInfo: &update,
Expand Down
4 changes: 4 additions & 0 deletions catalog/resource_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ func ResourceVolume() *schema.Resource {
}
}

if !d.HasChangeExcept("owner") {
return nil
}

updateVolumeRequestContent.Owner = ""
v, err := w.Volumes.Update(ctx, updateVolumeRequestContent)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions sharing/resource_recipient.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ func ResourceRecipient() *schema.Resource {
}
}

if !d.HasChangeExcept("owner") {
return nil
}

updateRecipientRequest.Owner = ""
err = w.Recipients.Update(ctx, updateRecipientRequest)
if err != nil {
Expand Down

0 comments on commit 7932c78

Please sign in to comment.