-
Notifications
You must be signed in to change notification settings - Fork 2
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
Resources connection #26
base: main
Are you sure you want to change the base?
Conversation
internal/resources/docker-profile.go
Outdated
} | ||
|
||
webAPIAssert := webAPIAssetModels.UpdateWebAPIAssetInput{ | ||
RemovePracticeWrappers: []string{d.Id()}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove profiles
@@ -54,6 +54,13 @@ func NewDockerProfile(ctx context.Context, c *api.Client, input models.CreateDoc | |||
key | |||
value | |||
} | |||
usedBy { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove from query
@@ -97,6 +97,13 @@ func NewAppSecGatewayProfile(ctx context.Context, c *api.Client, input models.Cr | |||
key | |||
value | |||
} | |||
usedBy { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove from query
return utils.DiagError("failed get WebAPIAsset before update", err, diags) | ||
} | ||
|
||
webAPIAssert := webAPIAssetModels.UpdateWebAPIAssetInput{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo asset
@@ -223,6 +227,56 @@ func resourceEmbeddedProfileDelete(ctx context.Context, d *schema.ResourceData, | |||
var diags diag.Diagnostics | |||
c := meta.(*api.Client) | |||
|
|||
profile, err := embeddedprofile.GetEmbeddedProfile(ctx, c, d.Id()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put in a function for clarity
return utils.DiagError("failed to update usedByResource", err, diags) | ||
} | ||
} | ||
|
||
ID := d.Id() | ||
result, err := embeddedprofile.DeleteEmbeddedProfile(ctx, c, ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Search for references only if there's an error of object used by another object
internal/resources/exceptions.go
Outdated
return utils.DiagError("unable to perform ExceptionBehavior Delete", err, diags) | ||
} | ||
|
||
if usedBy != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|| len(usedBy) > 0
internal/resources/exceptions.go
Outdated
|
||
switch usedByResource.SubType { | ||
case "WebAPI": | ||
objectToUpdate, err := webapiasset.GetWebAPIAsset(ctx, c, usedByResource.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove Get call and used usedByResource.ID
for update
internal/resources/log-trigger.go
Outdated
// return utils.DiagError("failed to prepare asset to update", err, diags) | ||
// } | ||
// | ||
// updated, err := webapiasset.UpdateWebAPIAsset(ctx, c, objectToUpdate.ID, preparedAssetToUpdate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If and when you change the implementation of deleting a trigger from its practice wrapper instead of an asset, you should also change this update to be on the practice wrapper
internal/resources/log-trigger.go
Outdated
// return utils.DiagError("unable to perform WebAPIAsset Delete", err, diags) | ||
// } | ||
// | ||
// } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments about different asset types
return utils.DiagError("unable to perform WebAPIPractice Delete", err, diags) | ||
} | ||
|
||
fmt.Printf("usedBy: %v\n", usedBy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
No description provided.