Skip to content

Commit

Permalink
[keyvault] azcertificates renames (#20978)
Browse files Browse the repository at this point in the history
* renames

* update tests

* feedback

* id type
  • Loading branch information
gracewilcox authored Jun 22, 2023
1 parent 1e4fb7e commit cc98dfe
Show file tree
Hide file tree
Showing 10 changed files with 1,114 additions and 1,032 deletions.
36 changes: 36 additions & 0 deletions sdk/security/keyvault/azcertificates/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@

## 0.11.0 (unreleased)

### Breaking Changes
* Rename `ListCertificates` to `ListCertificateProperties`
* `ListCertificateIssuers` to `ListIssuerProperties`
* `ListCertificateVersions` to `ListCertificatePropertiesVersions`
* `ListDeletedCertificates` to `ListDeletedCertificateProperties`
* `CertificateListResult` to `CertificatePropertiesListResult`
* `DeletedCertificateListResult` to `DeletedCertificatePropertiesListResult`
* `SetCertificateContacts` to `SetContacts`
* `GetCertificateContacts` to `GetContacts`
* `DeleteCertificateContacts` to `DeleteContacts`
* `SetCertificateIssuer` to `SetIssuer`
* `UpdateCertificateIssuer` to `UpdateIssuer`
* `GetCertificateIssuer` to `GetIssuer`
* `DeleteCertificateIssuer` to `DeleteIssuer`
* `CertificateIssuerListResult` to `IssuerPropertiesListResult`
* `UpdateCertificateIssuerParameters` to `UpdateIssuerParameters`
* `SetCertificateIssuerParameters` to `SetIssuerParameters`
* `CertificateBundle` to `Certificate`
* `CertificateItem` to `CertificateProperties`
* `DeletedCertificateBundle` to `DeletedCertificate`
* `DeletedCertificateItem` to `DeletedCertificateProperties`
* `IssuerBundle` to `Issuer`
* `CertificateIssuerItem` to `IssuerProperties`
* `RestoreCertificateParameters.CertificateBundleBackup` to `RestoreCertificateParameters.CertificateBackup`
* `JSONWebKeyCurveName` to `CurveName`
* `JSONWebKeyType` to `KeyType`
* `Trigger` to `LifetimeActionTrigger`
* `Action` to `LifetimeActionType`
* `AdministratorDetails` to ``AdministratorContact`
* `OrganizationDetails.AdminDetails` to `OrganizationDetails.AdminContacts`
* `EmailAddress` to `Email`
* `UPNs` to `UserPrincipalNames`
* `EKUs` to `EnhancedKeyUsage`
* remove `MaxResults` parameter
* remove `DeletionRecoveryLevel` type

### Other Changes
* Updated dependencies

Expand Down
2 changes: 1 addition & 1 deletion sdk/security/keyvault/azcertificates/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "go",
"TagPrefix": "go/security/keyvault/azcertificates",
"Tag": "go/security/keyvault/azcertificates_0abf787d93"
"Tag": "go/security/keyvault/azcertificates_a266a0061e"
}
154 changes: 135 additions & 19 deletions sdk/security/keyvault/azcertificates/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,145 @@ directive:
# rename paged operations from Get* to List*
- rename-operation:
from: GetCertificates
to: ListCertificates
to: ListCertificateProperties
- rename-operation:
from: GetCertificateIssuers
to: ListCertificateIssuers
to: ListIssuerProperties
- rename-operation:
from: GetCertificateVersions
to: ListCertificateVersions
to: ListCertificatePropertiesVersions
- rename-operation:
from: GetDeletedCertificates
to: ListDeletedCertificates
to: ListDeletedCertificateProperties
- rename-model:
from: CertificateListResult
to: CertificatePropertiesListResult
- rename-model:
from: DeletedCertificateListResult
to: DeletedCertificatePropertiesListResult

# Maxresults -> MaxResults
- from: swagger-document
where: $.paths..parameters..[?(@.name=='maxresults')]
transform: $["x-ms-client-name"] = "MaxResults"
# remove redunant "certificate" from operation name
- rename-operation:
from: SetCertificateContacts
to: SetContacts
- rename-operation:
from: GetCertificateContacts
to: GetContacts
- rename-operation:
from: DeleteCertificateContacts
to: DeleteContacts
- rename-operation:
from: SetCertificateIssuer
to: SetIssuer
- rename-operation:
from: UpdateCertificateIssuer
to: UpdateIssuer
- rename-operation:
from: GetCertificateIssuer
to: GetIssuer
- rename-operation:
from: DeleteCertificateIssuer
to: DeleteIssuer
- rename-model:
from: CertificateIssuerListResult
to: IssuerPropertiesListResult
- rename-model:
from: UpdateCertificateIssuerParameters
to: UpdateIssuerParameters
- rename-model:
from: SetCertificateIssuerParameters
to: SetIssuerParameters

# rename LifetimeAction
- rename-model:
from: Action
to: LifetimeActionType
- rename-model:
from: Trigger
to: LifetimeActionTrigger

# rename CertificateBundle, CertificateItem, IssuerBundle
- rename-model:
from: CertificateBundle
to: Certificate
- rename-model:
from: CertificateItem
to: CertificateProperties
- rename-model:
from: DeletedCertificateBundle
to: DeletedCertificate
- rename-model:
from: DeletedCertificateItem
to: DeletedCertificateProperties
- rename-model:
from: IssuerBundle
to: Issuer
- rename-model:
from: CertificateIssuerItem
to: IssuerProperties
- where-model: RestoreCertificateParameters
transform: $.properties.value["x-ms-client-name"] = "CertificateBackup"

# rename AdministratorDetails to AdministratorContact
- rename-model:
from: AdministratorDetails
to: AdministratorContact
- where-model: OrganizationDetails
transform: $.properties.admin_details["x-ms-client-name"] = "AdminContacts"
- where-model:
- Contact
- AdministratorContact
transform: $.properties.email["x-ms-client-name"] = "Email"

# rename UPNs to UserPrincipalNames
- where-model: SubjectAlternativeNames
transform: $.properties.upns["x-ms-client-name"] = "UserPrincipalNames"

# rename EKUs to EnhancedKeyUsage
- where-model: X509CertificateProperties
transform: $.properties.ekus["x-ms-client-name"] = "EnhancedKeyUsage"

# capitalize acronyms
- where-model: CertificateBundle
- where-model: Certificate
transform: $.properties.cer["x-ms-client-name"] = "CER"
- where-model: CertificateBundle
- where-model: Certificate
transform: $.properties.kid["x-ms-client-name"] = "KID"
- where-model: CertificateBundle
- where-model: Certificate
transform: $.properties.sid["x-ms-client-name"] = "SID"
- where-model: CertificateOperation
transform: $.properties.csr["x-ms-client-name"] = "CSR"
- where-model: SubjectAlternativeNames
transform: $.properties.upns["x-ms-client-name"] = "UPNs"
- where-model: X509CertificateProperties
transform: $.properties.ekus["x-ms-client-name"] = "EKUs"

# Remove MaxResults parameter
- where: "$.paths..*"
remove-parameter:
in: query
name: maxresults

# remove JSONWeb prefix
- from:
- models.go
- constants.go
where: $
transform: return $.replace(/JSONWebKeyCurveName/g, "CurveName");
- from:
- models.go
- constants.go
where: $
transform: return $.replace(/JSONWebKeyType/g, "KeyType");

# remove DeletionRecoveryLevel type
- from: models.go
where: $
transform: return $.replace(/RecoveryLevel \*DeletionRecoveryLevel/g, "RecoveryLevel *string");
- from: constants.go
where: $
transform: return $.replace(/(?:\/\/.*\s)+type DeletionRecoveryLevel string/, "");
- from: constants.go
where: $
transform: return $.replace(/(?:\/\/.*\s)+func PossibleDeletionRecovery(?:.+\s)+\}/, "");
- from: constants.go
where: $
transform: return $.replace(/const \(\n\s\/\/ DeletionRecoveryLevel(?:.+\s)+\)/, "");

# delete unused error models
- from: models.go
Expand Down Expand Up @@ -116,15 +226,21 @@ directive:
transform: return $.replace(/Client(\w+)((?:Options|Response))/g, "$1$2");

# make cert IDs a convenience type so we can add parsing methods
# (specifying models because others have "ID" fields whose values aren't cert IDs)
# (specifying models because others have "ID" fields whose values aren't key vault object identifiers)
- from: models.go
where: $
transform: return $.replace(/(type (?:Deleted)?Certificate(?:Bundle|Item) struct \{(?:\s.+\s)+\sID \*)string/g, "$1ID")
transform: return $.replace(/(type (?:Deleted)?Certificate(?:Properties|Policy|Operation)? struct \{(?:\s.+\s)+\sID \*)string/g, "$1ID")
- from: models.go
where: $
transform: return $.replace(/(type (?:Deleted)?Certificate struct \{(?:\s.+\s)+\sKID \*)string/g, "$1ID")
- from: models.go
where: $
transform: return $.replace(/(type (?:Deleted)?Certificate struct \{(?:\s.+\s)+\sSID \*)string/g, "$1ID")

# remove "certificate" prefix from some method parameter names
- from: client.go
- where: $
- transform: return $.replace(/certificate((?:Name|Policy|Version)) string/g, (match) => { return match[0].toLowerCase() + match.substr(1); })
where: $
transform: return $.replace(/certificate((?:Name|Policy|Version)) string/g, (match) => { return match[0].toLowerCase() + match.substr(1); })

# add doc comment
- from: swagger-document
Expand Down
Loading

0 comments on commit cc98dfe

Please sign in to comment.