From c23ed468e5f742e1ff3266bbcadd71d9cc29f44c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 12 May 2022 03:14:13 +0000 Subject: [PATCH] CodeGen from PR 19039 in Azure/azure-rest-api-specs Merge 1070a8a59081c22b665065b219d4626b5b574790 into 62dc7865a18791290f282ed54bcb1d4b1517af16 --- .../mgmt/2015-06-01/keyvault/CHANGELOG.md | 2 +- .../mgmt/2015-06-01/keyvault/_meta.json | 2 +- .../mgmt/2016-10-01/keyvault/CHANGELOG.md | 2 +- .../mgmt/2016-10-01/keyvault/_meta.json | 2 +- .../mgmt/2018-02-14/keyvault/CHANGELOG.md | 2 +- .../mgmt/2018-02-14/keyvault/_meta.json | 2 +- .../mgmt/2019-09-01/keyvault/CHANGELOG.md | 40 +- .../mgmt/2019-09-01/keyvault/_meta.json | 2 +- .../mgmt/2019-09-01/keyvault/enums.go | 15 + .../mgmt/2019-09-01/keyvault/models.go | 115 +- .../keyvault/privateendpointconnections.go | 2 +- .../mgmt/2021-10-01/keyvault/CHANGELOG.md | 2 + .../mgmt/2021-10-01/keyvault/_meta.json | 11 + .../mgmt/2021-10-01/keyvault/client.go | 41 + .../mgmt/2021-10-01/keyvault/enums.go | 489 +++ .../keyvault/mgmt/2021-10-01/keyvault/keys.go | 554 +++ .../keyvault/keyvaultapi/interfaces.go | 121 + .../mgmt/2021-10-01/keyvault/managedhsms.go | 856 ++++ .../mhsmprivateendpointconnections.go | 395 ++ .../keyvault/mhsmprivatelinkresources.go | 109 + .../mgmt/2021-10-01/keyvault/models.go | 3807 +++++++++++++++++ .../mgmt/2021-10-01/keyvault/operations.go | 141 + .../keyvault/privateendpointconnections.go | 416 ++ .../keyvault/privatelinkresources.go | 116 + .../mgmt/2021-10-01/keyvault/secrets.go | 418 ++ .../mgmt/2021-10-01/keyvault/vaults.go | 1165 +++++ .../mgmt/2021-10-01/keyvault/version.go | 19 + .../2020-04-01-preview/keyvault/CHANGELOG.md | 40 +- .../2020-04-01-preview/keyvault/_meta.json | 2 +- .../mgmt/2020-04-01-preview/keyvault/enums.go | 15 + .../keyvault/managedhsms.go | 2 +- .../2020-04-01-preview/keyvault/models.go | 120 +- .../keyvault/privateendpointconnections.go | 2 +- 33 files changed, 9000 insertions(+), 27 deletions(-) create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/CHANGELOG.md create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/_meta.json create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/client.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/enums.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/keys.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/keyvaultapi/interfaces.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/managedhsms.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/mhsmprivateendpointconnections.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/mhsmprivatelinkresources.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/models.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/operations.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/privateendpointconnections.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/privatelinkresources.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/secrets.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/vaults.go create mode 100644 services/keyvault/mgmt/2021-10-01/keyvault/version.go diff --git a/services/keyvault/mgmt/2015-06-01/keyvault/CHANGELOG.md b/services/keyvault/mgmt/2015-06-01/keyvault/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/keyvault/mgmt/2015-06-01/keyvault/CHANGELOG.md +++ b/services/keyvault/mgmt/2015-06-01/keyvault/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/keyvault/mgmt/2015-06-01/keyvault/_meta.json b/services/keyvault/mgmt/2015-06-01/keyvault/_meta.json index 1d802a993bb9..8de42dc43d95 100644 --- a/services/keyvault/mgmt/2015-06-01/keyvault/_meta.json +++ b/services/keyvault/mgmt/2015-06-01/keyvault/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "fd0b1a763b8dbc2bfc781895bcae49c91f511c4a", "readme": "/_/azure-rest-api-specs/specification/keyvault/resource-manager/readme.md", "tag": "package-2015-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/keyvault/mgmt/2016-10-01/keyvault/CHANGELOG.md b/services/keyvault/mgmt/2016-10-01/keyvault/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/keyvault/mgmt/2016-10-01/keyvault/CHANGELOG.md +++ b/services/keyvault/mgmt/2016-10-01/keyvault/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/keyvault/mgmt/2016-10-01/keyvault/_meta.json b/services/keyvault/mgmt/2016-10-01/keyvault/_meta.json index e4e58c24d09a..18a18c4ef51a 100644 --- a/services/keyvault/mgmt/2016-10-01/keyvault/_meta.json +++ b/services/keyvault/mgmt/2016-10-01/keyvault/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "fd0b1a763b8dbc2bfc781895bcae49c91f511c4a", "readme": "/_/azure-rest-api-specs/specification/keyvault/resource-manager/readme.md", "tag": "package-2016-10", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/keyvault/mgmt/2018-02-14/keyvault/CHANGELOG.md b/services/keyvault/mgmt/2018-02-14/keyvault/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/keyvault/mgmt/2018-02-14/keyvault/CHANGELOG.md +++ b/services/keyvault/mgmt/2018-02-14/keyvault/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/keyvault/mgmt/2018-02-14/keyvault/_meta.json b/services/keyvault/mgmt/2018-02-14/keyvault/_meta.json index 7afc5c0d9d9f..41b220790f2f 100644 --- a/services/keyvault/mgmt/2018-02-14/keyvault/_meta.json +++ b/services/keyvault/mgmt/2018-02-14/keyvault/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "fd0b1a763b8dbc2bfc781895bcae49c91f511c4a", "readme": "/_/azure-rest-api-specs/specification/keyvault/resource-manager/readme.md", "tag": "package-2018-02", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/keyvault/mgmt/2019-09-01/keyvault/CHANGELOG.md b/services/keyvault/mgmt/2019-09-01/keyvault/CHANGELOG.md index 52911e4cc5e4..8418900aedd2 100644 --- a/services/keyvault/mgmt/2019-09-01/keyvault/CHANGELOG.md +++ b/services/keyvault/mgmt/2019-09-01/keyvault/CHANGELOG.md @@ -1,2 +1,40 @@ -# Change History +# Unreleased +## Breaking Changes + +### Struct Changes + +#### Removed Struct Fields + +1. PrivateLinkServiceConnectionState.ActionRequired + +## Additive Changes + +### New Constants + +1. VaultProvisioningState.VaultProvisioningStateRegisteringDNS +1. VaultProvisioningState.VaultProvisioningStateSucceeded + +### New Funcs + +1. PossibleVaultProvisioningStateValues() []VaultProvisioningState + +### Struct Changes + +#### New Structs + +1. DimensionProperties +1. MetricSpecification + +#### New Struct Fields + +1. DeletedVaultProperties.PurgeProtectionEnabled +1. Operation.IsDataAction +1. PrivateEndpointConnection.Etag +1. PrivateEndpointConnectionItem.Etag +1. PrivateEndpointConnectionItem.ID +1. PrivateLinkServiceConnectionState.ActionsRequired +1. ServiceSpecification.MetricSpecifications +1. VaultProperties.HsmPoolResourceID +1. VaultProperties.ProvisioningState +1. VirtualNetworkRule.IgnoreMissingVnetServiceEndpoint diff --git a/services/keyvault/mgmt/2019-09-01/keyvault/_meta.json b/services/keyvault/mgmt/2019-09-01/keyvault/_meta.json index c90c716d6220..d3ee3d47c49b 100644 --- a/services/keyvault/mgmt/2019-09-01/keyvault/_meta.json +++ b/services/keyvault/mgmt/2019-09-01/keyvault/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "fd0b1a763b8dbc2bfc781895bcae49c91f511c4a", "readme": "/_/azure-rest-api-specs/specification/keyvault/resource-manager/readme.md", "tag": "package-2019-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/keyvault/mgmt/2019-09-01/keyvault/enums.go b/services/keyvault/mgmt/2019-09-01/keyvault/enums.go index 0d6ec98c4fde..0977ff4b3402 100644 --- a/services/keyvault/mgmt/2019-09-01/keyvault/enums.go +++ b/services/keyvault/mgmt/2019-09-01/keyvault/enums.go @@ -382,3 +382,18 @@ const ( func PossibleStoragePermissionsValues() []StoragePermissions { return []StoragePermissions{StoragePermissionsAll, StoragePermissionsBackup, StoragePermissionsDelete, StoragePermissionsDeletesas, StoragePermissionsGet, StoragePermissionsGetsas, StoragePermissionsList, StoragePermissionsListsas, StoragePermissionsPurge, StoragePermissionsRecover, StoragePermissionsRegeneratekey, StoragePermissionsRestore, StoragePermissionsSet, StoragePermissionsSetsas, StoragePermissionsUpdate} } + +// VaultProvisioningState enumerates the values for vault provisioning state. +type VaultProvisioningState string + +const ( + // VaultProvisioningStateRegisteringDNS ... + VaultProvisioningStateRegisteringDNS VaultProvisioningState = "RegisteringDns" + // VaultProvisioningStateSucceeded ... + VaultProvisioningStateSucceeded VaultProvisioningState = "Succeeded" +) + +// PossibleVaultProvisioningStateValues returns an array of possible values for the VaultProvisioningState const type. +func PossibleVaultProvisioningStateValues() []VaultProvisioningState { + return []VaultProvisioningState{VaultProvisioningStateRegisteringDNS, VaultProvisioningStateSucceeded} +} diff --git a/services/keyvault/mgmt/2019-09-01/keyvault/models.go b/services/keyvault/mgmt/2019-09-01/keyvault/models.go index 305303631173..d8d88ba59758 100644 --- a/services/keyvault/mgmt/2019-09-01/keyvault/models.go +++ b/services/keyvault/mgmt/2019-09-01/keyvault/models.go @@ -288,6 +288,8 @@ type DeletedVaultProperties struct { ScheduledPurgeDate *date.Time `json:"scheduledPurgeDate,omitempty"` // Tags - READ-ONLY; Tags of the original vault. Tags map[string]*string `json:"tags"` + // PurgeProtectionEnabled - READ-ONLY; Purge protection status of the original vault. + PurgeProtectionEnabled *bool `json:"purgeProtectionEnabled,omitempty"` } // MarshalJSON is the custom marshaler for DeletedVaultProperties. @@ -296,6 +298,16 @@ func (dvp DeletedVaultProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// DimensionProperties type of operation: get, read, delete, etc. +type DimensionProperties struct { + // Name - Name of dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - Property to specify whether the dimension should be exported for shoebox. + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + // IPRule a rule governing the accessibility of a vault from a specific ip address or ip range. type IPRule struct { // Value - An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). @@ -655,6 +667,32 @@ type LogSpecification struct { BlobDuration *string `json:"blobDuration,omitempty"` } +// MetricSpecification metric specification of operation. +type MetricSpecification struct { + // Name - Name of metric specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of Metric specification. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Display description of Metric specification. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + Unit *string `json:"unit,omitempty"` + // AggregationType - The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. + AggregationType *string `json:"aggregationType,omitempty"` + // SupportedAggregationTypes - The supported aggregation types for the metrics. + SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` + // SupportedTimeGrainTypes - The supported time grain types for the metrics. + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // LockAggregationType - The metric lock aggregation type. + LockAggregationType *string `json:"lockAggregationType,omitempty"` + // Dimensions - The dimensions of metric + Dimensions *[]DimensionProperties `json:"dimensions,omitempty"` + // FillGapWithZero - Property to specify whether to fill gap with zero. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // InternalMetricName - The internal metric name. + InternalMetricName *string `json:"internalMetricName,omitempty"` +} + // NetworkRuleSet a set of rules governing the network accessibility of a vault. type NetworkRuleSet struct { // Bypass - Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'AzureServices', 'None' @@ -677,6 +715,8 @@ type Operation struct { Origin *string `json:"origin,omitempty"` // OperationProperties - Properties of operation, include metric specifications. *OperationProperties `json:"properties,omitempty"` + // IsDataAction - Property to specify whether the action is a data action. + IsDataAction *bool `json:"isDataAction,omitempty"` } // MarshalJSON is the custom marshaler for Operation. @@ -694,6 +734,9 @@ func (o Operation) MarshalJSON() ([]byte, error) { if o.OperationProperties != nil { objectMap["properties"] = o.OperationProperties } + if o.IsDataAction != nil { + objectMap["isDataAction"] = o.IsDataAction + } return json.Marshal(objectMap) } @@ -742,6 +785,15 @@ func (o *Operation) UnmarshalJSON(body []byte) error { } o.OperationProperties = &operationProperties } + case "isDataAction": + if v != nil { + var isDataAction bool + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + o.IsDataAction = &isDataAction + } } } @@ -955,6 +1007,8 @@ type PrivateEndpointConnection struct { autorest.Response `json:"-"` // PrivateEndpointConnectionProperties - Resource properties. *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // Etag - Modified whenever there is a change in the state of private endpoint connection. + Etag *string `json:"etag,omitempty"` // ID - READ-ONLY; Fully qualified identifier of the key vault resource. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Name of the key vault resource. @@ -973,6 +1027,9 @@ func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { if pec.PrivateEndpointConnectionProperties != nil { objectMap["properties"] = pec.PrivateEndpointConnectionProperties } + if pec.Etag != nil { + objectMap["etag"] = pec.Etag + } return json.Marshal(objectMap) } @@ -994,6 +1051,15 @@ func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { } pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pec.Etag = &etag + } case "id": if v != nil { var ID string @@ -1047,6 +1113,10 @@ func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { // PrivateEndpointConnectionItem private endpoint connection item. type PrivateEndpointConnectionItem struct { + // ID - Id of private endpoint connection. + ID *string `json:"id,omitempty"` + // Etag - Modified whenever there is a change in the state of private endpoint connection. + Etag *string `json:"etag,omitempty"` // PrivateEndpointConnectionProperties - Private endpoint connection properties. *PrivateEndpointConnectionProperties `json:"properties,omitempty"` } @@ -1054,6 +1124,12 @@ type PrivateEndpointConnectionItem struct { // MarshalJSON is the custom marshaler for PrivateEndpointConnectionItem. func (peci PrivateEndpointConnectionItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if peci.ID != nil { + objectMap["id"] = peci.ID + } + if peci.Etag != nil { + objectMap["etag"] = peci.Etag + } if peci.PrivateEndpointConnectionProperties != nil { objectMap["properties"] = peci.PrivateEndpointConnectionProperties } @@ -1069,6 +1145,24 @@ func (peci *PrivateEndpointConnectionItem) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + peci.ID = &ID + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + peci.Etag = &etag + } case "properties": if v != nil { var privateEndpointConnectionProperties PrivateEndpointConnectionProperties @@ -1264,8 +1358,8 @@ type PrivateLinkServiceConnectionState struct { Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` // Description - The reason for approval or rejection. Description *string `json:"description,omitempty"` - // ActionRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionRequired *string `json:"actionRequired,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` } // Resource key Vault resource @@ -1451,6 +1545,8 @@ func NewResourceListResultPage(cur ResourceListResult, getNextPage func(context. type ServiceSpecification struct { // LogSpecifications - Log specifications of operation. LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Metric specifications of operation. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` } // Sku SKU details @@ -1751,7 +1847,7 @@ type VaultPatchProperties struct { EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` // EnableSoftDelete - Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot be reverted to false. EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` - // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored (warning: this is a preview feature). When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the value of this property will not change. + // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the value of this property will not change. EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` // SoftDeleteRetentionInDays - softDelete data retention days. It accepts >=7 and <=90. SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` @@ -1771,8 +1867,10 @@ type VaultProperties struct { Sku *Sku `json:"sku,omitempty"` // AccessPolicies - An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. When `createMode` is set to `recover`, access policies are not required. Otherwise, access policies are required. AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` - // VaultURI - The URI of the vault for performing operations on keys and secrets. + // VaultURI - The URI of the vault for performing operations on keys and secrets. This property is readonly VaultURI *string `json:"vaultUri,omitempty"` + // HsmPoolResourceID - READ-ONLY; The resource id of HSM Pool. + HsmPoolResourceID *string `json:"hsmPoolResourceId,omitempty"` // EnabledForDeployment - Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` // EnabledForDiskEncryption - Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. @@ -1783,7 +1881,7 @@ type VaultProperties struct { EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` // SoftDeleteRetentionInDays - softDelete data retention days. It accepts >=7 and <=90. SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` - // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored (warning: this is a preview feature). When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the vault is created with the default value of false. Note that management actions are always authorized with RBAC. + // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the vault is created with the default value of false. Note that management actions are always authorized with RBAC. EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` // CreateMode - The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: 'CreateModeRecover', 'CreateModeDefault' CreateMode CreateMode `json:"createMode,omitempty"` @@ -1791,6 +1889,8 @@ type VaultProperties struct { EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` // NetworkAcls - Rules governing the accessibility of the key vault from specific network locations. NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` + // ProvisioningState - Provisioning state of the vault. Possible values include: 'VaultProvisioningStateSucceeded', 'VaultProvisioningStateRegisteringDNS' + ProvisioningState VaultProvisioningState `json:"provisioningState,omitempty"` // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections associated with the key vault. PrivateEndpointConnections *[]PrivateEndpointConnectionItem `json:"privateEndpointConnections,omitempty"` } @@ -1837,6 +1937,9 @@ func (vp VaultProperties) MarshalJSON() ([]byte, error) { if vp.NetworkAcls != nil { objectMap["networkAcls"] = vp.NetworkAcls } + if vp.ProvisioningState != "" { + objectMap["provisioningState"] = vp.ProvisioningState + } return json.Marshal(objectMap) } @@ -1924,4 +2027,6 @@ func (future *VaultsPurgeDeletedFuture) result(client VaultsClient) (ar autorest type VirtualNetworkRule struct { // ID - Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. ID *string `json:"id,omitempty"` + // IgnoreMissingVnetServiceEndpoint - Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` } diff --git a/services/keyvault/mgmt/2019-09-01/keyvault/privateendpointconnections.go b/services/keyvault/mgmt/2019-09-01/keyvault/privateendpointconnections.go index d7865b9d97a2..07419877f06e 100644 --- a/services/keyvault/mgmt/2019-09-01/keyvault/privateendpointconnections.go +++ b/services/keyvault/mgmt/2019-09-01/keyvault/privateendpointconnections.go @@ -197,7 +197,7 @@ func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*ht func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/CHANGELOG.md b/services/keyvault/mgmt/2021-10-01/keyvault/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/_meta.json b/services/keyvault/mgmt/2021-10-01/keyvault/_meta.json new file mode 100644 index 000000000000..57d6c3338d2d --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "fd0b1a763b8dbc2bfc781895bcae49c91f511c4a", + "readme": "/_/azure-rest-api-specs/specification/keyvault/resource-manager/readme.md", + "tag": "package-2021-10", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/keyvault/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/client.go b/services/keyvault/mgmt/2021-10-01/keyvault/client.go new file mode 100644 index 000000000000..402fb1a7b35b --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/client.go @@ -0,0 +1,41 @@ +// Package keyvault implements the Azure ARM Keyvault service API version 2021-10-01. +// +// The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Keyvault + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Keyvault. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/enums.go b/services/keyvault/mgmt/2021-10-01/keyvault/enums.go new file mode 100644 index 000000000000..de292da99307 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/enums.go @@ -0,0 +1,489 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AccessPolicyUpdateKind enumerates the values for access policy update kind. +type AccessPolicyUpdateKind string + +const ( + // Add ... + Add AccessPolicyUpdateKind = "add" + // Remove ... + Remove AccessPolicyUpdateKind = "remove" + // Replace ... + Replace AccessPolicyUpdateKind = "replace" +) + +// PossibleAccessPolicyUpdateKindValues returns an array of possible values for the AccessPolicyUpdateKind const type. +func PossibleAccessPolicyUpdateKindValues() []AccessPolicyUpdateKind { + return []AccessPolicyUpdateKind{Add, Remove, Replace} +} + +// ActionsRequired enumerates the values for actions required. +type ActionsRequired string + +const ( + // None ... + None ActionsRequired = "None" +) + +// PossibleActionsRequiredValues returns an array of possible values for the ActionsRequired const type. +func PossibleActionsRequiredValues() []ActionsRequired { + return []ActionsRequired{None} +} + +// CertificatePermissions enumerates the values for certificate permissions. +type CertificatePermissions string + +const ( + // All ... + All CertificatePermissions = "all" + // Backup ... + Backup CertificatePermissions = "backup" + // Create ... + Create CertificatePermissions = "create" + // Delete ... + Delete CertificatePermissions = "delete" + // Deleteissuers ... + Deleteissuers CertificatePermissions = "deleteissuers" + // Get ... + Get CertificatePermissions = "get" + // Getissuers ... + Getissuers CertificatePermissions = "getissuers" + // Import ... + Import CertificatePermissions = "import" + // List ... + List CertificatePermissions = "list" + // Listissuers ... + Listissuers CertificatePermissions = "listissuers" + // Managecontacts ... + Managecontacts CertificatePermissions = "managecontacts" + // Manageissuers ... + Manageissuers CertificatePermissions = "manageissuers" + // Purge ... + Purge CertificatePermissions = "purge" + // Recover ... + Recover CertificatePermissions = "recover" + // Restore ... + Restore CertificatePermissions = "restore" + // Setissuers ... + Setissuers CertificatePermissions = "setissuers" + // Update ... + Update CertificatePermissions = "update" +) + +// PossibleCertificatePermissionsValues returns an array of possible values for the CertificatePermissions const type. +func PossibleCertificatePermissionsValues() []CertificatePermissions { + return []CertificatePermissions{All, Backup, Create, Delete, Deleteissuers, Get, Getissuers, Import, List, Listissuers, Managecontacts, Manageissuers, Purge, Recover, Restore, Setissuers, Update} +} + +// CreateMode enumerates the values for create mode. +type CreateMode string + +const ( + // CreateModeDefault ... + CreateModeDefault CreateMode = "default" + // CreateModeRecover ... + CreateModeRecover CreateMode = "recover" +) + +// PossibleCreateModeValues returns an array of possible values for the CreateMode const type. +func PossibleCreateModeValues() []CreateMode { + return []CreateMode{CreateModeDefault, CreateModeRecover} +} + +// DeletionRecoveryLevel enumerates the values for deletion recovery level. +type DeletionRecoveryLevel string + +const ( + // Purgeable ... + Purgeable DeletionRecoveryLevel = "Purgeable" + // Recoverable ... + Recoverable DeletionRecoveryLevel = "Recoverable" + // RecoverableProtectedSubscription ... + RecoverableProtectedSubscription DeletionRecoveryLevel = "Recoverable+ProtectedSubscription" + // RecoverablePurgeable ... + RecoverablePurgeable DeletionRecoveryLevel = "Recoverable+Purgeable" +) + +// PossibleDeletionRecoveryLevelValues returns an array of possible values for the DeletionRecoveryLevel const type. +func PossibleDeletionRecoveryLevelValues() []DeletionRecoveryLevel { + return []DeletionRecoveryLevel{Purgeable, Recoverable, RecoverableProtectedSubscription, RecoverablePurgeable} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeApplication ... + IdentityTypeApplication IdentityType = "Application" + // IdentityTypeKey ... + IdentityTypeKey IdentityType = "Key" + // IdentityTypeManagedIdentity ... + IdentityTypeManagedIdentity IdentityType = "ManagedIdentity" + // IdentityTypeUser ... + IdentityTypeUser IdentityType = "User" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeApplication, IdentityTypeKey, IdentityTypeManagedIdentity, IdentityTypeUser} +} + +// JSONWebKeyCurveName enumerates the values for json web key curve name. +type JSONWebKeyCurveName string + +const ( + // P256 ... + P256 JSONWebKeyCurveName = "P-256" + // P256K ... + P256K JSONWebKeyCurveName = "P-256K" + // P384 ... + P384 JSONWebKeyCurveName = "P-384" + // P521 ... + P521 JSONWebKeyCurveName = "P-521" +) + +// PossibleJSONWebKeyCurveNameValues returns an array of possible values for the JSONWebKeyCurveName const type. +func PossibleJSONWebKeyCurveNameValues() []JSONWebKeyCurveName { + return []JSONWebKeyCurveName{P256, P256K, P384, P521} +} + +// JSONWebKeyOperation enumerates the values for json web key operation. +type JSONWebKeyOperation string + +const ( + // JSONWebKeyOperationDecrypt ... + JSONWebKeyOperationDecrypt JSONWebKeyOperation = "decrypt" + // JSONWebKeyOperationEncrypt ... + JSONWebKeyOperationEncrypt JSONWebKeyOperation = "encrypt" + // JSONWebKeyOperationImport ... + JSONWebKeyOperationImport JSONWebKeyOperation = "import" + // JSONWebKeyOperationSign ... + JSONWebKeyOperationSign JSONWebKeyOperation = "sign" + // JSONWebKeyOperationUnwrapKey ... + JSONWebKeyOperationUnwrapKey JSONWebKeyOperation = "unwrapKey" + // JSONWebKeyOperationVerify ... + JSONWebKeyOperationVerify JSONWebKeyOperation = "verify" + // JSONWebKeyOperationWrapKey ... + JSONWebKeyOperationWrapKey JSONWebKeyOperation = "wrapKey" +) + +// PossibleJSONWebKeyOperationValues returns an array of possible values for the JSONWebKeyOperation const type. +func PossibleJSONWebKeyOperationValues() []JSONWebKeyOperation { + return []JSONWebKeyOperation{JSONWebKeyOperationDecrypt, JSONWebKeyOperationEncrypt, JSONWebKeyOperationImport, JSONWebKeyOperationSign, JSONWebKeyOperationUnwrapKey, JSONWebKeyOperationVerify, JSONWebKeyOperationWrapKey} +} + +// JSONWebKeyType enumerates the values for json web key type. +type JSONWebKeyType string + +const ( + // EC ... + EC JSONWebKeyType = "EC" + // ECHSM ... + ECHSM JSONWebKeyType = "EC-HSM" + // RSA ... + RSA JSONWebKeyType = "RSA" + // RSAHSM ... + RSAHSM JSONWebKeyType = "RSA-HSM" +) + +// PossibleJSONWebKeyTypeValues returns an array of possible values for the JSONWebKeyType const type. +func PossibleJSONWebKeyTypeValues() []JSONWebKeyType { + return []JSONWebKeyType{EC, ECHSM, RSA, RSAHSM} +} + +// KeyPermissions enumerates the values for key permissions. +type KeyPermissions string + +const ( + // KeyPermissionsAll ... + KeyPermissionsAll KeyPermissions = "all" + // KeyPermissionsBackup ... + KeyPermissionsBackup KeyPermissions = "backup" + // KeyPermissionsCreate ... + KeyPermissionsCreate KeyPermissions = "create" + // KeyPermissionsDecrypt ... + KeyPermissionsDecrypt KeyPermissions = "decrypt" + // KeyPermissionsDelete ... + KeyPermissionsDelete KeyPermissions = "delete" + // KeyPermissionsEncrypt ... + KeyPermissionsEncrypt KeyPermissions = "encrypt" + // KeyPermissionsGet ... + KeyPermissionsGet KeyPermissions = "get" + // KeyPermissionsImport ... + KeyPermissionsImport KeyPermissions = "import" + // KeyPermissionsList ... + KeyPermissionsList KeyPermissions = "list" + // KeyPermissionsPurge ... + KeyPermissionsPurge KeyPermissions = "purge" + // KeyPermissionsRecover ... + KeyPermissionsRecover KeyPermissions = "recover" + // KeyPermissionsRestore ... + KeyPermissionsRestore KeyPermissions = "restore" + // KeyPermissionsSign ... + KeyPermissionsSign KeyPermissions = "sign" + // KeyPermissionsUnwrapKey ... + KeyPermissionsUnwrapKey KeyPermissions = "unwrapKey" + // KeyPermissionsUpdate ... + KeyPermissionsUpdate KeyPermissions = "update" + // KeyPermissionsVerify ... + KeyPermissionsVerify KeyPermissions = "verify" + // KeyPermissionsWrapKey ... + KeyPermissionsWrapKey KeyPermissions = "wrapKey" +) + +// PossibleKeyPermissionsValues returns an array of possible values for the KeyPermissions const type. +func PossibleKeyPermissionsValues() []KeyPermissions { + return []KeyPermissions{KeyPermissionsAll, KeyPermissionsBackup, KeyPermissionsCreate, KeyPermissionsDecrypt, KeyPermissionsDelete, KeyPermissionsEncrypt, KeyPermissionsGet, KeyPermissionsImport, KeyPermissionsList, KeyPermissionsPurge, KeyPermissionsRecover, KeyPermissionsRestore, KeyPermissionsSign, KeyPermissionsUnwrapKey, KeyPermissionsUpdate, KeyPermissionsVerify, KeyPermissionsWrapKey} +} + +// ManagedHsmSkuName enumerates the values for managed hsm sku name. +type ManagedHsmSkuName string + +const ( + // CustomB32 ... + CustomB32 ManagedHsmSkuName = "Custom_B32" + // StandardB1 ... + StandardB1 ManagedHsmSkuName = "Standard_B1" +) + +// PossibleManagedHsmSkuNameValues returns an array of possible values for the ManagedHsmSkuName const type. +func PossibleManagedHsmSkuNameValues() []ManagedHsmSkuName { + return []ManagedHsmSkuName{CustomB32, StandardB1} +} + +// NetworkRuleAction enumerates the values for network rule action. +type NetworkRuleAction string + +const ( + // Allow ... + Allow NetworkRuleAction = "Allow" + // Deny ... + Deny NetworkRuleAction = "Deny" +) + +// PossibleNetworkRuleActionValues returns an array of possible values for the NetworkRuleAction const type. +func PossibleNetworkRuleActionValues() []NetworkRuleAction { + return []NetworkRuleAction{Allow, Deny} +} + +// NetworkRuleBypassOptions enumerates the values for network rule bypass options. +type NetworkRuleBypassOptions string + +const ( + // NetworkRuleBypassOptionsAzureServices ... + NetworkRuleBypassOptionsAzureServices NetworkRuleBypassOptions = "AzureServices" + // NetworkRuleBypassOptionsNone ... + NetworkRuleBypassOptionsNone NetworkRuleBypassOptions = "None" +) + +// PossibleNetworkRuleBypassOptionsValues returns an array of possible values for the NetworkRuleBypassOptions const type. +func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { + return []NetworkRuleBypassOptions{NetworkRuleBypassOptionsAzureServices, NetworkRuleBypassOptionsNone} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // Creating ... + Creating PrivateEndpointConnectionProvisioningState = "Creating" + // Deleting ... + Deleting PrivateEndpointConnectionProvisioningState = "Deleting" + // Disconnected ... + Disconnected PrivateEndpointConnectionProvisioningState = "Disconnected" + // Failed ... + Failed PrivateEndpointConnectionProvisioningState = "Failed" + // Succeeded ... + Succeeded PrivateEndpointConnectionProvisioningState = "Succeeded" + // Updating ... + Updating PrivateEndpointConnectionProvisioningState = "Updating" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{Creating, Deleting, Disconnected, Failed, Succeeded, Updating} +} + +// PrivateEndpointServiceConnectionStatus enumerates the values for private endpoint service connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + // PrivateEndpointServiceConnectionStatusApproved ... + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + // PrivateEndpointServiceConnectionStatusDisconnected ... + PrivateEndpointServiceConnectionStatusDisconnected PrivateEndpointServiceConnectionStatus = "Disconnected" + // PrivateEndpointServiceConnectionStatusPending ... + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusRejected ... + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns an array of possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{PrivateEndpointServiceConnectionStatusApproved, PrivateEndpointServiceConnectionStatusDisconnected, PrivateEndpointServiceConnectionStatusPending, PrivateEndpointServiceConnectionStatusRejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateActivated The managed HSM pool is ready for normal use. + ProvisioningStateActivated ProvisioningState = "Activated" + // ProvisioningStateDeleting The managed HSM Pool is currently being deleted. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed Provisioning of the managed HSM Pool has failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning The managed HSM Pool is currently being provisioned. + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateRestoring The managed HSM pool is being restored from full HSM backup. + ProvisioningStateRestoring ProvisioningState = "Restoring" + // ProvisioningStateSecurityDomainRestore The managed HSM pool is waiting for a security domain restore + // action. + ProvisioningStateSecurityDomainRestore ProvisioningState = "SecurityDomainRestore" + // ProvisioningStateSucceeded The managed HSM Pool has been full provisioned. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating The managed HSM Pool is currently being updated. + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateActivated, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateProvisioning, ProvisioningStateRestoring, ProvisioningStateSecurityDomainRestore, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // Disabled ... + Disabled PublicNetworkAccess = "Disabled" + // Enabled ... + Enabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{Disabled, Enabled} +} + +// Reason enumerates the values for reason. +type Reason string + +const ( + // AccountNameInvalid ... + AccountNameInvalid Reason = "AccountNameInvalid" + // AlreadyExists ... + AlreadyExists Reason = "AlreadyExists" +) + +// PossibleReasonValues returns an array of possible values for the Reason const type. +func PossibleReasonValues() []Reason { + return []Reason{AccountNameInvalid, AlreadyExists} +} + +// SecretPermissions enumerates the values for secret permissions. +type SecretPermissions string + +const ( + // SecretPermissionsAll ... + SecretPermissionsAll SecretPermissions = "all" + // SecretPermissionsBackup ... + SecretPermissionsBackup SecretPermissions = "backup" + // SecretPermissionsDelete ... + SecretPermissionsDelete SecretPermissions = "delete" + // SecretPermissionsGet ... + SecretPermissionsGet SecretPermissions = "get" + // SecretPermissionsList ... + SecretPermissionsList SecretPermissions = "list" + // SecretPermissionsPurge ... + SecretPermissionsPurge SecretPermissions = "purge" + // SecretPermissionsRecover ... + SecretPermissionsRecover SecretPermissions = "recover" + // SecretPermissionsRestore ... + SecretPermissionsRestore SecretPermissions = "restore" + // SecretPermissionsSet ... + SecretPermissionsSet SecretPermissions = "set" +) + +// PossibleSecretPermissionsValues returns an array of possible values for the SecretPermissions const type. +func PossibleSecretPermissionsValues() []SecretPermissions { + return []SecretPermissions{SecretPermissionsAll, SecretPermissionsBackup, SecretPermissionsDelete, SecretPermissionsGet, SecretPermissionsList, SecretPermissionsPurge, SecretPermissionsRecover, SecretPermissionsRestore, SecretPermissionsSet} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Premium ... + Premium SkuName = "premium" + // Standard ... + Standard SkuName = "standard" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{Premium, Standard} +} + +// StoragePermissions enumerates the values for storage permissions. +type StoragePermissions string + +const ( + // StoragePermissionsAll ... + StoragePermissionsAll StoragePermissions = "all" + // StoragePermissionsBackup ... + StoragePermissionsBackup StoragePermissions = "backup" + // StoragePermissionsDelete ... + StoragePermissionsDelete StoragePermissions = "delete" + // StoragePermissionsDeletesas ... + StoragePermissionsDeletesas StoragePermissions = "deletesas" + // StoragePermissionsGet ... + StoragePermissionsGet StoragePermissions = "get" + // StoragePermissionsGetsas ... + StoragePermissionsGetsas StoragePermissions = "getsas" + // StoragePermissionsList ... + StoragePermissionsList StoragePermissions = "list" + // StoragePermissionsListsas ... + StoragePermissionsListsas StoragePermissions = "listsas" + // StoragePermissionsPurge ... + StoragePermissionsPurge StoragePermissions = "purge" + // StoragePermissionsRecover ... + StoragePermissionsRecover StoragePermissions = "recover" + // StoragePermissionsRegeneratekey ... + StoragePermissionsRegeneratekey StoragePermissions = "regeneratekey" + // StoragePermissionsRestore ... + StoragePermissionsRestore StoragePermissions = "restore" + // StoragePermissionsSet ... + StoragePermissionsSet StoragePermissions = "set" + // StoragePermissionsSetsas ... + StoragePermissionsSetsas StoragePermissions = "setsas" + // StoragePermissionsUpdate ... + StoragePermissionsUpdate StoragePermissions = "update" +) + +// PossibleStoragePermissionsValues returns an array of possible values for the StoragePermissions const type. +func PossibleStoragePermissionsValues() []StoragePermissions { + return []StoragePermissions{StoragePermissionsAll, StoragePermissionsBackup, StoragePermissionsDelete, StoragePermissionsDeletesas, StoragePermissionsGet, StoragePermissionsGetsas, StoragePermissionsList, StoragePermissionsListsas, StoragePermissionsPurge, StoragePermissionsRecover, StoragePermissionsRegeneratekey, StoragePermissionsRestore, StoragePermissionsSet, StoragePermissionsSetsas, StoragePermissionsUpdate} +} + +// VaultProvisioningState enumerates the values for vault provisioning state. +type VaultProvisioningState string + +const ( + // VaultProvisioningStateRegisteringDNS ... + VaultProvisioningStateRegisteringDNS VaultProvisioningState = "RegisteringDns" + // VaultProvisioningStateSucceeded ... + VaultProvisioningStateSucceeded VaultProvisioningState = "Succeeded" +) + +// PossibleVaultProvisioningStateValues returns an array of possible values for the VaultProvisioningState const type. +func PossibleVaultProvisioningStateValues() []VaultProvisioningState { + return []VaultProvisioningState{VaultProvisioningStateRegisteringDNS, VaultProvisioningStateSucceeded} +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/keys.go b/services/keyvault/mgmt/2021-10-01/keyvault/keys.go new file mode 100644 index 000000000000..038ae78781dd --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/keys.go @@ -0,0 +1,554 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// KeysClient is the the Azure management API provides a RESTful set of web services that interact with Azure Key +// Vault. +type KeysClient struct { + BaseClient +} + +// NewKeysClient creates an instance of the KeysClient client. +func NewKeysClient(subscriptionID string) KeysClient { + return NewKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewKeysClientWithBaseURI creates an instance of the KeysClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewKeysClientWithBaseURI(baseURI string, subscriptionID string) KeysClient { + return KeysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateIfNotExist creates the first version of a new key if it does not exist. If it already exists, then the +// existing key is returned without any write operations being performed. This API does not create subsequent versions, +// and does not update existing keys. +// Parameters: +// resourceGroupName - the name of the resource group which contains the specified key vault. +// vaultName - the name of the key vault which contains the key to be created. +// keyName - the name of the key to be created. +// parameters - the parameters used to create the specified key. +func (client KeysClient) CreateIfNotExist(ctx context.Context, resourceGroupName string, vaultName string, keyName string, parameters KeyCreateParameters) (result Key, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.CreateIfNotExist") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: keyName, + Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{1,127}$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.KeysClient", "CreateIfNotExist", err.Error()) + } + + req, err := client.CreateIfNotExistPreparer(ctx, resourceGroupName, vaultName, keyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "CreateIfNotExist", nil, "Failure preparing request") + return + } + + resp, err := client.CreateIfNotExistSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "CreateIfNotExist", resp, "Failure sending request") + return + } + + result, err = client.CreateIfNotExistResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "CreateIfNotExist", resp, "Failure responding to request") + return + } + + return +} + +// CreateIfNotExistPreparer prepares the CreateIfNotExist request. +func (client KeysClient) CreateIfNotExistPreparer(ctx context.Context, resourceGroupName string, vaultName string, keyName string, parameters KeyCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateIfNotExistSender sends the CreateIfNotExist request. The method will close the +// http.Response Body if it receives an error. +func (client KeysClient) CreateIfNotExistSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateIfNotExistResponder handles the response to the CreateIfNotExist request. The method always +// closes the http.Response Body. +func (client KeysClient) CreateIfNotExistResponder(resp *http.Response) (result Key, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the current version of the specified key from the specified key vault. +// Parameters: +// resourceGroupName - the name of the resource group which contains the specified key vault. +// vaultName - the name of the vault which contains the key to be retrieved. +// keyName - the name of the key to be retrieved. +func (client KeysClient) Get(ctx context.Context, resourceGroupName string, vaultName string, keyName string) (result Key, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: keyName, + Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{1,127}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.KeysClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, vaultName, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client KeysClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string, keyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client KeysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client KeysClient) GetResponder(resp *http.Response) (result Key, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVersion gets the specified version of the specified key in the specified key vault. +// Parameters: +// resourceGroupName - the name of the resource group which contains the specified key vault. +// vaultName - the name of the vault which contains the key version to be retrieved. +// keyName - the name of the key version to be retrieved. +// keyVersion - the version of the key to be retrieved. +func (client KeysClient) GetVersion(ctx context.Context, resourceGroupName string, vaultName string, keyName string, keyVersion string) (result Key, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.GetVersion") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: keyName, + Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{1,127}$`, Chain: nil}}}, + {TargetValue: keyVersion, + Constraints: []validation.Constraint{{Target: "keyVersion", Name: validation.Pattern, Rule: `^[a-fA-F0-9]{32}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.KeysClient", "GetVersion", err.Error()) + } + + req, err := client.GetVersionPreparer(ctx, resourceGroupName, vaultName, keyName, keyVersion) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "GetVersion", nil, "Failure preparing request") + return + } + + resp, err := client.GetVersionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "GetVersion", resp, "Failure sending request") + return + } + + result, err = client.GetVersionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "GetVersion", resp, "Failure responding to request") + return + } + + return +} + +// GetVersionPreparer prepares the GetVersion request. +func (client KeysClient) GetVersionPreparer(ctx context.Context, resourceGroupName string, vaultName string, keyName string, keyVersion string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "keyVersion": autorest.Encode("path", keyVersion), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVersionSender sends the GetVersion request. The method will close the +// http.Response Body if it receives an error. +func (client KeysClient) GetVersionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVersionResponder handles the response to the GetVersion request. The method always +// closes the http.Response Body. +func (client KeysClient) GetVersionResponder(resp *http.Response) (result Key, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists the keys in the specified key vault. +// Parameters: +// resourceGroupName - the name of the resource group which contains the specified key vault. +// vaultName - the name of the vault which contains the keys to be retrieved. +func (client KeysClient) List(ctx context.Context, resourceGroupName string, vaultName string) (result KeyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.List") + defer func() { + sc := -1 + if result.klr.Response.Response != nil { + sc = result.klr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.KeysClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.klr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "List", resp, "Failure sending request") + return + } + + result.klr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "List", resp, "Failure responding to request") + return + } + if result.klr.hasNextLink() && result.klr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client KeysClient) ListPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client KeysClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client KeysClient) ListResponder(resp *http.Response) (result KeyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client KeysClient) listNextResults(ctx context.Context, lastResults KeyListResult) (result KeyListResult, err error) { + req, err := lastResults.keyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.KeysClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.KeysClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client KeysClient) ListComplete(ctx context.Context, resourceGroupName string, vaultName string) (result KeyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, vaultName) + return +} + +// ListVersions lists the versions of the specified key in the specified key vault. +// Parameters: +// resourceGroupName - the name of the resource group which contains the specified key vault. +// vaultName - the name of the vault which contains the key versions to be retrieved. +// keyName - the name of the key versions to be retrieved. +func (client KeysClient) ListVersions(ctx context.Context, resourceGroupName string, vaultName string, keyName string) (result KeyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.ListVersions") + defer func() { + sc := -1 + if result.klr.Response.Response != nil { + sc = result.klr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: keyName, + Constraints: []validation.Constraint{{Target: "keyName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{1,127}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.KeysClient", "ListVersions", err.Error()) + } + + result.fn = client.listVersionsNextResults + req, err := client.ListVersionsPreparer(ctx, resourceGroupName, vaultName, keyName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "ListVersions", nil, "Failure preparing request") + return + } + + resp, err := client.ListVersionsSender(req) + if err != nil { + result.klr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "ListVersions", resp, "Failure sending request") + return + } + + result.klr, err = client.ListVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "ListVersions", resp, "Failure responding to request") + return + } + if result.klr.hasNextLink() && result.klr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVersionsPreparer prepares the ListVersions request. +func (client KeysClient) ListVersionsPreparer(ctx context.Context, resourceGroupName string, vaultName string, keyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "keyName": autorest.Encode("path", keyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVersionsSender sends the ListVersions request. The method will close the +// http.Response Body if it receives an error. +func (client KeysClient) ListVersionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVersionsResponder handles the response to the ListVersions request. The method always +// closes the http.Response Body. +func (client KeysClient) ListVersionsResponder(resp *http.Response) (result KeyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVersionsNextResults retrieves the next set of results, if any. +func (client KeysClient) listVersionsNextResults(ctx context.Context, lastResults KeyListResult) (result KeyListResult, err error) { + req, err := lastResults.keyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.KeysClient", "listVersionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.KeysClient", "listVersionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.KeysClient", "listVersionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVersionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client KeysClient) ListVersionsComplete(ctx context.Context, resourceGroupName string, vaultName string, keyName string) (result KeyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KeysClient.ListVersions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListVersions(ctx, resourceGroupName, vaultName, keyName) + return +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/keyvaultapi/interfaces.go b/services/keyvault/mgmt/2021-10-01/keyvault/keyvaultapi/interfaces.go new file mode 100644 index 000000000000..da7ecf2b504c --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/keyvaultapi/interfaces.go @@ -0,0 +1,121 @@ +package keyvaultapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault" + "github.com/Azure/go-autorest/autorest" +) + +// KeysClientAPI contains the set of methods on the KeysClient type. +type KeysClientAPI interface { + CreateIfNotExist(ctx context.Context, resourceGroupName string, vaultName string, keyName string, parameters keyvault.KeyCreateParameters) (result keyvault.Key, err error) + Get(ctx context.Context, resourceGroupName string, vaultName string, keyName string) (result keyvault.Key, err error) + GetVersion(ctx context.Context, resourceGroupName string, vaultName string, keyName string, keyVersion string) (result keyvault.Key, err error) + List(ctx context.Context, resourceGroupName string, vaultName string) (result keyvault.KeyListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, vaultName string) (result keyvault.KeyListResultIterator, err error) + ListVersions(ctx context.Context, resourceGroupName string, vaultName string, keyName string) (result keyvault.KeyListResultPage, err error) + ListVersionsComplete(ctx context.Context, resourceGroupName string, vaultName string, keyName string) (result keyvault.KeyListResultIterator, err error) +} + +var _ KeysClientAPI = (*keyvault.KeysClient)(nil) + +// VaultsClientAPI contains the set of methods on the VaultsClient type. +type VaultsClientAPI interface { + CheckNameAvailability(ctx context.Context, vaultName keyvault.VaultCheckNameAvailabilityParameters) (result keyvault.CheckNameAvailabilityResult, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters keyvault.VaultCreateOrUpdateParameters) (result keyvault.VaultsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, vaultName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, vaultName string) (result keyvault.Vault, err error) + GetDeleted(ctx context.Context, vaultName string, location string) (result keyvault.DeletedVault, err error) + List(ctx context.Context, top *int32) (result keyvault.ResourceListResultPage, err error) + ListComplete(ctx context.Context, top *int32) (result keyvault.ResourceListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result keyvault.VaultListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result keyvault.VaultListResultIterator, err error) + ListBySubscription(ctx context.Context, top *int32) (result keyvault.VaultListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, top *int32) (result keyvault.VaultListResultIterator, err error) + ListDeleted(ctx context.Context) (result keyvault.DeletedVaultListResultPage, err error) + ListDeletedComplete(ctx context.Context) (result keyvault.DeletedVaultListResultIterator, err error) + PurgeDeleted(ctx context.Context, vaultName string, location string) (result keyvault.VaultsPurgeDeletedFuture, err error) + Update(ctx context.Context, resourceGroupName string, vaultName string, parameters keyvault.VaultPatchParameters) (result keyvault.Vault, err error) + UpdateAccessPolicy(ctx context.Context, resourceGroupName string, vaultName string, operationKind keyvault.AccessPolicyUpdateKind, parameters keyvault.VaultAccessPolicyParameters) (result keyvault.VaultAccessPolicyParameters, err error) +} + +var _ VaultsClientAPI = (*keyvault.VaultsClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string) (result keyvault.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string) (result keyvault.PrivateEndpointConnection, err error) + ListByResource(ctx context.Context, resourceGroupName string, vaultName string) (result keyvault.PrivateEndpointConnectionListResultPage, err error) + ListByResourceComplete(ctx context.Context, resourceGroupName string, vaultName string) (result keyvault.PrivateEndpointConnectionListResultIterator, err error) + Put(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, properties keyvault.PrivateEndpointConnection) (result keyvault.PrivateEndpointConnection, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*keyvault.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + ListByVault(ctx context.Context, resourceGroupName string, vaultName string) (result keyvault.PrivateLinkResourceListResult, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*keyvault.PrivateLinkResourcesClient)(nil) + +// ManagedHsmsClientAPI contains the set of methods on the ManagedHsmsClient type. +type ManagedHsmsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters keyvault.ManagedHsm) (result keyvault.ManagedHsmsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, name string) (result keyvault.ManagedHsmsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, name string) (result keyvault.ManagedHsm, err error) + GetDeleted(ctx context.Context, name string, location string) (result keyvault.DeletedManagedHsm, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result keyvault.ManagedHsmListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result keyvault.ManagedHsmListResultIterator, err error) + ListBySubscription(ctx context.Context, top *int32) (result keyvault.ManagedHsmListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, top *int32) (result keyvault.ManagedHsmListResultIterator, err error) + ListDeleted(ctx context.Context) (result keyvault.DeletedManagedHsmListResultPage, err error) + ListDeletedComplete(ctx context.Context) (result keyvault.DeletedManagedHsmListResultIterator, err error) + PurgeDeleted(ctx context.Context, name string, location string) (result keyvault.ManagedHsmsPurgeDeletedFuture, err error) + Update(ctx context.Context, resourceGroupName string, name string, parameters keyvault.ManagedHsm) (result keyvault.ManagedHsmsUpdateFuture, err error) +} + +var _ ManagedHsmsClientAPI = (*keyvault.ManagedHsmsClient)(nil) + +// MHSMPrivateEndpointConnectionsClientAPI contains the set of methods on the MHSMPrivateEndpointConnectionsClient type. +type MHSMPrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result keyvault.MHSMPrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result keyvault.MHSMPrivateEndpointConnection, err error) + ListByResource(ctx context.Context, resourceGroupName string, name string) (result keyvault.MHSMPrivateEndpointConnectionsListResultPage, err error) + ListByResourceComplete(ctx context.Context, resourceGroupName string, name string) (result keyvault.MHSMPrivateEndpointConnectionsListResultIterator, err error) + Put(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, properties keyvault.MHSMPrivateEndpointConnection) (result keyvault.MHSMPrivateEndpointConnection, err error) +} + +var _ MHSMPrivateEndpointConnectionsClientAPI = (*keyvault.MHSMPrivateEndpointConnectionsClient)(nil) + +// MHSMPrivateLinkResourcesClientAPI contains the set of methods on the MHSMPrivateLinkResourcesClient type. +type MHSMPrivateLinkResourcesClientAPI interface { + ListByMHSMResource(ctx context.Context, resourceGroupName string, name string) (result keyvault.MHSMPrivateLinkResourceListResult, err error) +} + +var _ MHSMPrivateLinkResourcesClientAPI = (*keyvault.MHSMPrivateLinkResourcesClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result keyvault.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result keyvault.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*keyvault.OperationsClient)(nil) + +// SecretsClientAPI contains the set of methods on the SecretsClient type. +type SecretsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters keyvault.SecretCreateOrUpdateParameters) (result keyvault.Secret, err error) + Get(ctx context.Context, resourceGroupName string, vaultName string, secretName string) (result keyvault.Secret, err error) + List(ctx context.Context, resourceGroupName string, vaultName string, top *int32) (result keyvault.SecretListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, vaultName string, top *int32) (result keyvault.SecretListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters keyvault.SecretPatchParameters) (result keyvault.Secret, err error) +} + +var _ SecretsClientAPI = (*keyvault.SecretsClient)(nil) diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/managedhsms.go b/services/keyvault/mgmt/2021-10-01/keyvault/managedhsms.go new file mode 100644 index 000000000000..356b67ce05a9 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/managedhsms.go @@ -0,0 +1,856 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedHsmsClient is the the Azure management API provides a RESTful set of web services that interact with Azure +// Key Vault. +type ManagedHsmsClient struct { + BaseClient +} + +// NewManagedHsmsClient creates an instance of the ManagedHsmsClient client. +func NewManagedHsmsClient(subscriptionID string) ManagedHsmsClient { + return NewManagedHsmsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedHsmsClientWithBaseURI creates an instance of the ManagedHsmsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewManagedHsmsClientWithBaseURI(baseURI string, subscriptionID string) ManagedHsmsClient { + return ManagedHsmsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a managed HSM Pool in the specified subscription. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// name - name of the managed HSM Pool +// parameters - parameters to create or update the managed HSM Pool +func (client ManagedHsmsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm) (result ManagedHsmsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, name, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedHsmsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedHsmsClient) CreateOrUpdateSender(req *http.Request) (future ManagedHsmsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedHsmsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedHsm, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified managed HSM Pool. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// name - the name of the managed HSM Pool to delete +func (client ManagedHsmsClient) Delete(ctx context.Context, resourceGroupName string, name string) (result ManagedHsmsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedHsmsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedHsmsClient) DeleteSender(req *http.Request) (future ManagedHsmsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedHsmsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified managed HSM Pool. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// name - the name of the managed HSM Pool. +func (client ManagedHsmsClient) Get(ctx context.Context, resourceGroupName string, name string) (result ManagedHsm, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedHsmsClient) GetPreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedHsmsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedHsmsClient) GetResponder(resp *http.Response) (result ManagedHsm, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeleted gets the specified deleted managed HSM. +// Parameters: +// name - the name of the deleted managed HSM. +// location - the location of the deleted managed HSM. +func (client ManagedHsmsClient) GetDeleted(ctx context.Context, name string, location string) (result DeletedManagedHsm, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.GetDeleted") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDeletedPreparer(ctx, name, location) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "GetDeleted", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "GetDeleted", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "GetDeleted", resp, "Failure responding to request") + return + } + + return +} + +// GetDeletedPreparer prepares the GetDeleted request. +func (client ManagedHsmsClient) GetDeletedPreparer(ctx context.Context, name string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedSender sends the GetDeleted request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedHsmsClient) GetDeletedSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeletedResponder handles the response to the GetDeleted request. The method always +// closes the http.Response Body. +func (client ManagedHsmsClient) GetDeletedResponder(resp *http.Response) (result DeletedManagedHsm, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup the List operation gets information about the managed HSM Pools associated with the subscription +// and within the specified resource group. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// top - maximum number of results to return. +func (client ManagedHsmsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result ManagedHsmListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mhlr.Response.Response != nil { + sc = result.mhlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mhlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mhlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mhlr.hasNextLink() && result.mhlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ManagedHsmsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedHsmsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ManagedHsmsClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedHsmListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ManagedHsmsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ManagedHsmListResult) (result ManagedHsmListResult, err error) { + req, err := lastResults.managedHsmListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedHsmsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result ManagedHsmListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top) + return +} + +// ListBySubscription the List operation gets information about the managed HSM Pools associated with the subscription. +// Parameters: +// top - maximum number of results to return. +func (client ManagedHsmsClient) ListBySubscription(ctx context.Context, top *int32) (result ManagedHsmListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.ListBySubscription") + defer func() { + sc := -1 + if result.mhlr.Response.Response != nil { + sc = result.mhlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.mhlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.mhlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.mhlr.hasNextLink() && result.mhlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ManagedHsmsClient) ListBySubscriptionPreparer(ctx context.Context, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedHsmsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ManagedHsmsClient) ListBySubscriptionResponder(resp *http.Response) (result ManagedHsmListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client ManagedHsmsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ManagedHsmListResult) (result ManagedHsmListResult, err error) { + req, err := lastResults.managedHsmListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedHsmsClient) ListBySubscriptionComplete(ctx context.Context, top *int32) (result ManagedHsmListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, top) + return +} + +// ListDeleted the List operation gets information about the deleted managed HSMs associated with the subscription. +func (client ManagedHsmsClient) ListDeleted(ctx context.Context) (result DeletedManagedHsmListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.ListDeleted") + defer func() { + sc := -1 + if result.dmhlr.Response.Response != nil { + sc = result.dmhlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listDeletedNextResults + req, err := client.ListDeletedPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "ListDeleted", nil, "Failure preparing request") + return + } + + resp, err := client.ListDeletedSender(req) + if err != nil { + result.dmhlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "ListDeleted", resp, "Failure sending request") + return + } + + result.dmhlr, err = client.ListDeletedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "ListDeleted", resp, "Failure responding to request") + return + } + if result.dmhlr.hasNextLink() && result.dmhlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListDeletedPreparer prepares the ListDeleted request. +func (client ManagedHsmsClient) ListDeletedPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDeletedSender sends the ListDeleted request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedHsmsClient) ListDeletedSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDeletedResponder handles the response to the ListDeleted request. The method always +// closes the http.Response Body. +func (client ManagedHsmsClient) ListDeletedResponder(resp *http.Response) (result DeletedManagedHsmListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listDeletedNextResults retrieves the next set of results, if any. +func (client ManagedHsmsClient) listDeletedNextResults(ctx context.Context, lastResults DeletedManagedHsmListResult) (result DeletedManagedHsmListResult, err error) { + req, err := lastResults.deletedManagedHsmListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "listDeletedNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListDeletedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "listDeletedNextResults", resp, "Failure sending next results request") + } + result, err = client.ListDeletedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "listDeletedNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListDeletedComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedHsmsClient) ListDeletedComplete(ctx context.Context) (result DeletedManagedHsmListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.ListDeleted") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListDeleted(ctx) + return +} + +// PurgeDeleted permanently deletes the specified managed HSM. +// Parameters: +// name - the name of the soft-deleted managed HSM. +// location - the location of the soft-deleted managed HSM. +func (client ManagedHsmsClient) PurgeDeleted(ctx context.Context, name string, location string) (result ManagedHsmsPurgeDeletedFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.PurgeDeleted") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PurgeDeletedPreparer(ctx, name, location) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "PurgeDeleted", nil, "Failure preparing request") + return + } + + result, err = client.PurgeDeletedSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "PurgeDeleted", result.Response(), "Failure sending request") + return + } + + return +} + +// PurgeDeletedPreparer prepares the PurgeDeleted request. +func (client ManagedHsmsClient) PurgeDeletedPreparer(ctx context.Context, name string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeDeletedSender sends the PurgeDeleted request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedHsmsClient) PurgeDeletedSender(req *http.Request) (future ManagedHsmsPurgeDeletedFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PurgeDeletedResponder handles the response to the PurgeDeleted request. The method always +// closes the http.Response Body. +func (client ManagedHsmsClient) PurgeDeletedResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update update a managed HSM Pool in the specified subscription. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// name - name of the managed HSM Pool +// parameters - parameters to patch the managed HSM Pool +func (client ManagedHsmsClient) Update(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm) (result ManagedHsmsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, name, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ManagedHsmsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, name string, parameters ManagedHsm) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedHsmsClient) UpdateSender(req *http.Request) (future ManagedHsmsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ManagedHsmsClient) UpdateResponder(resp *http.Response) (result ManagedHsm, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/mhsmprivateendpointconnections.go b/services/keyvault/mgmt/2021-10-01/keyvault/mhsmprivateendpointconnections.go new file mode 100644 index 000000000000..1181247843cf --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/mhsmprivateendpointconnections.go @@ -0,0 +1,395 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MHSMPrivateEndpointConnectionsClient is the the Azure management API provides a RESTful set of web services that +// interact with Azure Key Vault. +type MHSMPrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewMHSMPrivateEndpointConnectionsClient creates an instance of the MHSMPrivateEndpointConnectionsClient client. +func NewMHSMPrivateEndpointConnectionsClient(subscriptionID string) MHSMPrivateEndpointConnectionsClient { + return NewMHSMPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMHSMPrivateEndpointConnectionsClientWithBaseURI creates an instance of the MHSMPrivateEndpointConnectionsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewMHSMPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) MHSMPrivateEndpointConnectionsClient { + return MHSMPrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete deletes the specified private endpoint connection associated with the managed hsm pool. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// name - name of the managed HSM Pool +// privateEndpointConnectionName - name of the private endpoint connection associated with the managed hsm +// pool. +func (client MHSMPrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result MHSMPrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MHSMPrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, name, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MHSMPrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MHSMPrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future MHSMPrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MHSMPrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result MHSMPrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the specified private endpoint connection associated with the managed HSM Pool. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// name - name of the managed HSM Pool +// privateEndpointConnectionName - name of the private endpoint connection associated with the managed hsm +// pool. +func (client MHSMPrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (result MHSMPrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MHSMPrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MHSMPrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MHSMPrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MHSMPrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result MHSMPrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResource the List operation gets information about the private endpoint connections associated with the +// managed HSM Pool. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// name - name of the managed HSM Pool +func (client MHSMPrivateEndpointConnectionsClient) ListByResource(ctx context.Context, resourceGroupName string, name string) (result MHSMPrivateEndpointConnectionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MHSMPrivateEndpointConnectionsClient.ListByResource") + defer func() { + sc := -1 + if result.mpeclr.Response.Response != nil { + sc = result.mpeclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceNextResults + req, err := client.ListByResourcePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "ListByResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceSender(req) + if err != nil { + result.mpeclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "ListByResource", resp, "Failure sending request") + return + } + + result.mpeclr, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "ListByResource", resp, "Failure responding to request") + return + } + if result.mpeclr.hasNextLink() && result.mpeclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourcePreparer prepares the ListByResource request. +func (client MHSMPrivateEndpointConnectionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceSender sends the ListByResource request. The method will close the +// http.Response Body if it receives an error. +func (client MHSMPrivateEndpointConnectionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceResponder handles the response to the ListByResource request. The method always +// closes the http.Response Body. +func (client MHSMPrivateEndpointConnectionsClient) ListByResourceResponder(resp *http.Response) (result MHSMPrivateEndpointConnectionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceNextResults retrieves the next set of results, if any. +func (client MHSMPrivateEndpointConnectionsClient) listByResourceNextResults(ctx context.Context, lastResults MHSMPrivateEndpointConnectionsListResult) (result MHSMPrivateEndpointConnectionsListResult, err error) { + req, err := lastResults.mHSMPrivateEndpointConnectionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "listByResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client MHSMPrivateEndpointConnectionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, name string) (result MHSMPrivateEndpointConnectionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MHSMPrivateEndpointConnectionsClient.ListByResource") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResource(ctx, resourceGroupName, name) + return +} + +// Put updates the specified private endpoint connection associated with the managed hsm pool. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// name - name of the managed HSM Pool +// privateEndpointConnectionName - name of the private endpoint connection associated with the managed hsm +// pool. +// properties - the intended state of private endpoint connection. +func (client MHSMPrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, properties MHSMPrivateEndpointConnection) (result MHSMPrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MHSMPrivateEndpointConnectionsClient.Put") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PutPreparer(ctx, resourceGroupName, name, privateEndpointConnectionName, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsClient", "Put", resp, "Failure responding to request") + return + } + + return +} + +// PutPreparer prepares the Put request. +func (client MHSMPrivateEndpointConnectionsClient) PutPreparer(ctx context.Context, resourceGroupName string, name string, privateEndpointConnectionName string, properties MHSMPrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client MHSMPrivateEndpointConnectionsClient) PutSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client MHSMPrivateEndpointConnectionsClient) PutResponder(resp *http.Response) (result MHSMPrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/mhsmprivatelinkresources.go b/services/keyvault/mgmt/2021-10-01/keyvault/mhsmprivatelinkresources.go new file mode 100644 index 000000000000..a69067058fd5 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/mhsmprivatelinkresources.go @@ -0,0 +1,109 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MHSMPrivateLinkResourcesClient is the the Azure management API provides a RESTful set of web services that interact +// with Azure Key Vault. +type MHSMPrivateLinkResourcesClient struct { + BaseClient +} + +// NewMHSMPrivateLinkResourcesClient creates an instance of the MHSMPrivateLinkResourcesClient client. +func NewMHSMPrivateLinkResourcesClient(subscriptionID string) MHSMPrivateLinkResourcesClient { + return NewMHSMPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMHSMPrivateLinkResourcesClientWithBaseURI creates an instance of the MHSMPrivateLinkResourcesClient client using +// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewMHSMPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) MHSMPrivateLinkResourcesClient { + return MHSMPrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByMHSMResource gets the private link resources supported for the managed hsm pool. +// Parameters: +// resourceGroupName - name of the resource group that contains the managed HSM pool. +// name - name of the managed HSM Pool +func (client MHSMPrivateLinkResourcesClient) ListByMHSMResource(ctx context.Context, resourceGroupName string, name string) (result MHSMPrivateLinkResourceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MHSMPrivateLinkResourcesClient.ListByMHSMResource") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByMHSMResourcePreparer(ctx, resourceGroupName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateLinkResourcesClient", "ListByMHSMResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByMHSMResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateLinkResourcesClient", "ListByMHSMResource", resp, "Failure sending request") + return + } + + result, err = client.ListByMHSMResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateLinkResourcesClient", "ListByMHSMResource", resp, "Failure responding to request") + return + } + + return +} + +// ListByMHSMResourcePreparer prepares the ListByMHSMResource request. +func (client MHSMPrivateLinkResourcesClient) ListByMHSMResourcePreparer(ctx context.Context, resourceGroupName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByMHSMResourceSender sends the ListByMHSMResource request. The method will close the +// http.Response Body if it receives an error. +func (client MHSMPrivateLinkResourcesClient) ListByMHSMResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByMHSMResourceResponder handles the response to the ListByMHSMResource request. The method always +// closes the http.Response Body. +func (client MHSMPrivateLinkResourcesClient) ListByMHSMResourceResponder(resp *http.Response) (result MHSMPrivateLinkResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/models.go b/services/keyvault/mgmt/2021-10-01/keyvault/models.go new file mode 100644 index 000000000000..5264a7d25376 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/models.go @@ -0,0 +1,3807 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2021-10-01/keyvault" + +// AccessPolicyEntry an identity that have access to the key vault. All identities in the array must use +// the same tenant ID as the key vault's tenant ID. +type AccessPolicyEntry struct { + // TenantID - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // ObjectID - The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies. + ObjectID *string `json:"objectId,omitempty"` + // ApplicationID - Application ID of the client making request on behalf of a principal + ApplicationID *uuid.UUID `json:"applicationId,omitempty"` + // Permissions - Permissions the identity has for keys, secrets and certificates. + Permissions *Permissions `json:"permissions,omitempty"` +} + +// Attributes the object attributes managed by the KeyVault service. +type Attributes struct { + // Enabled - Determines whether the object is enabled. + Enabled *bool `json:"enabled,omitempty"` + // NotBefore - Not before date in seconds since 1970-01-01T00:00:00Z. + NotBefore *date.UnixTime `json:"nbf,omitempty"` + // Expires - Expiry date in seconds since 1970-01-01T00:00:00Z. + Expires *date.UnixTime `json:"exp,omitempty"` + // Created - READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. + Created *date.UnixTime `json:"created,omitempty"` + // Updated - READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// MarshalJSON is the custom marshaler for Attributes. +func (a Attributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.Enabled != nil { + objectMap["enabled"] = a.Enabled + } + if a.NotBefore != nil { + objectMap["nbf"] = a.NotBefore + } + if a.Expires != nil { + objectMap["exp"] = a.Expires + } + return json.Marshal(objectMap) +} + +// CheckNameAvailabilityResult the CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + autorest.Response `json:"-"` + // NameAvailable - READ-ONLY; A boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - READ-ONLY; The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', 'AlreadyExists' + Reason Reason `json:"reason,omitempty"` + // Message - READ-ONLY; An error message explaining the Reason value in more detail. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for CheckNameAvailabilityResult. +func (cnar CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CloudError an error response from Key Vault resource provider +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from Key Vault resource provider +type CloudErrorBody struct { + // Code - Error code. This is a mnemonic that can be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - User friendly error message. The message is typically localized and may vary with service version. + Message *string `json:"message,omitempty"` +} + +// DeletedManagedHsm ... +type DeletedManagedHsm struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The Azure Resource Manager resource ID for the deleted managed HSM Pool. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the managed HSM Pool. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type of the managed HSM Pool. + Type *string `json:"type,omitempty"` + // Properties - Properties of the deleted managed HSM + Properties *DeletedManagedHsmProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedManagedHsm. +func (dmh DeletedManagedHsm) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dmh.Properties != nil { + objectMap["properties"] = dmh.Properties + } + return json.Marshal(objectMap) +} + +// DeletedManagedHsmListResult list of deleted managed HSM Pools +type DeletedManagedHsmListResult struct { + autorest.Response `json:"-"` + // Value - The list of deleted managed HSM Pools. + Value *[]DeletedManagedHsm `json:"value,omitempty"` + // NextLink - The URL to get the next set of deleted managed HSM Pools. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeletedManagedHsmListResultIterator provides access to a complete listing of DeletedManagedHsm values. +type DeletedManagedHsmListResultIterator struct { + i int + page DeletedManagedHsmListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedManagedHsmListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedManagedHsmListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeletedManagedHsmListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedManagedHsmListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedManagedHsmListResultIterator) Response() DeletedManagedHsmListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedManagedHsmListResultIterator) Value() DeletedManagedHsm { + if !iter.page.NotDone() { + return DeletedManagedHsm{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeletedManagedHsmListResultIterator type. +func NewDeletedManagedHsmListResultIterator(page DeletedManagedHsmListResultPage) DeletedManagedHsmListResultIterator { + return DeletedManagedHsmListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dmhlr DeletedManagedHsmListResult) IsEmpty() bool { + return dmhlr.Value == nil || len(*dmhlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dmhlr DeletedManagedHsmListResult) hasNextLink() bool { + return dmhlr.NextLink != nil && len(*dmhlr.NextLink) != 0 +} + +// deletedManagedHsmListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dmhlr DeletedManagedHsmListResult) deletedManagedHsmListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dmhlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dmhlr.NextLink))) +} + +// DeletedManagedHsmListResultPage contains a page of DeletedManagedHsm values. +type DeletedManagedHsmListResultPage struct { + fn func(context.Context, DeletedManagedHsmListResult) (DeletedManagedHsmListResult, error) + dmhlr DeletedManagedHsmListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedManagedHsmListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedManagedHsmListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dmhlr) + if err != nil { + return err + } + page.dmhlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeletedManagedHsmListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedManagedHsmListResultPage) NotDone() bool { + return !page.dmhlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedManagedHsmListResultPage) Response() DeletedManagedHsmListResult { + return page.dmhlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedManagedHsmListResultPage) Values() []DeletedManagedHsm { + if page.dmhlr.IsEmpty() { + return nil + } + return *page.dmhlr.Value +} + +// Creates a new instance of the DeletedManagedHsmListResultPage type. +func NewDeletedManagedHsmListResultPage(cur DeletedManagedHsmListResult, getNextPage func(context.Context, DeletedManagedHsmListResult) (DeletedManagedHsmListResult, error)) DeletedManagedHsmListResultPage { + return DeletedManagedHsmListResultPage{ + fn: getNextPage, + dmhlr: cur, + } +} + +// DeletedManagedHsmProperties properties of the deleted managed HSM. +type DeletedManagedHsmProperties struct { + // MhsmID - READ-ONLY; The resource id of the original managed HSM. + MhsmID *string `json:"mhsmId,omitempty"` + // Location - READ-ONLY; The location of the original managed HSM. + Location *string `json:"location,omitempty"` + // DeletionDate - READ-ONLY; The deleted date. + DeletionDate *date.Time `json:"deletionDate,omitempty"` + // ScheduledPurgeDate - READ-ONLY; The scheduled purged date. + ScheduledPurgeDate *date.Time `json:"scheduledPurgeDate,omitempty"` + // PurgeProtectionEnabled - READ-ONLY; Purge protection status of the original managed HSM. + PurgeProtectionEnabled *bool `json:"purgeProtectionEnabled,omitempty"` + // Tags - READ-ONLY; Tags of the original managed HSM. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DeletedManagedHsmProperties. +func (dmhp DeletedManagedHsmProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeletedVault deleted vault information with extended details. +type DeletedVault struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The resource ID for the deleted key vault. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the key vault. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type of the key vault. + Type *string `json:"type,omitempty"` + // Properties - Properties of the vault + Properties *DeletedVaultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedVault. +func (dv DeletedVault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dv.Properties != nil { + objectMap["properties"] = dv.Properties + } + return json.Marshal(objectMap) +} + +// DeletedVaultListResult list of vaults +type DeletedVaultListResult struct { + autorest.Response `json:"-"` + // Value - The list of deleted vaults. + Value *[]DeletedVault `json:"value,omitempty"` + // NextLink - The URL to get the next set of deleted vaults. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeletedVaultListResultIterator provides access to a complete listing of DeletedVault values. +type DeletedVaultListResultIterator struct { + i int + page DeletedVaultListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeletedVaultListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedVaultListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeletedVaultListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeletedVaultListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeletedVaultListResultIterator) Response() DeletedVaultListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeletedVaultListResultIterator) Value() DeletedVault { + if !iter.page.NotDone() { + return DeletedVault{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeletedVaultListResultIterator type. +func NewDeletedVaultListResultIterator(page DeletedVaultListResultPage) DeletedVaultListResultIterator { + return DeletedVaultListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dvlr DeletedVaultListResult) IsEmpty() bool { + return dvlr.Value == nil || len(*dvlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dvlr DeletedVaultListResult) hasNextLink() bool { + return dvlr.NextLink != nil && len(*dvlr.NextLink) != 0 +} + +// deletedVaultListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dvlr DeletedVaultListResult) deletedVaultListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dvlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dvlr.NextLink))) +} + +// DeletedVaultListResultPage contains a page of DeletedVault values. +type DeletedVaultListResultPage struct { + fn func(context.Context, DeletedVaultListResult) (DeletedVaultListResult, error) + dvlr DeletedVaultListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeletedVaultListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeletedVaultListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dvlr) + if err != nil { + return err + } + page.dvlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeletedVaultListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeletedVaultListResultPage) NotDone() bool { + return !page.dvlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeletedVaultListResultPage) Response() DeletedVaultListResult { + return page.dvlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeletedVaultListResultPage) Values() []DeletedVault { + if page.dvlr.IsEmpty() { + return nil + } + return *page.dvlr.Value +} + +// Creates a new instance of the DeletedVaultListResultPage type. +func NewDeletedVaultListResultPage(cur DeletedVaultListResult, getNextPage func(context.Context, DeletedVaultListResult) (DeletedVaultListResult, error)) DeletedVaultListResultPage { + return DeletedVaultListResultPage{ + fn: getNextPage, + dvlr: cur, + } +} + +// DeletedVaultProperties properties of the deleted vault. +type DeletedVaultProperties struct { + // VaultID - READ-ONLY; The resource id of the original vault. + VaultID *string `json:"vaultId,omitempty"` + // Location - READ-ONLY; The location of the original vault. + Location *string `json:"location,omitempty"` + // DeletionDate - READ-ONLY; The deleted date. + DeletionDate *date.Time `json:"deletionDate,omitempty"` + // ScheduledPurgeDate - READ-ONLY; The scheduled purged date. + ScheduledPurgeDate *date.Time `json:"scheduledPurgeDate,omitempty"` + // Tags - READ-ONLY; Tags of the original vault. + Tags map[string]*string `json:"tags"` + // PurgeProtectionEnabled - READ-ONLY; Purge protection status of the original vault. + PurgeProtectionEnabled *bool `json:"purgeProtectionEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedVaultProperties. +func (dvp DeletedVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DimensionProperties type of operation: get, read, delete, etc. +type DimensionProperties struct { + // Name - Name of dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - Property to specify whether the dimension should be exported for Shoebox. + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + +// Error the server error. +type Error struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // InnerError - READ-ONLY; The inner error, contains a more specific error code. + InnerError *Error `json:"innererror,omitempty"` +} + +// MarshalJSON is the custom marshaler for Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IPRule a rule governing the accessibility of a vault from a specific ip address or ip range. +type IPRule struct { + // Value - An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + Value *string `json:"value,omitempty"` +} + +// Key the key resource. +type Key struct { + autorest.Response `json:"-"` + // KeyProperties - The properties of the key. + *KeyProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the key vault resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the key vault resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of the key vault resource. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Azure location of the key vault resource. + Location *string `json:"location,omitempty"` + // Tags - READ-ONLY; Tags assigned to the key vault resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Key. +func (kVar Key) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kVar.KeyProperties != nil { + objectMap["properties"] = kVar.KeyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Key struct. +func (kVar *Key) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var keyProperties KeyProperties + err = json.Unmarshal(*v, &keyProperties) + if err != nil { + return err + } + kVar.KeyProperties = &keyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + kVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + kVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + kVar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + kVar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + kVar.Tags = tags + } + } + } + + return nil +} + +// KeyAttributes the object attributes managed by the Azure Key Vault service. +type KeyAttributes struct { + // Enabled - Determines whether or not the object is enabled. + Enabled *bool `json:"enabled,omitempty"` + // NotBefore - Not before date in seconds since 1970-01-01T00:00:00Z. + NotBefore *int64 `json:"nbf,omitempty"` + // Expires - Expiry date in seconds since 1970-01-01T00:00:00Z. + Expires *int64 `json:"exp,omitempty"` + // Created - READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. + Created *int64 `json:"created,omitempty"` + // Updated - READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. + Updated *int64 `json:"updated,omitempty"` + // RecoveryLevel - READ-ONLY; The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. Possible values include: 'Purgeable', 'RecoverablePurgeable', 'Recoverable', 'RecoverableProtectedSubscription' + RecoveryLevel DeletionRecoveryLevel `json:"recoveryLevel,omitempty"` + // Exportable - Indicates if the private key can be exported. + Exportable *bool `json:"exportable,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyAttributes. +func (ka KeyAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ka.Enabled != nil { + objectMap["enabled"] = ka.Enabled + } + if ka.NotBefore != nil { + objectMap["nbf"] = ka.NotBefore + } + if ka.Expires != nil { + objectMap["exp"] = ka.Expires + } + if ka.Exportable != nil { + objectMap["exportable"] = ka.Exportable + } + return json.Marshal(objectMap) +} + +// KeyCreateParameters the parameters used to create a key. +type KeyCreateParameters struct { + // Tags - The tags that will be assigned to the key. + Tags map[string]*string `json:"tags"` + // Properties - The properties of the key to be created. + Properties *KeyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyCreateParameters. +func (kcp KeyCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kcp.Tags != nil { + objectMap["tags"] = kcp.Tags + } + if kcp.Properties != nil { + objectMap["properties"] = kcp.Properties + } + return json.Marshal(objectMap) +} + +// KeyListResult the page of keys. +type KeyListResult struct { + autorest.Response `json:"-"` + // Value - The key resources. + Value *[]Key `json:"value,omitempty"` + // NextLink - The URL to get the next page of keys. + NextLink *string `json:"nextLink,omitempty"` +} + +// KeyListResultIterator provides access to a complete listing of Key values. +type KeyListResultIterator struct { + i int + page KeyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *KeyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KeyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *KeyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter KeyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter KeyListResultIterator) Response() KeyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter KeyListResultIterator) Value() Key { + if !iter.page.NotDone() { + return Key{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the KeyListResultIterator type. +func NewKeyListResultIterator(page KeyListResultPage) KeyListResultIterator { + return KeyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (klr KeyListResult) IsEmpty() bool { + return klr.Value == nil || len(*klr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (klr KeyListResult) hasNextLink() bool { + return klr.NextLink != nil && len(*klr.NextLink) != 0 +} + +// keyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (klr KeyListResult) keyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !klr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(klr.NextLink))) +} + +// KeyListResultPage contains a page of Key values. +type KeyListResultPage struct { + fn func(context.Context, KeyListResult) (KeyListResult, error) + klr KeyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *KeyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/KeyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.klr) + if err != nil { + return err + } + page.klr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *KeyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page KeyListResultPage) NotDone() bool { + return !page.klr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page KeyListResultPage) Response() KeyListResult { + return page.klr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page KeyListResultPage) Values() []Key { + if page.klr.IsEmpty() { + return nil + } + return *page.klr.Value +} + +// Creates a new instance of the KeyListResultPage type. +func NewKeyListResultPage(cur KeyListResult, getNextPage func(context.Context, KeyListResult) (KeyListResult, error)) KeyListResultPage { + return KeyListResultPage{ + fn: getNextPage, + klr: cur, + } +} + +// KeyProperties the properties of the key. +type KeyProperties struct { + // Attributes - The attributes of the key. + Attributes *KeyAttributes `json:"attributes,omitempty"` + // Kty - The type of the key. For valid values, see JsonWebKeyType. Possible values include: 'EC', 'ECHSM', 'RSA', 'RSAHSM' + Kty JSONWebKeyType `json:"kty,omitempty"` + KeyOps *[]JSONWebKeyOperation `json:"keyOps,omitempty"` + // KeySize - The key size in bits. For example: 2048, 3072, or 4096 for RSA. + KeySize *int32 `json:"keySize,omitempty"` + // CurveName - The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: 'P256', 'P384', 'P521', 'P256K' + CurveName JSONWebKeyCurveName `json:"curveName,omitempty"` + // KeyURI - READ-ONLY; The URI to retrieve the current version of the key. + KeyURI *string `json:"keyUri,omitempty"` + // KeyURIWithVersion - READ-ONLY; The URI to retrieve the specific version of the key. + KeyURIWithVersion *string `json:"keyUriWithVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyProperties. +func (kp KeyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kp.Attributes != nil { + objectMap["attributes"] = kp.Attributes + } + if kp.Kty != "" { + objectMap["kty"] = kp.Kty + } + if kp.KeyOps != nil { + objectMap["keyOps"] = kp.KeyOps + } + if kp.KeySize != nil { + objectMap["keySize"] = kp.KeySize + } + if kp.CurveName != "" { + objectMap["curveName"] = kp.CurveName + } + return json.Marshal(objectMap) +} + +// LogSpecification log specification of operation. +type LogSpecification struct { + // Name - Name of log specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of log specification. + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Blob duration of specification. + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// ManagedHsm resource information with extended details. +type ManagedHsm struct { + autorest.Response `json:"-"` + // Properties - Properties of the managed HSM + Properties *ManagedHsmProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the managed HSM Pool. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type of the managed HSM Pool. + Type *string `json:"type,omitempty"` + // Location - The supported Azure location where the managed HSM Pool should be created. + Location *string `json:"location,omitempty"` + // Sku - SKU details + Sku *ManagedHsmSku `json:"sku,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedHsm. +func (mh ManagedHsm) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mh.Properties != nil { + objectMap["properties"] = mh.Properties + } + if mh.Location != nil { + objectMap["location"] = mh.Location + } + if mh.Sku != nil { + objectMap["sku"] = mh.Sku + } + if mh.Tags != nil { + objectMap["tags"] = mh.Tags + } + if mh.SystemData != nil { + objectMap["systemData"] = mh.SystemData + } + return json.Marshal(objectMap) +} + +// ManagedHsmError the error exception. +type ManagedHsmError struct { + // Error - READ-ONLY; The server error. + Error *Error `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedHsmError. +func (mhe ManagedHsmError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedHsmListResult list of managed HSM Pools +type ManagedHsmListResult struct { + autorest.Response `json:"-"` + // Value - The list of managed HSM Pools. + Value *[]ManagedHsm `json:"value,omitempty"` + // NextLink - The URL to get the next set of managed HSM Pools. + NextLink *string `json:"nextLink,omitempty"` +} + +// ManagedHsmListResultIterator provides access to a complete listing of ManagedHsm values. +type ManagedHsmListResultIterator struct { + i int + page ManagedHsmListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedHsmListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedHsmListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedHsmListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedHsmListResultIterator) Response() ManagedHsmListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedHsmListResultIterator) Value() ManagedHsm { + if !iter.page.NotDone() { + return ManagedHsm{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedHsmListResultIterator type. +func NewManagedHsmListResultIterator(page ManagedHsmListResultPage) ManagedHsmListResultIterator { + return ManagedHsmListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mhlr ManagedHsmListResult) IsEmpty() bool { + return mhlr.Value == nil || len(*mhlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mhlr ManagedHsmListResult) hasNextLink() bool { + return mhlr.NextLink != nil && len(*mhlr.NextLink) != 0 +} + +// managedHsmListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mhlr ManagedHsmListResult) managedHsmListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mhlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mhlr.NextLink))) +} + +// ManagedHsmListResultPage contains a page of ManagedHsm values. +type ManagedHsmListResultPage struct { + fn func(context.Context, ManagedHsmListResult) (ManagedHsmListResult, error) + mhlr ManagedHsmListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedHsmListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedHsmListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mhlr) + if err != nil { + return err + } + page.mhlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedHsmListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedHsmListResultPage) NotDone() bool { + return !page.mhlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedHsmListResultPage) Response() ManagedHsmListResult { + return page.mhlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedHsmListResultPage) Values() []ManagedHsm { + if page.mhlr.IsEmpty() { + return nil + } + return *page.mhlr.Value +} + +// Creates a new instance of the ManagedHsmListResultPage type. +func NewManagedHsmListResultPage(cur ManagedHsmListResult, getNextPage func(context.Context, ManagedHsmListResult) (ManagedHsmListResult, error)) ManagedHsmListResultPage { + return ManagedHsmListResultPage{ + fn: getNextPage, + mhlr: cur, + } +} + +// ManagedHsmProperties properties of the managed HSM Pool +type ManagedHsmProperties struct { + // TenantID - The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // InitialAdminObjectIds - Array of initial administrators object ids for this managed hsm pool. + InitialAdminObjectIds *[]string `json:"initialAdminObjectIds,omitempty"` + // HsmURI - READ-ONLY; The URI of the managed hsm pool for performing operations on keys. + HsmURI *string `json:"hsmUri,omitempty"` + // EnableSoftDelete - Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. If it's not set to any value(true or false) when creating new managed HSM pool, it will be set to true by default. Once set to true, it cannot be reverted to false. + EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + // SoftDeleteRetentionInDays - softDelete data retention days. It accepts >=7 and <=90. + SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` + // EnablePurgeProtection - Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible. + EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + // CreateMode - The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. Possible values include: 'CreateModeRecover', 'CreateModeDefault' + CreateMode CreateMode `json:"createMode,omitempty"` + // StatusMessage - READ-ONLY; Resource Status Message. + StatusMessage *string `json:"statusMessage,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateProvisioning', 'ProvisioningStateFailed', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateActivated', 'ProvisioningStateSecurityDomainRestore', 'ProvisioningStateRestoring' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // NetworkAcls - Rules governing the accessibility of the key vault from specific network locations. + NetworkAcls *MHSMNetworkRuleSet `json:"networkAcls,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections associated with the managed hsm pool. + PrivateEndpointConnections *[]MHSMPrivateEndpointConnectionItem `json:"privateEndpointConnections,omitempty"` + // PublicNetworkAccess - Control permission for data plane traffic coming from public networks while private endpoint is enabled. Possible values include: 'Enabled', 'Disabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // ScheduledPurgeDate - READ-ONLY; The scheduled purge date in UTC. + ScheduledPurgeDate *date.Time `json:"scheduledPurgeDate,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedHsmProperties. +func (mhp ManagedHsmProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mhp.TenantID != nil { + objectMap["tenantId"] = mhp.TenantID + } + if mhp.InitialAdminObjectIds != nil { + objectMap["initialAdminObjectIds"] = mhp.InitialAdminObjectIds + } + if mhp.EnableSoftDelete != nil { + objectMap["enableSoftDelete"] = mhp.EnableSoftDelete + } + if mhp.SoftDeleteRetentionInDays != nil { + objectMap["softDeleteRetentionInDays"] = mhp.SoftDeleteRetentionInDays + } + if mhp.EnablePurgeProtection != nil { + objectMap["enablePurgeProtection"] = mhp.EnablePurgeProtection + } + if mhp.CreateMode != "" { + objectMap["createMode"] = mhp.CreateMode + } + if mhp.NetworkAcls != nil { + objectMap["networkAcls"] = mhp.NetworkAcls + } + if mhp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = mhp.PublicNetworkAccess + } + return json.Marshal(objectMap) +} + +// ManagedHsmResource managed HSM resource +type ManagedHsmResource struct { + // ID - READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the managed HSM Pool. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type of the managed HSM Pool. + Type *string `json:"type,omitempty"` + // Location - The supported Azure location where the managed HSM Pool should be created. + Location *string `json:"location,omitempty"` + // Sku - SKU details + Sku *ManagedHsmSku `json:"sku,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedHsmResource. +func (mhr ManagedHsmResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mhr.Location != nil { + objectMap["location"] = mhr.Location + } + if mhr.Sku != nil { + objectMap["sku"] = mhr.Sku + } + if mhr.Tags != nil { + objectMap["tags"] = mhr.Tags + } + if mhr.SystemData != nil { + objectMap["systemData"] = mhr.SystemData + } + return json.Marshal(objectMap) +} + +// ManagedHsmsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedHsmsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedHsmsClient) (ManagedHsm, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedHsmsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedHsmsCreateOrUpdateFuture.Result. +func (future *ManagedHsmsCreateOrUpdateFuture) result(client ManagedHsmsClient) (mh ManagedHsm, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("keyvault.ManagedHsmsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mh.Response.Response, err = future.GetResult(sender); err == nil && mh.Response.Response.StatusCode != http.StatusNoContent { + mh, err = client.CreateOrUpdateResponder(mh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsCreateOrUpdateFuture", "Result", mh.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedHsmsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedHsmsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedHsmsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedHsmsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedHsmsDeleteFuture.Result. +func (future *ManagedHsmsDeleteFuture) result(client ManagedHsmsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("keyvault.ManagedHsmsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedHsmSku SKU details +type ManagedHsmSku struct { + // Family - SKU Family of the managed HSM Pool + Family *string `json:"family,omitempty"` + // Name - SKU of the managed HSM Pool. Possible values include: 'StandardB1', 'CustomB32' + Name ManagedHsmSkuName `json:"name,omitempty"` +} + +// ManagedHsmsPurgeDeletedFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedHsmsPurgeDeletedFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedHsmsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedHsmsPurgeDeletedFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedHsmsPurgeDeletedFuture.Result. +func (future *ManagedHsmsPurgeDeletedFuture) result(client ManagedHsmsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsPurgeDeletedFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("keyvault.ManagedHsmsPurgeDeletedFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedHsmsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedHsmsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedHsmsClient) (ManagedHsm, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedHsmsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedHsmsUpdateFuture.Result. +func (future *ManagedHsmsUpdateFuture) result(client ManagedHsmsClient) (mh ManagedHsm, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("keyvault.ManagedHsmsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mh.Response.Response, err = future.GetResult(sender); err == nil && mh.Response.Response.StatusCode != http.StatusNoContent { + mh, err = client.UpdateResponder(mh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.ManagedHsmsUpdateFuture", "Result", mh.Response.Response, "Failure responding to request") + } + } + return +} + +// MetricSpecification metric specification of operation. +type MetricSpecification struct { + // Name - Name of metric specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of metric specification. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Display description of metric specification. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + Unit *string `json:"unit,omitempty"` + // AggregationType - The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. + AggregationType *string `json:"aggregationType,omitempty"` + // SupportedAggregationTypes - The supported aggregation types for the metrics. + SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` + // SupportedTimeGrainTypes - The supported time grain types for the metrics. + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // LockAggregationType - The metric lock aggregation type. + LockAggregationType *string `json:"lockAggregationType,omitempty"` + // Dimensions - The dimensions of metric + Dimensions *[]DimensionProperties `json:"dimensions,omitempty"` + // FillGapWithZero - Property to specify whether to fill gap with zero. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // InternalMetricName - The internal metric name. + InternalMetricName *string `json:"internalMetricName,omitempty"` +} + +// MHSMIPRule a rule governing the accessibility of a managed hsm pool from a specific ip address or ip +// range. +type MHSMIPRule struct { + // Value - An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + Value *string `json:"value,omitempty"` +} + +// MHSMNetworkRuleSet a set of rules governing the network accessibility of a managed hsm pool. +type MHSMNetworkRuleSet struct { + // Bypass - Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' + Bypass NetworkRuleBypassOptions `json:"bypass,omitempty"` + // DefaultAction - The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. Possible values include: 'Allow', 'Deny' + DefaultAction NetworkRuleAction `json:"defaultAction,omitempty"` + // IPRules - The list of IP address rules. + IPRules *[]MHSMIPRule `json:"ipRules,omitempty"` + // VirtualNetworkRules - The list of virtual network rules. + VirtualNetworkRules *[]MHSMVirtualNetworkRule `json:"virtualNetworkRules,omitempty"` +} + +// MHSMPrivateEndpoint private endpoint object properties. +type MHSMPrivateEndpoint struct { + // ID - READ-ONLY; Full identifier of the private endpoint resource. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for MHSMPrivateEndpoint. +func (mpe MHSMPrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// MHSMPrivateEndpointConnection private endpoint connection resource. +type MHSMPrivateEndpointConnection struct { + autorest.Response `json:"-"` + // MHSMPrivateEndpointConnectionProperties - Resource properties. + *MHSMPrivateEndpointConnectionProperties `json:"properties,omitempty"` + // Etag - Modified whenever there is a change in the state of private endpoint connection. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the managed HSM Pool. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type of the managed HSM Pool. + Type *string `json:"type,omitempty"` + // Location - The supported Azure location where the managed HSM Pool should be created. + Location *string `json:"location,omitempty"` + // Sku - SKU details + Sku *ManagedHsmSku `json:"sku,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MHSMPrivateEndpointConnection. +func (mpec MHSMPrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mpec.MHSMPrivateEndpointConnectionProperties != nil { + objectMap["properties"] = mpec.MHSMPrivateEndpointConnectionProperties + } + if mpec.Etag != nil { + objectMap["etag"] = mpec.Etag + } + if mpec.Location != nil { + objectMap["location"] = mpec.Location + } + if mpec.Sku != nil { + objectMap["sku"] = mpec.Sku + } + if mpec.Tags != nil { + objectMap["tags"] = mpec.Tags + } + if mpec.SystemData != nil { + objectMap["systemData"] = mpec.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MHSMPrivateEndpointConnection struct. +func (mpec *MHSMPrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mHSMPrivateEndpointConnectionProperties MHSMPrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &mHSMPrivateEndpointConnectionProperties) + if err != nil { + return err + } + mpec.MHSMPrivateEndpointConnectionProperties = &mHSMPrivateEndpointConnectionProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + mpec.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mpec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mpec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mpec.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mpec.Location = &location + } + case "sku": + if v != nil { + var sku ManagedHsmSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + mpec.Sku = &sku + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mpec.Tags = tags + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mpec.SystemData = &systemData + } + } + } + + return nil +} + +// MHSMPrivateEndpointConnectionItem private endpoint connection item. +type MHSMPrivateEndpointConnectionItem struct { + // MHSMPrivateEndpointConnectionProperties - Private endpoint connection properties. + *MHSMPrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for MHSMPrivateEndpointConnectionItem. +func (mpeci MHSMPrivateEndpointConnectionItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mpeci.MHSMPrivateEndpointConnectionProperties != nil { + objectMap["properties"] = mpeci.MHSMPrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MHSMPrivateEndpointConnectionItem struct. +func (mpeci *MHSMPrivateEndpointConnectionItem) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mHSMPrivateEndpointConnectionProperties MHSMPrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &mHSMPrivateEndpointConnectionProperties) + if err != nil { + return err + } + mpeci.MHSMPrivateEndpointConnectionProperties = &mHSMPrivateEndpointConnectionProperties + } + } + } + + return nil +} + +// MHSMPrivateEndpointConnectionProperties properties of the private endpoint connection resource. +type MHSMPrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Properties of the private endpoint object. + PrivateEndpoint *MHSMPrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Approval state of the private link connection. + PrivateLinkServiceConnectionState *MHSMPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - Provisioning state of the private endpoint connection. Possible values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} + +// MHSMPrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type MHSMPrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MHSMPrivateEndpointConnectionsClient) (MHSMPrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MHSMPrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for MHSMPrivateEndpointConnectionsDeleteFuture.Result. +func (future *MHSMPrivateEndpointConnectionsDeleteFuture) result(client MHSMPrivateEndpointConnectionsClient) (mpec MHSMPrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mpec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("keyvault.MHSMPrivateEndpointConnectionsDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mpec.Response.Response, err = future.GetResult(sender); err == nil && mpec.Response.Response.StatusCode != http.StatusNoContent { + mpec, err = client.DeleteResponder(mpec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.MHSMPrivateEndpointConnectionsDeleteFuture", "Result", mpec.Response.Response, "Failure responding to request") + } + } + return +} + +// MHSMPrivateEndpointConnectionsListResult list of private endpoint connections associated with a managed +// HSM Pools +type MHSMPrivateEndpointConnectionsListResult struct { + autorest.Response `json:"-"` + // Value - The private endpoint connection associated with a managed HSM Pools. + Value *[]MHSMPrivateEndpointConnection `json:"value,omitempty"` + // NextLink - The URL to get the next set of managed HSM Pools. + NextLink *string `json:"nextLink,omitempty"` +} + +// MHSMPrivateEndpointConnectionsListResultIterator provides access to a complete listing of +// MHSMPrivateEndpointConnection values. +type MHSMPrivateEndpointConnectionsListResultIterator struct { + i int + page MHSMPrivateEndpointConnectionsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MHSMPrivateEndpointConnectionsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MHSMPrivateEndpointConnectionsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MHSMPrivateEndpointConnectionsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MHSMPrivateEndpointConnectionsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MHSMPrivateEndpointConnectionsListResultIterator) Response() MHSMPrivateEndpointConnectionsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MHSMPrivateEndpointConnectionsListResultIterator) Value() MHSMPrivateEndpointConnection { + if !iter.page.NotDone() { + return MHSMPrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MHSMPrivateEndpointConnectionsListResultIterator type. +func NewMHSMPrivateEndpointConnectionsListResultIterator(page MHSMPrivateEndpointConnectionsListResultPage) MHSMPrivateEndpointConnectionsListResultIterator { + return MHSMPrivateEndpointConnectionsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mpeclr MHSMPrivateEndpointConnectionsListResult) IsEmpty() bool { + return mpeclr.Value == nil || len(*mpeclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mpeclr MHSMPrivateEndpointConnectionsListResult) hasNextLink() bool { + return mpeclr.NextLink != nil && len(*mpeclr.NextLink) != 0 +} + +// mHSMPrivateEndpointConnectionsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mpeclr MHSMPrivateEndpointConnectionsListResult) mHSMPrivateEndpointConnectionsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mpeclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mpeclr.NextLink))) +} + +// MHSMPrivateEndpointConnectionsListResultPage contains a page of MHSMPrivateEndpointConnection values. +type MHSMPrivateEndpointConnectionsListResultPage struct { + fn func(context.Context, MHSMPrivateEndpointConnectionsListResult) (MHSMPrivateEndpointConnectionsListResult, error) + mpeclr MHSMPrivateEndpointConnectionsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MHSMPrivateEndpointConnectionsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MHSMPrivateEndpointConnectionsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mpeclr) + if err != nil { + return err + } + page.mpeclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MHSMPrivateEndpointConnectionsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MHSMPrivateEndpointConnectionsListResultPage) NotDone() bool { + return !page.mpeclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MHSMPrivateEndpointConnectionsListResultPage) Response() MHSMPrivateEndpointConnectionsListResult { + return page.mpeclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MHSMPrivateEndpointConnectionsListResultPage) Values() []MHSMPrivateEndpointConnection { + if page.mpeclr.IsEmpty() { + return nil + } + return *page.mpeclr.Value +} + +// Creates a new instance of the MHSMPrivateEndpointConnectionsListResultPage type. +func NewMHSMPrivateEndpointConnectionsListResultPage(cur MHSMPrivateEndpointConnectionsListResult, getNextPage func(context.Context, MHSMPrivateEndpointConnectionsListResult) (MHSMPrivateEndpointConnectionsListResult, error)) MHSMPrivateEndpointConnectionsListResultPage { + return MHSMPrivateEndpointConnectionsListResultPage{ + fn: getNextPage, + mpeclr: cur, + } +} + +// MHSMPrivateLinkResource a private link resource +type MHSMPrivateLinkResource struct { + // MHSMPrivateLinkResourceProperties - Resource properties. + *MHSMPrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The Azure Resource Manager resource ID for the managed HSM Pool. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the managed HSM Pool. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type of the managed HSM Pool. + Type *string `json:"type,omitempty"` + // Location - The supported Azure location where the managed HSM Pool should be created. + Location *string `json:"location,omitempty"` + // Sku - SKU details + Sku *ManagedHsmSku `json:"sku,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MHSMPrivateLinkResource. +func (mplr MHSMPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mplr.MHSMPrivateLinkResourceProperties != nil { + objectMap["properties"] = mplr.MHSMPrivateLinkResourceProperties + } + if mplr.Location != nil { + objectMap["location"] = mplr.Location + } + if mplr.Sku != nil { + objectMap["sku"] = mplr.Sku + } + if mplr.Tags != nil { + objectMap["tags"] = mplr.Tags + } + if mplr.SystemData != nil { + objectMap["systemData"] = mplr.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MHSMPrivateLinkResource struct. +func (mplr *MHSMPrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mHSMPrivateLinkResourceProperties MHSMPrivateLinkResourceProperties + err = json.Unmarshal(*v, &mHSMPrivateLinkResourceProperties) + if err != nil { + return err + } + mplr.MHSMPrivateLinkResourceProperties = &mHSMPrivateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mplr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mplr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mplr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mplr.Location = &location + } + case "sku": + if v != nil { + var sku ManagedHsmSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + mplr.Sku = &sku + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mplr.Tags = tags + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mplr.SystemData = &systemData + } + } + } + + return nil +} + +// MHSMPrivateLinkResourceListResult a list of private link resources +type MHSMPrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - Array of private link resources + Value *[]MHSMPrivateLinkResource `json:"value,omitempty"` +} + +// MHSMPrivateLinkResourceProperties properties of a private link resource. +type MHSMPrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; Group identifier of private link resource. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; Required member names of private link resource. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - Required DNS zone names of the the private link resource. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for MHSMPrivateLinkResourceProperties. +func (mplrp MHSMPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mplrp.RequiredZoneNames != nil { + objectMap["requiredZoneNames"] = mplrp.RequiredZoneNames + } + return json.Marshal(objectMap) +} + +// MHSMPrivateLinkServiceConnectionState an object that represents the approval state of the private link +// connection. +type MHSMPrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been approved, rejected or removed by the key vault owner. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected', 'PrivateEndpointServiceConnectionStatusDisconnected' + Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` + // Description - The reason for approval or rejection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. Possible values include: 'None' + ActionsRequired ActionsRequired `json:"actionsRequired,omitempty"` +} + +// MHSMVirtualNetworkRule a rule governing the accessibility of a managed hsm pool from a specific virtual +// network. +type MHSMVirtualNetworkRule struct { + // ID - Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + ID *string `json:"id,omitempty"` +} + +// NetworkRuleSet a set of rules governing the network accessibility of a vault. +type NetworkRuleSet struct { + // Bypass - Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' + Bypass NetworkRuleBypassOptions `json:"bypass,omitempty"` + // DefaultAction - The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. Possible values include: 'Allow', 'Deny' + DefaultAction NetworkRuleAction `json:"defaultAction,omitempty"` + // IPRules - The list of IP address rules. + IPRules *[]IPRule `json:"ipRules,omitempty"` + // VirtualNetworkRules - The list of virtual network rules. + VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` +} + +// Operation key Vault REST API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - The origin of operations. + Origin *string `json:"origin,omitempty"` + // OperationProperties - Properties of operation, include metric specifications. + *OperationProperties `json:"properties,omitempty"` + // IsDataAction - Property to specify whether the action is a data action. + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Name != nil { + objectMap["name"] = o.Name + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.Origin != nil { + objectMap["origin"] = o.Origin + } + if o.OperationProperties != nil { + objectMap["properties"] = o.OperationProperties + } + if o.IsDataAction != nil { + objectMap["isDataAction"] = o.IsDataAction + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationProperties OperationProperties + err = json.Unmarshal(*v, &operationProperties) + if err != nil { + return err + } + o.OperationProperties = &operationProperties + } + case "isDataAction": + if v != nil { + var isDataAction bool + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + o.IsDataAction = &isDataAction + } + } + } + + return nil +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft Key Vault. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed etc. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of the request to list Storage operations. It contains a list of operations +// and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of Storage operations supported by the Storage resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - The URL to get the next set of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OperationProperties properties of operation, include metric specifications. +type OperationProperties struct { + // ServiceSpecification - One property of operation, include metric specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// Permissions permissions the identity has for keys, secrets, certificates and storage. +type Permissions struct { + // Keys - Permissions to keys + Keys *[]KeyPermissions `json:"keys,omitempty"` + // Secrets - Permissions to secrets + Secrets *[]SecretPermissions `json:"secrets,omitempty"` + // Certificates - Permissions to certificates + Certificates *[]CertificatePermissions `json:"certificates,omitempty"` + // Storage - Permissions to storage accounts + Storage *[]StoragePermissions `json:"storage,omitempty"` +} + +// PrivateEndpoint private endpoint object properties. +type PrivateEndpoint struct { + // ID - READ-ONLY; Full identifier of the private endpoint resource. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection private endpoint connection resource. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // Etag - Modified whenever there is a change in the state of private endpoint connection. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the key vault resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the key vault resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of the key vault resource. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Azure location of the key vault resource. + Location *string `json:"location,omitempty"` + // Tags - READ-ONLY; Tags assigned to the key vault resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + if pec.Etag != nil { + objectMap["etag"] = pec.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pec.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pec.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pec.Tags = tags + } + } + } + + return nil +} + +// PrivateEndpointConnectionItem private endpoint connection item. +type PrivateEndpointConnectionItem struct { + // ID - Id of private endpoint connection. + ID *string `json:"id,omitempty"` + // Etag - Modified whenever there is a change in the state of private endpoint connection. + Etag *string `json:"etag,omitempty"` + // PrivateEndpointConnectionProperties - Private endpoint connection properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionItem. +func (peci PrivateEndpointConnectionItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peci.ID != nil { + objectMap["id"] = peci.ID + } + if peci.Etag != nil { + objectMap["etag"] = peci.Etag + } + if peci.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = peci.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnectionItem struct. +func (peci *PrivateEndpointConnectionItem) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + peci.ID = &ID + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + peci.Etag = &etag + } + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + peci.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult list of private endpoint connections. +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The list of private endpoint connections. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - The URL to get the next set of private endpoint connections. + NextLink *string `json:"nextLink,omitempty"` +} + +// PrivateEndpointConnectionListResultIterator provides access to a complete listing of +// PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultIterator struct { + i int + page PrivateEndpointConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. +func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { + return PrivateEndpointConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { + return peclr.Value == nil || len(*peclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { + return peclr.NextLink != nil && len(*peclr.NextLink) != 0 +} + +// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !peclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(peclr.NextLink))) +} + +// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultPage struct { + fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) + peclr PrivateEndpointConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.peclr) + if err != nil { + return err + } + page.peclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionListResultPage) NotDone() bool { + return !page.peclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { + return page.peclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { + if page.peclr.IsEmpty() { + return nil + } + return *page.peclr.Value +} + +// Creates a new instance of the PrivateEndpointConnectionListResultPage type. +func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { + return PrivateEndpointConnectionListResultPage{ + fn: getNextPage, + peclr: cur, + } +} + +// PrivateEndpointConnectionProperties properties of the private endpoint connection resource. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Properties of the private endpoint object. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Approval state of the private link connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - Provisioning state of the private endpoint connection. Possible values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("keyvault.PrivateEndpointConnectionsDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.DeleteResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsDeleteFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + // PrivateLinkResourceProperties - Resource properties. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the key vault resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the key vault resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of the key vault resource. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Azure location of the key vault resource. + Location *string `json:"location,omitempty"` + // Tags - READ-ONLY; Tags assigned to the key vault resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + plr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + plr.Tags = tags + } + } + } + + return nil +} + +// PrivateLinkResourceListResult a list of private link resources +type PrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - Array of private link resources + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkResourceProperties properties of a private link resource. +type PrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; Group identifier of private link resource. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; Required member names of private link resource. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - Required DNS zone names of the the private link resource. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResourceProperties. +func (plrp PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plrp.RequiredZoneNames != nil { + objectMap["requiredZoneNames"] = plrp.RequiredZoneNames + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionState an object that represents the approval state of the private link +// connection. +type PrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been approved, rejected or removed by the key vault owner. Possible values include: 'PrivateEndpointServiceConnectionStatusPending', 'PrivateEndpointServiceConnectionStatusApproved', 'PrivateEndpointServiceConnectionStatusRejected', 'PrivateEndpointServiceConnectionStatusDisconnected' + Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` + // Description - The reason for approval or rejection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. Possible values include: 'None' + ActionsRequired ActionsRequired `json:"actionsRequired,omitempty"` +} + +// Resource key Vault resource +type Resource struct { + // ID - READ-ONLY; Fully qualified identifier of the key vault resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the key vault resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of the key vault resource. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Azure location of the key vault resource. + Location *string `json:"location,omitempty"` + // Tags - READ-ONLY; Tags assigned to the key vault resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceListResult list of vault resources. +type ResourceListResult struct { + autorest.Response `json:"-"` + // Value - The list of vault resources. + Value *[]Resource `json:"value,omitempty"` + // NextLink - The URL to get the next set of vault resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceListResultIterator provides access to a complete listing of Resource values. +type ResourceListResultIterator struct { + i int + page ResourceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceListResultIterator) Response() ResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceListResultIterator) Value() Resource { + if !iter.page.NotDone() { + return Resource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceListResultIterator type. +func NewResourceListResultIterator(page ResourceListResultPage) ResourceListResultIterator { + return ResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr ResourceListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr ResourceListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// resourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr ResourceListResult) resourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// ResourceListResultPage contains a page of Resource values. +type ResourceListResultPage struct { + fn func(context.Context, ResourceListResult) (ResourceListResult, error) + rlr ResourceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rlr) + if err != nil { + return err + } + page.rlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceListResultPage) Response() ResourceListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceListResultPage) Values() []Resource { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the ResourceListResultPage type. +func NewResourceListResultPage(cur ResourceListResult, getNextPage func(context.Context, ResourceListResult) (ResourceListResult, error)) ResourceListResultPage { + return ResourceListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// Secret resource information with extended details. +type Secret struct { + autorest.Response `json:"-"` + // Properties - Properties of the secret + Properties *SecretProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the key vault resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the key vault resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of the key vault resource. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; Azure location of the key vault resource. + Location *string `json:"location,omitempty"` + // Tags - READ-ONLY; Tags assigned to the key vault resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Secret. +func (s Secret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.Properties != nil { + objectMap["properties"] = s.Properties + } + return json.Marshal(objectMap) +} + +// SecretAttributes the secret management attributes. +type SecretAttributes struct { + // Enabled - Determines whether the object is enabled. + Enabled *bool `json:"enabled,omitempty"` + // NotBefore - Not before date in seconds since 1970-01-01T00:00:00Z. + NotBefore *date.UnixTime `json:"nbf,omitempty"` + // Expires - Expiry date in seconds since 1970-01-01T00:00:00Z. + Expires *date.UnixTime `json:"exp,omitempty"` + // Created - READ-ONLY; Creation time in seconds since 1970-01-01T00:00:00Z. + Created *date.UnixTime `json:"created,omitempty"` + // Updated - READ-ONLY; Last updated time in seconds since 1970-01-01T00:00:00Z. + Updated *date.UnixTime `json:"updated,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretAttributes. +func (sa SecretAttributes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sa.Enabled != nil { + objectMap["enabled"] = sa.Enabled + } + if sa.NotBefore != nil { + objectMap["nbf"] = sa.NotBefore + } + if sa.Expires != nil { + objectMap["exp"] = sa.Expires + } + return json.Marshal(objectMap) +} + +// SecretCreateOrUpdateParameters parameters for creating or updating a secret +type SecretCreateOrUpdateParameters struct { + // Tags - The tags that will be assigned to the secret. + Tags map[string]*string `json:"tags"` + // Properties - Properties of the secret + Properties *SecretProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretCreateOrUpdateParameters. +func (scoup SecretCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scoup.Tags != nil { + objectMap["tags"] = scoup.Tags + } + if scoup.Properties != nil { + objectMap["properties"] = scoup.Properties + } + return json.Marshal(objectMap) +} + +// SecretListResult list of secrets +type SecretListResult struct { + autorest.Response `json:"-"` + // Value - The list of secrets. + Value *[]Secret `json:"value,omitempty"` + // NextLink - The URL to get the next set of secrets. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecretListResultIterator provides access to a complete listing of Secret values. +type SecretListResultIterator struct { + i int + page SecretListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecretListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecretListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecretListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecretListResultIterator) Response() SecretListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecretListResultIterator) Value() Secret { + if !iter.page.NotDone() { + return Secret{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecretListResultIterator type. +func NewSecretListResultIterator(page SecretListResultPage) SecretListResultIterator { + return SecretListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SecretListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SecretListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// secretListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SecretListResult) secretListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SecretListResultPage contains a page of Secret values. +type SecretListResultPage struct { + fn func(context.Context, SecretListResult) (SecretListResult, error) + slr SecretListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecretListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecretListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecretListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecretListResultPage) Response() SecretListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecretListResultPage) Values() []Secret { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SecretListResultPage type. +func NewSecretListResultPage(cur SecretListResult, getNextPage func(context.Context, SecretListResult) (SecretListResult, error)) SecretListResultPage { + return SecretListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// SecretPatchParameters parameters for patching a secret +type SecretPatchParameters struct { + // Tags - The tags that will be assigned to the secret. + Tags map[string]*string `json:"tags"` + // Properties - Properties of the secret + Properties *SecretPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretPatchParameters. +func (spp SecretPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spp.Tags != nil { + objectMap["tags"] = spp.Tags + } + if spp.Properties != nil { + objectMap["properties"] = spp.Properties + } + return json.Marshal(objectMap) +} + +// SecretPatchProperties properties of the secret +type SecretPatchProperties struct { + // Value - The value of the secret. + Value *string `json:"value,omitempty"` + // ContentType - The content type of the secret. + ContentType *string `json:"contentType,omitempty"` + // Attributes - The attributes of the secret. + Attributes *SecretAttributes `json:"attributes,omitempty"` +} + +// SecretProperties properties of the secret +type SecretProperties struct { + // Value - The value of the secret. NOTE: 'value' will never be returned from the service, as APIs using this model are is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. + Value *string `json:"value,omitempty"` + // ContentType - The content type of the secret. + ContentType *string `json:"contentType,omitempty"` + // Attributes - The attributes of the secret. + Attributes *SecretAttributes `json:"attributes,omitempty"` + // SecretURI - READ-ONLY; The URI to retrieve the current version of the secret. + SecretURI *string `json:"secretUri,omitempty"` + // SecretURIWithVersion - READ-ONLY; The URI to retrieve the specific version of the secret. + SecretURIWithVersion *string `json:"secretUriWithVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretProperties. +func (sp SecretProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.Value != nil { + objectMap["value"] = sp.Value + } + if sp.ContentType != nil { + objectMap["contentType"] = sp.ContentType + } + if sp.Attributes != nil { + objectMap["attributes"] = sp.Attributes + } + return json.Marshal(objectMap) +} + +// ServiceSpecification one property of operation, include log specifications. +type ServiceSpecification struct { + // LogSpecifications - Log specifications of operation. + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Metric specifications of operation. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// Sku SKU details +type Sku struct { + // Family - SKU family name + Family *string `json:"family,omitempty"` + // Name - SKU name to specify whether the key vault is a standard vault or a premium vault. Possible values include: 'Standard', 'Premium' + Name SkuName `json:"name,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the key vault resource. +type SystemData struct { + // CreatedBy - The identity that created the key vault resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the key vault resource. Possible values include: 'IdentityTypeUser', 'IdentityTypeApplication', 'IdentityTypeManagedIdentity', 'IdentityTypeKey' + CreatedByType IdentityType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of the key vault resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the key vault resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the key vault resource. Possible values include: 'IdentityTypeUser', 'IdentityTypeApplication', 'IdentityTypeManagedIdentity', 'IdentityTypeKey' + LastModifiedByType IdentityType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of the key vault resource last modification (UTC). + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// Vault resource information with extended details. +type Vault struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Fully qualified identifier of the key vault resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the key vault resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type of the key vault resource. + Type *string `json:"type,omitempty"` + // Location - Azure location of the key vault resource. + Location *string `json:"location,omitempty"` + // Tags - Tags assigned to the key vault resource. + Tags map[string]*string `json:"tags"` + // SystemData - System metadata for the key vault. + SystemData *SystemData `json:"systemData,omitempty"` + // Properties - Properties of the vault + Properties *VaultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Vault. +func (vVar Vault) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vVar.Location != nil { + objectMap["location"] = vVar.Location + } + if vVar.Tags != nil { + objectMap["tags"] = vVar.Tags + } + if vVar.SystemData != nil { + objectMap["systemData"] = vVar.SystemData + } + if vVar.Properties != nil { + objectMap["properties"] = vVar.Properties + } + return json.Marshal(objectMap) +} + +// VaultAccessPolicyParameters parameters for updating the access policy in a vault +type VaultAccessPolicyParameters struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The resource id of the access policy. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name of the access policy. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource name of the access policy. + Type *string `json:"type,omitempty"` + // Location - READ-ONLY; The resource type of the access policy. + Location *string `json:"location,omitempty"` + // Properties - Properties of the access policy + Properties *VaultAccessPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VaultAccessPolicyParameters. +func (vapp VaultAccessPolicyParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vapp.Properties != nil { + objectMap["properties"] = vapp.Properties + } + return json.Marshal(objectMap) +} + +// VaultAccessPolicyProperties properties of the vault access policy +type VaultAccessPolicyProperties struct { + // AccessPolicies - An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` +} + +// VaultCheckNameAvailabilityParameters the parameters used to check the availability of the vault name. +type VaultCheckNameAvailabilityParameters struct { + // Name - The vault name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, Microsoft.KeyVault/vaults + Type *string `json:"type,omitempty"` +} + +// VaultCreateOrUpdateParameters parameters for creating or updating a vault +type VaultCreateOrUpdateParameters struct { + // Location - The supported Azure location where the key vault should be created. + Location *string `json:"location,omitempty"` + // Tags - The tags that will be assigned to the key vault. + Tags map[string]*string `json:"tags"` + // Properties - Properties of the vault + Properties *VaultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VaultCreateOrUpdateParameters. +func (vcoup VaultCreateOrUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcoup.Location != nil { + objectMap["location"] = vcoup.Location + } + if vcoup.Tags != nil { + objectMap["tags"] = vcoup.Tags + } + if vcoup.Properties != nil { + objectMap["properties"] = vcoup.Properties + } + return json.Marshal(objectMap) +} + +// VaultListResult list of vaults +type VaultListResult struct { + autorest.Response `json:"-"` + // Value - The list of vaults. + Value *[]Vault `json:"value,omitempty"` + // NextLink - The URL to get the next set of vaults. + NextLink *string `json:"nextLink,omitempty"` +} + +// VaultListResultIterator provides access to a complete listing of Vault values. +type VaultListResultIterator struct { + i int + page VaultListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VaultListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VaultListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VaultListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VaultListResultIterator) Response() VaultListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VaultListResultIterator) Value() Vault { + if !iter.page.NotDone() { + return Vault{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VaultListResultIterator type. +func NewVaultListResultIterator(page VaultListResultPage) VaultListResultIterator { + return VaultListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vlr VaultListResult) IsEmpty() bool { + return vlr.Value == nil || len(*vlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vlr VaultListResult) hasNextLink() bool { + return vlr.NextLink != nil && len(*vlr.NextLink) != 0 +} + +// vaultListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vlr VaultListResult) vaultListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vlr.NextLink))) +} + +// VaultListResultPage contains a page of Vault values. +type VaultListResultPage struct { + fn func(context.Context, VaultListResult) (VaultListResult, error) + vlr VaultListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VaultListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vlr) + if err != nil { + return err + } + page.vlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VaultListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VaultListResultPage) NotDone() bool { + return !page.vlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VaultListResultPage) Response() VaultListResult { + return page.vlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VaultListResultPage) Values() []Vault { + if page.vlr.IsEmpty() { + return nil + } + return *page.vlr.Value +} + +// Creates a new instance of the VaultListResultPage type. +func NewVaultListResultPage(cur VaultListResult, getNextPage func(context.Context, VaultListResult) (VaultListResult, error)) VaultListResultPage { + return VaultListResultPage{ + fn: getNextPage, + vlr: cur, + } +} + +// VaultPatchParameters parameters for creating or updating a vault +type VaultPatchParameters struct { + // Tags - The tags that will be assigned to the key vault. + Tags map[string]*string `json:"tags"` + // Properties - Properties of the vault + Properties *VaultPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for VaultPatchParameters. +func (vpp VaultPatchParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vpp.Tags != nil { + objectMap["tags"] = vpp.Tags + } + if vpp.Properties != nil { + objectMap["properties"] = vpp.Properties + } + return json.Marshal(objectMap) +} + +// VaultPatchProperties properties of the vault +type VaultPatchProperties struct { + // TenantID - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Sku - SKU details + Sku *Sku `json:"sku,omitempty"` + // AccessPolicies - An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` + // EnabledForDeployment - Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. + EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` + // EnabledForDiskEncryption - Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. + EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` + // EnabledForTemplateDeployment - Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. + EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` + // EnableSoftDelete - Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot be reverted to false. + EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the value of this property will not change. + EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` + // SoftDeleteRetentionInDays - softDelete data retention days. It accepts >=7 and <=90. + SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` + // CreateMode - The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: 'CreateModeRecover', 'CreateModeDefault' + CreateMode CreateMode `json:"createMode,omitempty"` + // EnablePurgeProtection - Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its value. + EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + // NetworkAcls - A collection of rules governing the accessibility of the vault from specific network locations. + NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` + // PublicNetworkAccess - Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules. + PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` +} + +// VaultProperties properties of the vault +type VaultProperties struct { + // TenantID - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Sku - SKU details + Sku *Sku `json:"sku,omitempty"` + // AccessPolicies - An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. When `createMode` is set to `recover`, access policies are not required. Otherwise, access policies are required. + AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` + // VaultURI - The URI of the vault for performing operations on keys and secrets. + VaultURI *string `json:"vaultUri,omitempty"` + // HsmPoolResourceID - READ-ONLY; The resource id of HSM Pool. + HsmPoolResourceID *string `json:"hsmPoolResourceId,omitempty"` + // EnabledForDeployment - Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. + EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` + // EnabledForDiskEncryption - Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. + EnabledForDiskEncryption *bool `json:"enabledForDiskEncryption,omitempty"` + // EnabledForTemplateDeployment - Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. + EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` + // EnableSoftDelete - Property to specify whether the 'soft delete' functionality is enabled for this key vault. If it's not set to any value(true or false) when creating new key vault, it will be set to true by default. Once set to true, it cannot be reverted to false. + EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` + // SoftDeleteRetentionInDays - softDelete data retention days. It accepts >=7 and <=90. + SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` + // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the vault is created with the default value of false. Note that management actions are always authorized with RBAC. + EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` + // CreateMode - The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: 'CreateModeRecover', 'CreateModeDefault' + CreateMode CreateMode `json:"createMode,omitempty"` + // EnablePurgeProtection - Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible - that is, the property does not accept false as its value. + EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` + // NetworkAcls - Rules governing the accessibility of the key vault from specific network locations. + NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` + // ProvisioningState - Provisioning state of the vault. Possible values include: 'VaultProvisioningStateSucceeded', 'VaultProvisioningStateRegisteringDNS' + ProvisioningState VaultProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections associated with the key vault. + PrivateEndpointConnections *[]PrivateEndpointConnectionItem `json:"privateEndpointConnections,omitempty"` + // PublicNetworkAccess - Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules. + PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for VaultProperties. +func (vp VaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vp.TenantID != nil { + objectMap["tenantId"] = vp.TenantID + } + if vp.Sku != nil { + objectMap["sku"] = vp.Sku + } + if vp.AccessPolicies != nil { + objectMap["accessPolicies"] = vp.AccessPolicies + } + if vp.VaultURI != nil { + objectMap["vaultUri"] = vp.VaultURI + } + if vp.EnabledForDeployment != nil { + objectMap["enabledForDeployment"] = vp.EnabledForDeployment + } + if vp.EnabledForDiskEncryption != nil { + objectMap["enabledForDiskEncryption"] = vp.EnabledForDiskEncryption + } + if vp.EnabledForTemplateDeployment != nil { + objectMap["enabledForTemplateDeployment"] = vp.EnabledForTemplateDeployment + } + if vp.EnableSoftDelete != nil { + objectMap["enableSoftDelete"] = vp.EnableSoftDelete + } + if vp.SoftDeleteRetentionInDays != nil { + objectMap["softDeleteRetentionInDays"] = vp.SoftDeleteRetentionInDays + } + if vp.EnableRbacAuthorization != nil { + objectMap["enableRbacAuthorization"] = vp.EnableRbacAuthorization + } + if vp.CreateMode != "" { + objectMap["createMode"] = vp.CreateMode + } + if vp.EnablePurgeProtection != nil { + objectMap["enablePurgeProtection"] = vp.EnablePurgeProtection + } + if vp.NetworkAcls != nil { + objectMap["networkAcls"] = vp.NetworkAcls + } + if vp.ProvisioningState != "" { + objectMap["provisioningState"] = vp.ProvisioningState + } + if vp.PublicNetworkAccess != nil { + objectMap["publicNetworkAccess"] = vp.PublicNetworkAccess + } + return json.Marshal(objectMap) +} + +// VaultsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VaultsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VaultsClient) (Vault, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VaultsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VaultsCreateOrUpdateFuture.Result. +func (future *VaultsCreateOrUpdateFuture) result(client VaultsClient) (vVar Vault, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vVar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("keyvault.VaultsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { + vVar, err = client.CreateOrUpdateResponder(vVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsCreateOrUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") + } + } + return +} + +// VaultsPurgeDeletedFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VaultsPurgeDeletedFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VaultsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VaultsPurgeDeletedFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VaultsPurgeDeletedFuture.Result. +func (future *VaultsPurgeDeletedFuture) result(client VaultsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsPurgeDeletedFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("keyvault.VaultsPurgeDeletedFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkRule a rule governing the accessibility of a vault from a specific virtual network. +type VirtualNetworkRule struct { + // ID - Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + ID *string `json:"id,omitempty"` + // IgnoreMissingVnetServiceEndpoint - Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/operations.go b/services/keyvault/mgmt/2021-10-01/keyvault/operations.go new file mode 100644 index 000000000000..935861631814 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/operations.go @@ -0,0 +1,141 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Azure management API provides a RESTful set of web services that interact with Azure Key +// Vault. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Key Vault Rest API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KeyVault/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/privateendpointconnections.go b/services/keyvault/mgmt/2021-10-01/keyvault/privateendpointconnections.go new file mode 100644 index 000000000000..37a334b36936 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/privateendpointconnections.go @@ -0,0 +1,416 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the the Azure management API provides a RESTful set of web services that +// interact with Azure Key Vault. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete deletes the specified private endpoint connection associated with the key vault. +// Parameters: +// resourceGroupName - name of the resource group that contains the key vault. +// vaultName - the name of the key vault. +// privateEndpointConnectionName - name of the private endpoint connection associated with the key vault. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, vaultName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the specified private endpoint connection associated with the key vault. +// Parameters: +// resourceGroupName - name of the resource group that contains the key vault. +// vaultName - the name of the key vault. +// privateEndpointConnectionName - name of the private endpoint connection associated with the key vault. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, vaultName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResource the List operation gets information about the private endpoint connections associated with the vault. +// Parameters: +// resourceGroupName - name of the resource group that contains the key vault. +// vaultName - the name of the key vault. +func (client PrivateEndpointConnectionsClient) ListByResource(ctx context.Context, resourceGroupName string, vaultName string) (result PrivateEndpointConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByResource") + defer func() { + sc := -1 + if result.peclr.Response.Response != nil { + sc = result.peclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.PrivateEndpointConnectionsClient", "ListByResource", err.Error()) + } + + result.fn = client.listByResourceNextResults + req, err := client.ListByResourcePreparer(ctx, resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "ListByResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceSender(req) + if err != nil { + result.peclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "ListByResource", resp, "Failure sending request") + return + } + + result.peclr, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "ListByResource", resp, "Failure responding to request") + return + } + if result.peclr.hasNextLink() && result.peclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourcePreparer prepares the ListByResource request. +func (client PrivateEndpointConnectionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceSender sends the ListByResource request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceResponder handles the response to the ListByResource request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListByResourceResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceNextResults retrieves the next set of results, if any. +func (client PrivateEndpointConnectionsClient) listByResourceNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { + req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "listByResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, vaultName string) (result PrivateEndpointConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByResource") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResource(ctx, resourceGroupName, vaultName) + return +} + +// Put updates the specified private endpoint connection associated with the key vault. +// Parameters: +// resourceGroupName - name of the resource group that contains the key vault. +// vaultName - the name of the key vault. +// privateEndpointConnectionName - name of the private endpoint connection associated with the key vault. +// properties - the intended state of private endpoint connection. +func (client PrivateEndpointConnectionsClient) Put(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Put") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.PrivateEndpointConnectionsClient", "Put", err.Error()) + } + + req, err := client.PutPreparer(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateEndpointConnectionsClient", "Put", resp, "Failure responding to request") + return + } + + return +} + +// PutPreparer prepares the Put request. +func (client PrivateEndpointConnectionsClient) PutPreparer(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, properties PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) PutSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) PutResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/privatelinkresources.go b/services/keyvault/mgmt/2021-10-01/keyvault/privatelinkresources.go new file mode 100644 index 000000000000..5350317edc52 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/privatelinkresources.go @@ -0,0 +1,116 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the the Azure management API provides a RESTful set of web services that interact with +// Azure Key Vault. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByVault gets the private link resources supported for the key vault. +// Parameters: +// resourceGroupName - name of the resource group that contains the key vault. +// vaultName - the name of the key vault. +func (client PrivateLinkResourcesClient) ListByVault(ctx context.Context, resourceGroupName string, vaultName string) (result PrivateLinkResourceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByVault") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.PrivateLinkResourcesClient", "ListByVault", err.Error()) + } + + req, err := client.ListByVaultPreparer(ctx, resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateLinkResourcesClient", "ListByVault", nil, "Failure preparing request") + return + } + + resp, err := client.ListByVaultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.PrivateLinkResourcesClient", "ListByVault", resp, "Failure sending request") + return + } + + result, err = client.ListByVaultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.PrivateLinkResourcesClient", "ListByVault", resp, "Failure responding to request") + return + } + + return +} + +// ListByVaultPreparer prepares the ListByVault request. +func (client PrivateLinkResourcesClient) ListByVaultPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByVaultSender sends the ListByVault request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListByVaultSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByVaultResponder handles the response to the ListByVault request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListByVaultResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/secrets.go b/services/keyvault/mgmt/2021-10-01/keyvault/secrets.go new file mode 100644 index 000000000000..b2bc222bf9f7 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/secrets.go @@ -0,0 +1,418 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SecretsClient is the the Azure management API provides a RESTful set of web services that interact with Azure Key +// Vault. +type SecretsClient struct { + BaseClient +} + +// NewSecretsClient creates an instance of the SecretsClient client. +func NewSecretsClient(subscriptionID string) SecretsClient { + return NewSecretsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecretsClientWithBaseURI creates an instance of the SecretsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSecretsClientWithBaseURI(baseURI string, subscriptionID string) SecretsClient { + return SecretsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a secret in a key vault in the specified subscription. NOTE: This API is intended +// for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault +// secrets. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - name of the vault +// secretName - name of the secret +// parameters - parameters to create or update the secret +func (client SecretsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretCreateOrUpdateParameters) (result Secret, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: secretName, + Constraints: []validation.Constraint{{Target: "secretName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{1,127}$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.SecretsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vaultName, secretName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SecretsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "secretName": autorest.Encode("path", secretName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SecretsClient) CreateOrUpdateResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the +// data-plane REST service for interaction with vault secrets. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - the name of the vault. +// secretName - the name of the secret. +func (client SecretsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, secretName string) (result Secret, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, vaultName, secretName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecretsClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string, secretName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "secretName": autorest.Encode("path", secretName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecretsClient) GetResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use +// in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - the name of the vault. +// top - maximum number of results to return. +func (client SecretsClient) List(ctx context.Context, resourceGroupName string, vaultName string, top *int32) (result SecretListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.List") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, vaultName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "List", resp, "Failure sending request") + return + } + + result.slr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "List", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SecretsClient) ListPreparer(ctx context.Context, resourceGroupName string, vaultName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecretsClient) ListResponder(resp *http.Response) (result SecretListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SecretsClient) listNextResults(ctx context.Context, lastResults SecretListResult) (result SecretListResult, err error) { + req, err := lastResults.secretListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.SecretsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.SecretsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecretsClient) ListComplete(ctx context.Context, resourceGroupName string, vaultName string, top *int32) (result SecretListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, vaultName, top) + return +} + +// Update update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM +// deployments. Users should use the data-plane REST service for interaction with vault secrets. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - name of the vault +// secretName - name of the secret +// parameters - parameters to patch the secret +func (client SecretsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretPatchParameters) (result Secret, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: secretName, + Constraints: []validation.Constraint{{Target: "secretName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{1,127}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.SecretsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, vaultName, secretName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.SecretsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SecretsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, secretName string, parameters SecretPatchParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "secretName": autorest.Encode("path", secretName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SecretsClient) UpdateResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/vaults.go b/services/keyvault/mgmt/2021-10-01/keyvault/vaults.go new file mode 100644 index 000000000000..c51f51d112a4 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/vaults.go @@ -0,0 +1,1165 @@ +package keyvault + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VaultsClient is the the Azure management API provides a RESTful set of web services that interact with Azure Key +// Vault. +type VaultsClient struct { + BaseClient +} + +// NewVaultsClient creates an instance of the VaultsClient client. +func NewVaultsClient(subscriptionID string) VaultsClient { + return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVaultsClientWithBaseURI creates an instance of the VaultsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { + return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the vault name is valid and is not already in use. +// Parameters: +// vaultName - the name of the vault. +func (client VaultsClient) CheckNameAvailability(ctx context.Context, vaultName VaultCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "vaultName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.VaultsClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client VaultsClient) CheckNameAvailabilityPreparer(ctx context.Context, vaultName VaultCheckNameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability", pathParameters), + autorest.WithJSON(vaultName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client VaultsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update a key vault in the specified subscription. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the server belongs. +// vaultName - name of the vault +// parameters - parameters to create or update the vault +func (client VaultsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters) (result VaultsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.TenantID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Properties.Sku", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.Sku.Family", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("keyvault.VaultsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vaultName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VaultsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultCreateOrUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) CreateOrUpdateSender(req *http.Request) (future VaultsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VaultsClient) CreateOrUpdateResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Azure key vault. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - the name of the vault to delete +func (client VaultsClient) Delete(ctx context.Context, resourceGroupName string, vaultName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VaultsClient) DeletePreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VaultsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Azure key vault. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - the name of the vault. +func (client VaultsClient) Get(ctx context.Context, resourceGroupName string, vaultName string) (result Vault, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, vaultName) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VaultsClient) GetPreparer(ctx context.Context, resourceGroupName string, vaultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VaultsClient) GetResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeleted gets the deleted Azure key vault. +// Parameters: +// vaultName - the name of the vault. +// location - the location of the deleted vault. +func (client VaultsClient) GetDeleted(ctx context.Context, vaultName string, location string) (result DeletedVault, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.GetDeleted") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDeletedPreparer(ctx, vaultName, location) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "GetDeleted", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeletedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "GetDeleted", resp, "Failure sending request") + return + } + + result, err = client.GetDeletedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "GetDeleted", resp, "Failure responding to request") + return + } + + return +} + +// GetDeletedPreparer prepares the GetDeleted request. +func (client VaultsClient) GetDeletedPreparer(ctx context.Context, vaultName string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeletedSender sends the GetDeleted request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) GetDeletedSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeletedResponder handles the response to the GetDeleted request. The method always +// closes the http.Response Body. +func (client VaultsClient) GetDeletedResponder(resp *http.Response) (result DeletedVault, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the List operation gets information about the vaults associated with the subscription. +// Parameters: +// top - maximum number of results to return. +func (client VaultsClient) List(ctx context.Context, top *int32) (result ResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.List") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "List", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VaultsClient) ListPreparer(ctx context.Context, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-11-01" + queryParameters := map[string]interface{}{ + "$filter": autorest.Encode("query", "resourceType eq 'Microsoft.KeyVault/vaults'"), + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListResponder(resp *http.Response) (result ResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VaultsClient) listNextResults(ctx context.Context, lastResults ResourceListResult) (result ResourceListResult, err error) { + req, err := lastResults.resourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VaultsClient) ListComplete(ctx context.Context, top *int32) (result ResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, top) + return +} + +// ListByResourceGroup the List operation gets information about the vaults associated with the subscription and within +// the specified resource group. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// top - maximum number of results to return. +func (client VaultsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result VaultListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.vlr.Response.Response != nil { + sc = result.vlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.vlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.vlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.vlr.hasNextLink() && result.vlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VaultsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListByResourceGroupResponder(resp *http.Response) (result VaultListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VaultsClient) listByResourceGroupNextResults(ctx context.Context, lastResults VaultListResult) (result VaultListResult, err error) { + req, err := lastResults.vaultListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VaultsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result VaultListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top) + return +} + +// ListBySubscription the List operation gets information about the vaults associated with the subscription. +// Parameters: +// top - maximum number of results to return. +func (client VaultsClient) ListBySubscription(ctx context.Context, top *int32) (result VaultListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListBySubscription") + defer func() { + sc := -1 + if result.vlr.Response.Response != nil { + sc = result.vlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, top) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.vlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.vlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.vlr.hasNextLink() && result.vlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client VaultsClient) ListBySubscriptionPreparer(ctx context.Context, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListBySubscriptionResponder(resp *http.Response) (result VaultListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client VaultsClient) listBySubscriptionNextResults(ctx context.Context, lastResults VaultListResult) (result VaultListResult, err error) { + req, err := lastResults.vaultListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client VaultsClient) ListBySubscriptionComplete(ctx context.Context, top *int32) (result VaultListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, top) + return +} + +// ListDeleted gets information about the deleted vaults in a subscription. +func (client VaultsClient) ListDeleted(ctx context.Context) (result DeletedVaultListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListDeleted") + defer func() { + sc := -1 + if result.dvlr.Response.Response != nil { + sc = result.dvlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listDeletedNextResults + req, err := client.ListDeletedPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListDeleted", nil, "Failure preparing request") + return + } + + resp, err := client.ListDeletedSender(req) + if err != nil { + result.dvlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListDeleted", resp, "Failure sending request") + return + } + + result.dvlr, err = client.ListDeletedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "ListDeleted", resp, "Failure responding to request") + return + } + if result.dvlr.hasNextLink() && result.dvlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListDeletedPreparer prepares the ListDeleted request. +func (client VaultsClient) ListDeletedPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDeletedSender sends the ListDeleted request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) ListDeletedSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDeletedResponder handles the response to the ListDeleted request. The method always +// closes the http.Response Body. +func (client VaultsClient) ListDeletedResponder(resp *http.Response) (result DeletedVaultListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listDeletedNextResults retrieves the next set of results, if any. +func (client VaultsClient) listDeletedNextResults(ctx context.Context, lastResults DeletedVaultListResult) (result DeletedVaultListResult, err error) { + req, err := lastResults.deletedVaultListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listDeletedNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListDeletedSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listDeletedNextResults", resp, "Failure sending next results request") + } + result, err = client.ListDeletedResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "listDeletedNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListDeletedComplete enumerates all values, automatically crossing page boundaries as required. +func (client VaultsClient) ListDeletedComplete(ctx context.Context) (result DeletedVaultListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.ListDeleted") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListDeleted(ctx) + return +} + +// PurgeDeleted permanently deletes the specified vault. aka Purges the deleted Azure key vault. +// Parameters: +// vaultName - the name of the soft-deleted vault. +// location - the location of the soft-deleted vault. +func (client VaultsClient) PurgeDeleted(ctx context.Context, vaultName string, location string) (result VaultsPurgeDeletedFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.PurgeDeleted") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PurgeDeletedPreparer(ctx, vaultName, location) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "PurgeDeleted", nil, "Failure preparing request") + return + } + + result, err = client.PurgeDeletedSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "PurgeDeleted", result.Response(), "Failure sending request") + return + } + + return +} + +// PurgeDeletedPreparer prepares the PurgeDeleted request. +func (client VaultsClient) PurgeDeletedPreparer(ctx context.Context, vaultName string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurgeDeletedSender sends the PurgeDeleted request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) PurgeDeletedSender(req *http.Request) (future VaultsPurgeDeletedFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PurgeDeletedResponder handles the response to the PurgeDeleted request. The method always +// closes the http.Response Body. +func (client VaultsClient) PurgeDeletedResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update update a key vault in the specified subscription. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the server belongs. +// vaultName - name of the vault +// parameters - parameters to patch the vault +func (client VaultsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultPatchParameters) (result Vault, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("keyvault.VaultsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, vaultName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VaultsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, vaultName string, parameters VaultPatchParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client VaultsClient) UpdateResponder(resp *http.Response) (result Vault, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAccessPolicy update access policies in a key vault in the specified subscription. +// Parameters: +// resourceGroupName - the name of the Resource Group to which the vault belongs. +// vaultName - name of the vault +// operationKind - name of the operation +// parameters - access policy to merge into the vault +func (client VaultsClient) UpdateAccessPolicy(ctx context.Context, resourceGroupName string, vaultName string, operationKind AccessPolicyUpdateKind, parameters VaultAccessPolicyParameters) (result VaultAccessPolicyParameters, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.UpdateAccessPolicy") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vaultName, + Constraints: []validation.Constraint{{Target: "vaultName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]{3,24}$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Properties.AccessPolicies", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("keyvault.VaultsClient", "UpdateAccessPolicy", err.Error()) + } + + req, err := client.UpdateAccessPolicyPreparer(ctx, resourceGroupName, vaultName, operationKind, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "UpdateAccessPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAccessPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "UpdateAccessPolicy", resp, "Failure sending request") + return + } + + result, err = client.UpdateAccessPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "keyvault.VaultsClient", "UpdateAccessPolicy", resp, "Failure responding to request") + return + } + + return +} + +// UpdateAccessPolicyPreparer prepares the UpdateAccessPolicy request. +func (client VaultsClient) UpdateAccessPolicyPreparer(ctx context.Context, resourceGroupName string, vaultName string, operationKind AccessPolicyUpdateKind, parameters VaultAccessPolicyParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationKind": autorest.Encode("path", operationKind), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vaultName": autorest.Encode("path", vaultName), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAccessPolicySender sends the UpdateAccessPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client VaultsClient) UpdateAccessPolicySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateAccessPolicyResponder handles the response to the UpdateAccessPolicy request. The method always +// closes the http.Response Body. +func (client VaultsClient) UpdateAccessPolicyResponder(resp *http.Response) (result VaultAccessPolicyParameters, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/keyvault/mgmt/2021-10-01/keyvault/version.go b/services/keyvault/mgmt/2021-10-01/keyvault/version.go new file mode 100644 index 000000000000..438d480ca971 --- /dev/null +++ b/services/keyvault/mgmt/2021-10-01/keyvault/version.go @@ -0,0 +1,19 @@ +package keyvault + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " keyvault/2021-10-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/CHANGELOG.md b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/CHANGELOG.md index 52911e4cc5e4..8418900aedd2 100644 --- a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/CHANGELOG.md +++ b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/CHANGELOG.md @@ -1,2 +1,40 @@ -# Change History +# Unreleased +## Breaking Changes + +### Struct Changes + +#### Removed Struct Fields + +1. PrivateLinkServiceConnectionState.ActionRequired + +## Additive Changes + +### New Constants + +1. VaultProvisioningState.VaultProvisioningStateRegisteringDNS +1. VaultProvisioningState.VaultProvisioningStateSucceeded + +### New Funcs + +1. PossibleVaultProvisioningStateValues() []VaultProvisioningState + +### Struct Changes + +#### New Structs + +1. DimensionProperties +1. MetricSpecification + +#### New Struct Fields + +1. DeletedVaultProperties.PurgeProtectionEnabled +1. Operation.IsDataAction +1. PrivateEndpointConnection.Etag +1. PrivateEndpointConnectionItem.Etag +1. PrivateEndpointConnectionItem.ID +1. PrivateLinkServiceConnectionState.ActionsRequired +1. ServiceSpecification.MetricSpecifications +1. VaultProperties.HsmPoolResourceID +1. VaultProperties.ProvisioningState +1. VirtualNetworkRule.IgnoreMissingVnetServiceEndpoint diff --git a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/_meta.json b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/_meta.json index 76cc9ce8308a..9161cdaafeb6 100644 --- a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/_meta.json +++ b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "fd0b1a763b8dbc2bfc781895bcae49c91f511c4a", "readme": "/_/azure-rest-api-specs/specification/keyvault/resource-manager/readme.md", "tag": "package-preview-2020-04", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/enums.go b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/enums.go index eff409c7ad4a..63b8898eafe1 100644 --- a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/enums.go +++ b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/enums.go @@ -343,3 +343,18 @@ const ( func PossibleStoragePermissionsValues() []StoragePermissions { return []StoragePermissions{StoragePermissionsAll, StoragePermissionsBackup, StoragePermissionsDelete, StoragePermissionsDeletesas, StoragePermissionsGet, StoragePermissionsGetsas, StoragePermissionsList, StoragePermissionsListsas, StoragePermissionsPurge, StoragePermissionsRecover, StoragePermissionsRegeneratekey, StoragePermissionsRestore, StoragePermissionsSet, StoragePermissionsSetsas, StoragePermissionsUpdate} } + +// VaultProvisioningState enumerates the values for vault provisioning state. +type VaultProvisioningState string + +const ( + // VaultProvisioningStateRegisteringDNS ... + VaultProvisioningStateRegisteringDNS VaultProvisioningState = "RegisteringDns" + // VaultProvisioningStateSucceeded ... + VaultProvisioningStateSucceeded VaultProvisioningState = "Succeeded" +) + +// PossibleVaultProvisioningStateValues returns an array of possible values for the VaultProvisioningState const type. +func PossibleVaultProvisioningStateValues() []VaultProvisioningState { + return []VaultProvisioningState{VaultProvisioningStateRegisteringDNS, VaultProvisioningStateSucceeded} +} diff --git a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/managedhsms.go b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/managedhsms.go index e9174031fe6c..9b9b701dfc32 100644 --- a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/managedhsms.go +++ b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/managedhsms.go @@ -260,7 +260,7 @@ func (client ManagedHsmsClient) GetSender(req *http.Request) (*http.Response, er func (client ManagedHsmsClient) GetResponder(resp *http.Response) (result ManagedHsm, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/models.go b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/models.go index f5cf4c25aecc..49e90497e311 100644 --- a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/models.go +++ b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/models.go @@ -257,6 +257,8 @@ type DeletedVaultProperties struct { ScheduledPurgeDate *date.Time `json:"scheduledPurgeDate,omitempty"` // Tags - READ-ONLY; Tags of the original vault. Tags map[string]*string `json:"tags"` + // PurgeProtectionEnabled - READ-ONLY; Purge protection status of the original vault. + PurgeProtectionEnabled *bool `json:"purgeProtectionEnabled,omitempty"` } // MarshalJSON is the custom marshaler for DeletedVaultProperties. @@ -265,6 +267,16 @@ func (dvp DeletedVaultProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// DimensionProperties type of operation: get, read, delete, etc. +type DimensionProperties struct { + // Name - Name of dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of dimension. + DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - Property to specify whether the dimension should be exported for shoebox. + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + // Error the server error. type Error struct { // Code - READ-ONLY; The error code. @@ -511,7 +523,7 @@ type ManagedHsmProperties struct { TenantID *uuid.UUID `json:"tenantId,omitempty"` // InitialAdminObjectIds - Array of initial administrators object ids for this managed hsm pool. InitialAdminObjectIds *[]string `json:"initialAdminObjectIds,omitempty"` - // HsmURI - The URI of the managed hsm pool for performing operations on keys. + // HsmURI - READ-ONLY; The URI of the managed hsm pool for performing operations on keys. HsmURI *string `json:"hsmUri,omitempty"` // EnableSoftDelete - Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. If it's not set to any value(true or false) when creating new managed HSM pool, it will be set to true by default. Once set to true, it cannot be reverted to false. EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` @@ -536,9 +548,6 @@ func (mhp ManagedHsmProperties) MarshalJSON() ([]byte, error) { if mhp.InitialAdminObjectIds != nil { objectMap["initialAdminObjectIds"] = mhp.InitialAdminObjectIds } - if mhp.HsmURI != nil { - objectMap["hsmUri"] = mhp.HsmURI - } if mhp.EnableSoftDelete != nil { objectMap["enableSoftDelete"] = mhp.EnableSoftDelete } @@ -716,6 +725,32 @@ func (future *ManagedHsmsUpdateFuture) result(client ManagedHsmsClient) (mh Mana return } +// MetricSpecification metric specification of operation. +type MetricSpecification struct { + // Name - Name of metric specification. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of Metric specification. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Display description of Metric specification. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + Unit *string `json:"unit,omitempty"` + // AggregationType - The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. + AggregationType *string `json:"aggregationType,omitempty"` + // SupportedAggregationTypes - The supported aggregation types for the metrics. + SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` + // SupportedTimeGrainTypes - The supported time grain types for the metrics. + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // LockAggregationType - The metric lock aggregation type. + LockAggregationType *string `json:"lockAggregationType,omitempty"` + // Dimensions - The dimensions of metric + Dimensions *[]DimensionProperties `json:"dimensions,omitempty"` + // FillGapWithZero - Property to specify whether to fill gap with zero. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // InternalMetricName - The internal metric name. + InternalMetricName *string `json:"internalMetricName,omitempty"` +} + // NetworkRuleSet a set of rules governing the network accessibility of a vault. type NetworkRuleSet struct { // Bypass - Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: 'AzureServices', 'None' @@ -738,6 +773,8 @@ type Operation struct { Origin *string `json:"origin,omitempty"` // OperationProperties - Properties of operation, include metric specifications. *OperationProperties `json:"properties,omitempty"` + // IsDataAction - Property to specify whether the action is a data action. + IsDataAction *bool `json:"isDataAction,omitempty"` } // MarshalJSON is the custom marshaler for Operation. @@ -755,6 +792,9 @@ func (o Operation) MarshalJSON() ([]byte, error) { if o.OperationProperties != nil { objectMap["properties"] = o.OperationProperties } + if o.IsDataAction != nil { + objectMap["isDataAction"] = o.IsDataAction + } return json.Marshal(objectMap) } @@ -803,6 +843,15 @@ func (o *Operation) UnmarshalJSON(body []byte) error { } o.OperationProperties = &operationProperties } + case "isDataAction": + if v != nil { + var isDataAction bool + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + o.IsDataAction = &isDataAction + } } } @@ -1016,6 +1065,8 @@ type PrivateEndpointConnection struct { autorest.Response `json:"-"` // PrivateEndpointConnectionProperties - Resource properties. *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // Etag - Modified whenever there is a change in the state of private endpoint connection. + Etag *string `json:"etag,omitempty"` // ID - READ-ONLY; Fully qualified identifier of the key vault resource. ID *string `json:"id,omitempty"` // Name - READ-ONLY; Name of the key vault resource. @@ -1034,6 +1085,9 @@ func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { if pec.PrivateEndpointConnectionProperties != nil { objectMap["properties"] = pec.PrivateEndpointConnectionProperties } + if pec.Etag != nil { + objectMap["etag"] = pec.Etag + } return json.Marshal(objectMap) } @@ -1055,6 +1109,15 @@ func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { } pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pec.Etag = &etag + } case "id": if v != nil { var ID string @@ -1108,6 +1171,10 @@ func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { // PrivateEndpointConnectionItem private endpoint connection item. type PrivateEndpointConnectionItem struct { + // ID - Id of private endpoint connection. + ID *string `json:"id,omitempty"` + // Etag - Modified whenever there is a change in the state of private endpoint connection. + Etag *string `json:"etag,omitempty"` // PrivateEndpointConnectionProperties - Private endpoint connection properties. *PrivateEndpointConnectionProperties `json:"properties,omitempty"` } @@ -1115,6 +1182,12 @@ type PrivateEndpointConnectionItem struct { // MarshalJSON is the custom marshaler for PrivateEndpointConnectionItem. func (peci PrivateEndpointConnectionItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if peci.ID != nil { + objectMap["id"] = peci.ID + } + if peci.Etag != nil { + objectMap["etag"] = peci.Etag + } if peci.PrivateEndpointConnectionProperties != nil { objectMap["properties"] = peci.PrivateEndpointConnectionProperties } @@ -1130,6 +1203,24 @@ func (peci *PrivateEndpointConnectionItem) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + peci.ID = &ID + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + peci.Etag = &etag + } case "properties": if v != nil { var privateEndpointConnectionProperties PrivateEndpointConnectionProperties @@ -1325,8 +1416,8 @@ type PrivateLinkServiceConnectionState struct { Status PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` // Description - The reason for approval or rejection. Description *string `json:"description,omitempty"` - // ActionRequired - A message indicating if changes on the service provider require any updates on the consumer. - ActionRequired *string `json:"actionRequired,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` } // Resource key Vault resource @@ -1512,6 +1603,8 @@ func NewResourceListResultPage(cur ResourceListResult, getNextPage func(context. type ServiceSpecification struct { // LogSpecifications - Log specifications of operation. LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Metric specifications of operation. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` } // Sku SKU details @@ -1812,7 +1905,7 @@ type VaultPatchProperties struct { EnabledForTemplateDeployment *bool `json:"enabledForTemplateDeployment,omitempty"` // EnableSoftDelete - Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot be reverted to false. EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` - // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored (warning: this is a preview feature). When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the value of this property will not change. + // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the value of this property will not change. EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` // SoftDeleteRetentionInDays - softDelete data retention days. It accepts >=7 and <=90. SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` @@ -1832,8 +1925,10 @@ type VaultProperties struct { Sku *Sku `json:"sku,omitempty"` // AccessPolicies - An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. When `createMode` is set to `recover`, access policies are not required. Otherwise, access policies are required. AccessPolicies *[]AccessPolicyEntry `json:"accessPolicies,omitempty"` - // VaultURI - The URI of the vault for performing operations on keys and secrets. + // VaultURI - The URI of the vault for performing operations on keys and secrets. This property is readonly VaultURI *string `json:"vaultUri,omitempty"` + // HsmPoolResourceID - READ-ONLY; The resource id of HSM Pool. + HsmPoolResourceID *string `json:"hsmPoolResourceId,omitempty"` // EnabledForDeployment - Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. EnabledForDeployment *bool `json:"enabledForDeployment,omitempty"` // EnabledForDiskEncryption - Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. @@ -1844,7 +1939,7 @@ type VaultProperties struct { EnableSoftDelete *bool `json:"enableSoftDelete,omitempty"` // SoftDeleteRetentionInDays - softDelete data retention days. It accepts >=7 and <=90. SoftDeleteRetentionInDays *int32 `json:"softDeleteRetentionInDays,omitempty"` - // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored (warning: this is a preview feature). When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the vault is created with the default value of false. Note that management actions are always authorized with RBAC. + // EnableRbacAuthorization - Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the vault is created with the default value of false. Note that management actions are always authorized with RBAC. EnableRbacAuthorization *bool `json:"enableRbacAuthorization,omitempty"` // CreateMode - The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: 'CreateModeRecover', 'CreateModeDefault' CreateMode CreateMode `json:"createMode,omitempty"` @@ -1852,6 +1947,8 @@ type VaultProperties struct { EnablePurgeProtection *bool `json:"enablePurgeProtection,omitempty"` // NetworkAcls - Rules governing the accessibility of the key vault from specific network locations. NetworkAcls *NetworkRuleSet `json:"networkAcls,omitempty"` + // ProvisioningState - Provisioning state of the vault. Possible values include: 'VaultProvisioningStateSucceeded', 'VaultProvisioningStateRegisteringDNS' + ProvisioningState VaultProvisioningState `json:"provisioningState,omitempty"` // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections associated with the key vault. PrivateEndpointConnections *[]PrivateEndpointConnectionItem `json:"privateEndpointConnections,omitempty"` } @@ -1898,6 +1995,9 @@ func (vp VaultProperties) MarshalJSON() ([]byte, error) { if vp.NetworkAcls != nil { objectMap["networkAcls"] = vp.NetworkAcls } + if vp.ProvisioningState != "" { + objectMap["provisioningState"] = vp.ProvisioningState + } return json.Marshal(objectMap) } @@ -1985,4 +2085,6 @@ func (future *VaultsPurgeDeletedFuture) result(client VaultsClient) (ar autorest type VirtualNetworkRule struct { // ID - Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. ID *string `json:"id,omitempty"` + // IgnoreMissingVnetServiceEndpoint - Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. + IgnoreMissingVnetServiceEndpoint *bool `json:"ignoreMissingVnetServiceEndpoint,omitempty"` } diff --git a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/privateendpointconnections.go b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/privateendpointconnections.go index d7865b9d97a2..07419877f06e 100644 --- a/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/privateendpointconnections.go +++ b/services/preview/keyvault/mgmt/2020-04-01-preview/keyvault/privateendpointconnections.go @@ -197,7 +197,7 @@ func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*ht func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp}