-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly support enum Names in resources (#326)
### Naming changes Don't convert all resource Spec `Name` properties to `string`, and instead allow the following cases: - An enum with one value generates no `AzureName` property in the CRD as it cannot be changed. An `AzureName()` function is provided for `ConvertToArm` to invoke, which returns the fixed value. This only triggers for one resource currently: - Web `HostingEnvironmentsMultiRolePool` which must have a name of `default` - An enum with multiple values generates an `AzureName` property with an enum value. An `AzureName()` function is provided for `ConvertToArm` which casts the enum value to string. Example resources for this are: - Keyvault `VaultsAccessPolicies` which allows names of `add`, `remove`, and `replace` - API Management `ServiceIdentityProvider` which allows names of `aad`, `aadB2C`, `facebook`, `google`, `microsoft`, and `twitter` All Spec `Name` properties are still converted to `string` for the corresponding ARM type, as we need to insert a full ARM ID including owning resource IDs, etc. ### Serialization changes Split `ArmTransformer` interface into two parts `FromArmConverter`/`ToArmConverter` and make it so that Status types only implement `FromArmConverter`. ## Other cases There are other cases to be solved; some services (like Storage) require a Name ending in `default` (which is actually more correct, as the Name is a full URI including parent resources). At the schema level this is enforced via a regex like `^.*/default$`. We can recognize these cases and handle them; but that will be a different PR—we don’t yet support type validation properly.
- Loading branch information
Showing
59 changed files
with
1,003 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.