Skip to content

Commit

Permalink
Add comments where casts may fail to compile in future
Browse files Browse the repository at this point in the history
  • Loading branch information
theunrepentantgeek committed Sep 15, 2024
1 parent 4151246 commit e8a2e15
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func (extension *RoleAssignmentExtension) Import(
return extensions.ImportResult{}, err
}

// If this cast doesn't compile, update the `api` import to reference the now latest
// stable version of the authorization group (this will happen when we import a new
// API version in the generator.)
if assignment, ok := rsrc.(*api.RoleAssignment); ok {
// Check to see whether this role assignment is inherited or not
// (we can tell by looking at the scope of the assignment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func (extension *RoleDefinitionExtension) Import(
return extensions.ImportResult{}, err
}

// If this cast doesn't compile, update the `api` import to reference the now latest
// stable version of the authorization group (this will happen when we import a new
// API version in the generator.)
if definition, ok := rsrc.(*api.RoleDefinition); ok {
// If this role definition is built in, we don't need to export it
if definition.Spec.Type != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func (extension *FlexibleServersConfigurationExtension) Import(
return extensions.ImportResult{}, err
}

// If this cast doesn't compile, update the `api` import to reference the now latest
// stable version of the authorization group (this will happen when we import a new
// API version in the generator.)
if config, ok := rsrc.(*api.FlexibleServersConfiguration); ok {
// Skip system defaults
if config.Spec.Source != nil && *config.Spec.Source == "system-default" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func (extension *FlexibleServersDatabaseExtension) Import(
owner *genruntime.ResourceReference,
next extensions.ImporterFunc,
) (extensions.ImportResult, error) {
// If this cast doesn't compile, update the `api` import to reference the now latest
// stable version of the authorization group (this will happen when we import a new
// API version in the generator.)
if server, ok := rsrc.(*api.FlexibleServersDatabase); ok {
if server.Spec.AzureName == "azure_maintenance" {
return extensions.ImportSkipped("azure_maintenance database is not accessible by users"), nil
Expand Down

0 comments on commit e8a2e15

Please sign in to comment.