diff --git a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md index b236d0585451..5642d8b5ad6b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: ApiManagement namespace: Azure.ResourceManager.ApiManagement -require: https://github.com/Azure/azure-rest-api-specs/blob/2d973fccf9f28681a481e9760fa12b2334216e21/specification/apimanagement/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/apimanagement/resource-manager/readme.md tag: package-preview-2023-03 output-folder: $(this-folder)/Generated clear-output-folder: true diff --git a/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.net8.0.cs b/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.net8.0.cs index 92bfb9a2e24a..47b936dba214 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.net8.0.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.net8.0.cs @@ -763,8 +763,6 @@ public static partial class BillingExtensions public static Azure.ResourceManager.Billing.BillingProfileCustomerResource GetBillingProfileCustomerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Billing.BillingProfilePolicyResource GetBillingProfilePolicyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Billing.BillingProfileResource GetBillingProfileResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.Billing.BillingProfileRoleAssignmentResource GetBillingProfileRoleAssignmentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.Billing.BillingProfileRoleDefinitionResource GetBillingProfileRoleDefinitionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Billing.BillingProfileSubscriptionResource GetBillingProfileSubscriptionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Billing.BillingPropertyResource GetBillingProperty(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } public static Azure.ResourceManager.Billing.BillingPropertyResource GetBillingPropertyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -1347,17 +1345,15 @@ protected BillingProfileResource() { } public virtual System.Threading.Tasks.Task> GetBillingProfileCustomerAsync(string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfileCustomerCollection GetBillingProfileCustomers() { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfilePolicyResource GetBillingProfilePolicy() { throw null; } - public virtual Azure.Response GetBillingProfileRoleAssignment(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetBillingProfileRoleAssignmentAsync(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.Billing.BillingProfileRoleAssignmentCollection GetBillingProfileRoleAssignments() { throw null; } - public virtual Azure.Response GetBillingProfileRoleDefinition(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetBillingProfileRoleDefinitionAsync(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.Billing.BillingProfileRoleDefinitionCollection GetBillingProfileRoleDefinitions() { throw null; } public virtual Azure.Response GetBillingProfileSubscription(string billingSubscriptionName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetBillingProfileSubscriptionAsync(string billingSubscriptionName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfileSubscriptionCollection GetBillingProfileSubscriptions() { throw null; } public virtual Azure.Pageable GetBillingRequests(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetBillingRequestsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetBillingRequestsAsync(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetBillingRequestsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBillingRoleAssignments(string filter = null, long? top = default(long?), long? skip = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBillingRoleAssignmentsAsync(string filter = null, long? top = default(long?), long? skip = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBillingRoleDefinitions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBillingRoleDefinitionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetInvoices(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetInvoicesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetInvoicesAsync(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetInvoicesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetProducts(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetProductsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -1382,68 +1378,6 @@ protected BillingProfileResource() { } public virtual Azure.Response ValidateDeleteEligibility(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> ValidateDeleteEligibilityAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class BillingProfileRoleAssignmentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected BillingProfileRoleAssignmentCollection() { } - public virtual Azure.Response Exists(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(string filter = null, long? top = default(long?), long? skip = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(string filter = null, long? top = default(long?), long? skip = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class BillingProfileRoleAssignmentResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public static readonly Azure.Core.ResourceType ResourceType; - protected BillingProfileRoleAssignmentResource() { } - public virtual Azure.ResourceManager.Billing.BillingRoleAssignmentData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string billingProfileName, string billingRoleAssignmentName) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - Azure.ResourceManager.Billing.BillingRoleAssignmentData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Billing.BillingRoleAssignmentData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class BillingProfileRoleDefinitionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected BillingProfileRoleDefinitionCollection() { } - public virtual Azure.Response Exists(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class BillingProfileRoleDefinitionResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public static readonly Azure.Core.ResourceType ResourceType; - protected BillingProfileRoleDefinitionResource() { } - public virtual Azure.ResourceManager.Billing.BillingRoleDefinitionData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string billingProfileName, string roleDefinitionName) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - Azure.ResourceManager.Billing.BillingRoleDefinitionData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Billing.BillingRoleDefinitionData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class BillingProfileSubscriptionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected BillingProfileSubscriptionCollection() { } @@ -2474,8 +2408,6 @@ protected MockableBillingArmClient() { } public virtual Azure.ResourceManager.Billing.BillingProfileCustomerResource GetBillingProfileCustomerResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfilePolicyResource GetBillingProfilePolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfileResource GetBillingProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } - public virtual Azure.ResourceManager.Billing.BillingProfileRoleAssignmentResource GetBillingProfileRoleAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } - public virtual Azure.ResourceManager.Billing.BillingProfileRoleDefinitionResource GetBillingProfileRoleDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfileSubscriptionResource GetBillingProfileSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingPropertyResource GetBillingPropertyResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingRequestResource GetBillingRequestResource(Azure.Core.ResourceIdentifier id) { throw null; } diff --git a/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.netstandard2.0.cs b/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.netstandard2.0.cs index 92bfb9a2e24a..47b936dba214 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.netstandard2.0.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/api/Azure.ResourceManager.Billing.netstandard2.0.cs @@ -763,8 +763,6 @@ public static partial class BillingExtensions public static Azure.ResourceManager.Billing.BillingProfileCustomerResource GetBillingProfileCustomerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Billing.BillingProfilePolicyResource GetBillingProfilePolicyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Billing.BillingProfileResource GetBillingProfileResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.Billing.BillingProfileRoleAssignmentResource GetBillingProfileRoleAssignmentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.Billing.BillingProfileRoleDefinitionResource GetBillingProfileRoleDefinitionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Billing.BillingProfileSubscriptionResource GetBillingProfileSubscriptionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Billing.BillingPropertyResource GetBillingProperty(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } public static Azure.ResourceManager.Billing.BillingPropertyResource GetBillingPropertyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -1347,17 +1345,15 @@ protected BillingProfileResource() { } public virtual System.Threading.Tasks.Task> GetBillingProfileCustomerAsync(string customerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfileCustomerCollection GetBillingProfileCustomers() { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfilePolicyResource GetBillingProfilePolicy() { throw null; } - public virtual Azure.Response GetBillingProfileRoleAssignment(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetBillingProfileRoleAssignmentAsync(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.Billing.BillingProfileRoleAssignmentCollection GetBillingProfileRoleAssignments() { throw null; } - public virtual Azure.Response GetBillingProfileRoleDefinition(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetBillingProfileRoleDefinitionAsync(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.Billing.BillingProfileRoleDefinitionCollection GetBillingProfileRoleDefinitions() { throw null; } public virtual Azure.Response GetBillingProfileSubscription(string billingSubscriptionName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetBillingProfileSubscriptionAsync(string billingSubscriptionName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfileSubscriptionCollection GetBillingProfileSubscriptions() { throw null; } public virtual Azure.Pageable GetBillingRequests(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetBillingRequestsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetBillingRequestsAsync(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetBillingRequestsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBillingRoleAssignments(string filter = null, long? top = default(long?), long? skip = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBillingRoleAssignmentsAsync(string filter = null, long? top = default(long?), long? skip = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetBillingRoleDefinitions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetBillingRoleDefinitionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetInvoices(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetInvoicesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetInvoicesAsync(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetInvoicesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetProducts(Azure.ResourceManager.Billing.Models.BillingProfileResourceGetProductsOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -1382,68 +1378,6 @@ protected BillingProfileResource() { } public virtual Azure.Response ValidateDeleteEligibility(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> ValidateDeleteEligibilityAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class BillingProfileRoleAssignmentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected BillingProfileRoleAssignmentCollection() { } - public virtual Azure.Response Exists(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(string filter = null, long? top = default(long?), long? skip = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(string filter = null, long? top = default(long?), long? skip = default(long?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string billingRoleAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class BillingProfileRoleAssignmentResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public static readonly Azure.Core.ResourceType ResourceType; - protected BillingProfileRoleAssignmentResource() { } - public virtual Azure.ResourceManager.Billing.BillingRoleAssignmentData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string billingProfileName, string billingRoleAssignmentName) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - Azure.ResourceManager.Billing.BillingRoleAssignmentData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Billing.BillingRoleAssignmentData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public partial class BillingProfileRoleDefinitionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected BillingProfileRoleDefinitionCollection() { } - public virtual Azure.Response Exists(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string roleDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class BillingProfileRoleDefinitionResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public static readonly Azure.Core.ResourceType ResourceType; - protected BillingProfileRoleDefinitionResource() { } - public virtual Azure.ResourceManager.Billing.BillingRoleDefinitionData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string billingProfileName, string roleDefinitionName) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - Azure.ResourceManager.Billing.BillingRoleDefinitionData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.Billing.BillingRoleDefinitionData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class BillingProfileSubscriptionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected BillingProfileSubscriptionCollection() { } @@ -2474,8 +2408,6 @@ protected MockableBillingArmClient() { } public virtual Azure.ResourceManager.Billing.BillingProfileCustomerResource GetBillingProfileCustomerResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfilePolicyResource GetBillingProfilePolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfileResource GetBillingProfileResource(Azure.Core.ResourceIdentifier id) { throw null; } - public virtual Azure.ResourceManager.Billing.BillingProfileRoleAssignmentResource GetBillingProfileRoleAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } - public virtual Azure.ResourceManager.Billing.BillingProfileRoleDefinitionResource GetBillingProfileRoleDefinitionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingProfileSubscriptionResource GetBillingProfileSubscriptionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingPropertyResource GetBillingPropertyResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Billing.BillingRequestResource GetBillingRequestResource(Azure.Core.ResourceIdentifier id) { throw null; } diff --git a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingProfileResource.cs b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingProfileResource.cs index adc981e76257..26dfe1fc6070 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingProfileResource.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/samples/Generated/Samples/Sample_BillingProfileResource.cs @@ -312,6 +312,35 @@ public async Task GetBillingRequests_BillingRequestsListByBillingProfile() Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetBillingRoleAssignments_BillingRoleAssignmentListByBillingProfile() + { + // Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleAssignmentListByBillingProfile.json + // this example is just showing the usage of "BillingRoleAssignments_ListByBillingProfile" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BillingProfileResource created on azure + // for more information of creating BillingProfileResource, please refer to the document of BillingProfileResource + string billingAccountName = "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30"; + string billingProfileName = "xxxx-xxxx-xxx-xxx"; + ResourceIdentifier billingProfileResourceId = BillingProfileResource.CreateResourceIdentifier(billingAccountName, billingProfileName); + BillingProfileResource billingProfile = client.GetBillingProfileResource(billingProfileResourceId); + + // invoke the operation and iterate over the result + await foreach (BillingRoleAssignmentData item in billingProfile.GetBillingRoleAssignmentsAsync()) + { + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {item.Id}"); + } + + Console.WriteLine("Succeeded"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task CreateByBillingProfileBillingRoleAssignment_BillingRoleAssignmentCreateByBillingProfile() @@ -371,6 +400,35 @@ public async Task ResolveByBillingProfileBillingRoleAssignment_ResolveBillingRol Console.WriteLine($"Succeeded: {result}"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetBillingRoleDefinitions_BillingRoleDefinitionListByBillingProfile() + { + // Generated from example definition: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRoleDefinitionListByBillingProfile.json + // this example is just showing the usage of "BillingRoleDefinition_ListByBillingProfile" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this BillingProfileResource created on azure + // for more information of creating BillingProfileResource, please refer to the document of BillingProfileResource + string billingAccountName = "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31"; + string billingProfileName = "xxxx-xxxx-xxx-xxx"; + ResourceIdentifier billingProfileResourceId = BillingProfileResource.CreateResourceIdentifier(billingAccountName, billingProfileName); + BillingProfileResource billingProfile = client.GetBillingProfileResource(billingProfileResourceId); + + // invoke the operation and iterate over the result + await foreach (BillingRoleDefinitionData item in billingProfile.GetBillingRoleDefinitionsAsync()) + { + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {item.Id}"); + } + + Console.WriteLine("Succeeded"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task GetInvoices_InvoicesListByBillingProfile() diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/ArmBillingModelFactory.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/ArmBillingModelFactory.cs index d8a0517c122f..9b9001c8bc8d 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/ArmBillingModelFactory.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/ArmBillingModelFactory.cs @@ -797,6 +797,17 @@ public static BillingRequestProperties BillingRequestProperties(BillingProvision serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The link (url) to the next page of results. + /// The list of resources. + /// A new instance for mocking. + public static BillingRoleAssignmentListResult BillingRoleAssignmentListResult(string nextLink = null, IEnumerable value = null) + { + value ??= new List(); + + return new BillingRoleAssignmentListResult(nextLink, value?.ToList(), serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -887,17 +898,6 @@ public static BillingRoleAssignmentProperties BillingRoleAssignmentProperties(Bi serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The link (url) to the next page of results. - /// The list of resources. - /// A new instance for mocking. - public static BillingRoleAssignmentListResult BillingRoleAssignmentListResult(string nextLink = null, IEnumerable value = null) - { - value ??= new List(); - - return new BillingRoleAssignmentListResult(nextLink, value?.ToList(), serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -1152,7 +1152,7 @@ public static SavingsPlanValidResponseProperty SavingsPlanValidResponseProperty( /// The last month's charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// The current month to date charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// Next billing cycle details of the subscription. - /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts. + /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. /// The category of the product for which the subscription is purchased. Possible values include: AzureSupport, Hardware, ReservationOrder, SaaS, SavingsPlanOrder, Software, UsageBased, Other. /// Type of the product for which the subscription is purchased. /// Id of the product for which the subscription is purchased. @@ -1296,7 +1296,7 @@ public static BillingSystemOverrides BillingSystemOverrides(PolicyOverrideCancel /// The last month's charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// The current month to date charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// Next billing cycle details of the subscription. - /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts. + /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. /// The category of the product for which the subscription is purchased. Possible values include: AzureSupport, Hardware, ReservationOrder, SaaS, SavingsPlanOrder, Software, UsageBased, Other. /// Type of the product for which the subscription is purchased. /// Id of the product for which the subscription is purchased. @@ -1439,7 +1439,7 @@ public static BillingSubscriptionValidateMoveEligibilityError BillingSubscriptio /// The last month's charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// The current month to date charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// Next billing cycle details of the subscription. - /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts. + /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. /// The category of the product for which the subscription is purchased. Possible values include: AzureSupport, Hardware, ReservationOrder, SaaS, SavingsPlanOrder, Software, UsageBased, Other. /// Type of the product for which the subscription is purchased. /// Id of the product for which the subscription is purchased. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileResource.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileResource.cs index a064daa4515d..1aff9885b835 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileResource.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileResource.cs @@ -44,6 +44,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string billingAccountN private readonly BillingRequestsRestOperations _billingRequestRestClient; private readonly ClientDiagnostics _billingRoleAssignmentsClientDiagnostics; private readonly BillingRoleAssignmentsRestOperations _billingRoleAssignmentsRestClient; + private readonly ClientDiagnostics _billingRoleDefinitionClientDiagnostics; + private readonly BillingRoleDefinitionRestOperations _billingRoleDefinitionRestClient; private readonly ClientDiagnostics _invoicesClientDiagnostics; private readonly InvoicesRestOperations _invoicesRestClient; private readonly ClientDiagnostics _billingProductProductsClientDiagnostics; @@ -88,6 +90,8 @@ internal BillingProfileResource(ArmClient client, ResourceIdentifier id) : base( _billingRequestRestClient = new BillingRequestsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, billingRequestApiVersion); _billingRoleAssignmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Billing", ProviderConstants.DefaultProviderNamespace, Diagnostics); _billingRoleAssignmentsRestClient = new BillingRoleAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _billingRoleDefinitionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Billing", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _billingRoleDefinitionRestClient = new BillingRoleDefinitionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _invoicesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Billing", ProviderConstants.DefaultProviderNamespace, Diagnostics); _invoicesRestClient = new InvoicesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _billingProductProductsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Billing", BillingProductResource.ResourceType.Namespace, Diagnostics); @@ -124,144 +128,6 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of BillingProfileRoleAssignmentResources in the BillingProfile. - /// An object representing collection of BillingProfileRoleAssignmentResources and their operations over a BillingProfileRoleAssignmentResource. - public virtual BillingProfileRoleAssignmentCollection GetBillingProfileRoleAssignments() - { - return GetCachedClient(client => new BillingProfileRoleAssignmentCollection(client, Id)); - } - - /// - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetBillingProfileRoleAssignmentAsync(string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - return await GetBillingProfileRoleAssignments().GetAsync(billingRoleAssignmentName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetBillingProfileRoleAssignment(string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - return GetBillingProfileRoleAssignments().Get(billingRoleAssignmentName, cancellationToken); - } - - /// Gets a collection of BillingProfileRoleDefinitionResources in the BillingProfile. - /// An object representing collection of BillingProfileRoleDefinitionResources and their operations over a BillingProfileRoleDefinitionResource. - public virtual BillingProfileRoleDefinitionCollection GetBillingProfileRoleDefinitions() - { - return GetCachedClient(client => new BillingProfileRoleDefinitionCollection(client, Id)); - } - - /// - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetBillingProfileRoleDefinitionAsync(string roleDefinitionName, CancellationToken cancellationToken = default) - { - return await GetBillingProfileRoleDefinitions().GetAsync(roleDefinitionName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetBillingProfileRoleDefinition(string roleDefinitionName, CancellationToken cancellationToken = default) - { - return GetBillingProfileRoleDefinitions().Get(roleDefinitionName, cancellationToken); - } - /// Gets a collection of BillingProfileSubscriptionResources in the BillingProfile. /// An object representing collection of BillingProfileSubscriptionResources and their operations over a BillingProfileSubscriptionResource. public virtual BillingProfileSubscriptionCollection GetBillingProfileSubscriptions() @@ -1123,6 +989,64 @@ public virtual Pageable GetBillingRequests(BillingProfil return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingRequestResource(Client, BillingRequestData.DeserializeBillingRequestData(e)), _billingRequestClientDiagnostics, Pipeline, "BillingProfileResource.GetBillingRequests", "value", "nextLink", cancellationToken); } + /// + /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments + /// + /// + /// Operation Id + /// BillingRoleAssignments_ListByBillingProfile + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// The filter query option allows clients to filter a collection of resources that are addressed by a request URL. + /// The top query option requests the number of items in the queried collection to be included in the result. The maximum supported value for top is 50. + /// The skip query option requests the number of items in the queried collection that are to be skipped and not included in the result. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBillingRoleAssignmentsAsync(string filter = null, long? top = null, long? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _billingRoleAssignmentsRestClient.CreateListByBillingProfileRequest(Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingRoleAssignmentsRestClient.CreateListByBillingProfileNextPageRequest(nextLink, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BillingRoleAssignmentData.DeserializeBillingRoleAssignmentData(e), _billingRoleAssignmentsClientDiagnostics, Pipeline, "BillingProfileResource.GetBillingRoleAssignments", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments + /// + /// + /// Operation Id + /// BillingRoleAssignments_ListByBillingProfile + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// The filter query option allows clients to filter a collection of resources that are addressed by a request URL. + /// The top query option requests the number of items in the queried collection to be included in the result. The maximum supported value for top is 50. + /// The skip query option requests the number of items in the queried collection that are to be skipped and not included in the result. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBillingRoleAssignments(string filter = null, long? top = null, long? skip = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _billingRoleAssignmentsRestClient.CreateListByBillingProfileRequest(Id.Parent.Name, Id.Name, filter, top, skip); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingRoleAssignmentsRestClient.CreateListByBillingProfileNextPageRequest(nextLink, Id.Parent.Name, Id.Name, filter, top, skip); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BillingRoleAssignmentData.DeserializeBillingRoleAssignmentData(e), _billingRoleAssignmentsClientDiagnostics, Pipeline, "BillingProfileResource.GetBillingRoleAssignments", "value", "nextLink", cancellationToken); + } + /// /// Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. /// @@ -1287,6 +1211,58 @@ public virtual ArmOperation ResolveByBillingPro } } + /// + /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions + /// + /// + /// Operation Id + /// BillingRoleDefinition_ListByBillingProfile + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetBillingRoleDefinitionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _billingRoleDefinitionRestClient.CreateListByBillingProfileRequest(Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingRoleDefinitionRestClient.CreateListByBillingProfileNextPageRequest(nextLink, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BillingRoleDefinitionData.DeserializeBillingRoleDefinitionData(e), _billingRoleDefinitionClientDiagnostics, Pipeline, "BillingProfileResource.GetBillingRoleDefinitions", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + /// + /// + /// Request Path + /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions + /// + /// + /// Operation Id + /// BillingRoleDefinition_ListByBillingProfile + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetBillingRoleDefinitions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _billingRoleDefinitionRestClient.CreateListByBillingProfileRequest(Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingRoleDefinitionRestClient.CreateListByBillingProfileNextPageRequest(nextLink, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BillingRoleDefinitionData.DeserializeBillingRoleDefinitionData(e), _billingRoleDefinitionClientDiagnostics, Pipeline, "BillingProfileResource.GetBillingRoleDefinitions", "value", "nextLink", cancellationToken); + } + /// /// Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. /// diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleAssignmentCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleAssignmentCollection.cs deleted file mode 100644 index 2f9e4243542d..000000000000 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleAssignmentCollection.cs +++ /dev/null @@ -1,401 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Billing -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetBillingProfileRoleAssignments method from an instance of . - /// - public partial class BillingProfileRoleAssignmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics; - private readonly BillingRoleAssignmentsRestOperations _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient; - - /// Initializes a new instance of the class for mocking. - protected BillingProfileRoleAssignmentCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal BillingProfileRoleAssignmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Billing", BillingProfileRoleAssignmentResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(BillingProfileRoleAssignmentResource.ResourceType, out string billingProfileRoleAssignmentBillingRoleAssignmentsApiVersion); - _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient = new BillingRoleAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, billingProfileRoleAssignmentBillingRoleAssignmentsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != BillingProfileResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, BillingProfileResource.ResourceType), nameof(id)); - } - - /// - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentCollection.Get"); - scope.Start(); - try - { - var response = await _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.GetByBillingProfileAsync(Id.Parent.Name, Id.Name, billingRoleAssignmentName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleAssignmentResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentCollection.Get"); - scope.Start(); - try - { - var response = _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.GetByBillingProfile(Id.Parent.Name, Id.Name, billingRoleAssignmentName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleAssignmentResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments - /// - /// - /// Operation Id - /// BillingRoleAssignments_ListByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The filter query option allows clients to filter a collection of resources that are addressed by a request URL. - /// The top query option requests the number of items in the queried collection to be included in the result. The maximum supported value for top is 50. - /// The skip query option requests the number of items in the queried collection that are to be skipped and not included in the result. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, long? top = null, long? skip = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.CreateListByBillingProfileRequest(Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.CreateListByBillingProfileNextPageRequest(nextLink, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingProfileRoleAssignmentResource(Client, BillingRoleAssignmentData.DeserializeBillingRoleAssignmentData(e)), _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics, Pipeline, "BillingProfileRoleAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments - /// - /// - /// Operation Id - /// BillingRoleAssignments_ListByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The filter query option allows clients to filter a collection of resources that are addressed by a request URL. - /// The top query option requests the number of items in the queried collection to be included in the result. The maximum supported value for top is 50. - /// The skip query option requests the number of items in the queried collection that are to be skipped and not included in the result. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, long? top = null, long? skip = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.CreateListByBillingProfileRequest(Id.Parent.Name, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.CreateListByBillingProfileNextPageRequest(nextLink, Id.Parent.Name, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingProfileRoleAssignmentResource(Client, BillingRoleAssignmentData.DeserializeBillingRoleAssignmentData(e)), _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics, Pipeline, "BillingProfileRoleAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentCollection.Exists"); - scope.Start(); - try - { - var response = await _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.GetByBillingProfileAsync(Id.Parent.Name, Id.Name, billingRoleAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentCollection.Exists"); - scope.Start(); - try - { - var response = _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.GetByBillingProfile(Id.Parent.Name, Id.Name, billingRoleAssignmentName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.GetByBillingProfileAsync(Id.Parent.Name, Id.Name, billingRoleAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleAssignmentResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentCollection.GetIfExists"); - scope.Start(); - try - { - var response = _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.GetByBillingProfile(Id.Parent.Name, Id.Name, billingRoleAssignmentName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleAssignmentResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleAssignmentResource.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleAssignmentResource.Serialization.cs deleted file mode 100644 index b5c0059b24da..000000000000 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleAssignmentResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Billing -{ - public partial class BillingProfileRoleAssignmentResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - BillingRoleAssignmentData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - BillingRoleAssignmentData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleAssignmentResource.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleAssignmentResource.cs deleted file mode 100644 index f08972416c69..000000000000 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleAssignmentResource.cs +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Billing -{ - /// - /// A Class representing a BillingProfileRoleAssignment along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetBillingProfileRoleAssignmentResource method. - /// Otherwise you can get one from its parent resource using the GetBillingProfileRoleAssignment method. - /// - public partial class BillingProfileRoleAssignmentResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The billingAccountName. - /// The billingProfileName. - /// The billingRoleAssignmentName. - public static ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string billingProfileName, string billingRoleAssignmentName) - { - var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics; - private readonly BillingRoleAssignmentsRestOperations _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient; - private readonly BillingRoleAssignmentData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.Billing/billingAccounts/billingProfiles/billingRoleAssignments"; - - /// Initializes a new instance of the class for mocking. - protected BillingProfileRoleAssignmentResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal BillingProfileRoleAssignmentResource(ArmClient client, BillingRoleAssignmentData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal BillingProfileRoleAssignmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Billing", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string billingProfileRoleAssignmentBillingRoleAssignmentsApiVersion); - _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient = new BillingRoleAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, billingProfileRoleAssignmentBillingRoleAssignmentsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual BillingRoleAssignmentData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentResource.Get"); - scope.Start(); - try - { - var response = await _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.GetByBillingProfileAsync(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleAssignmentResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentResource.Get"); - scope.Start(); - try - { - var response = _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.GetByBillingProfile(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleAssignmentResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_DeleteByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentResource.Delete"); - scope.Start(); - try - { - var response = await _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.DeleteByBillingProfileAsync(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.CreateDeleteByBillingProfileRequestUri(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new BillingArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName} - /// - /// - /// Operation Id - /// BillingRoleAssignments_DeleteByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _billingProfileRoleAssignmentBillingRoleAssignmentsClientDiagnostics.CreateScope("BillingProfileRoleAssignmentResource.Delete"); - scope.Start(); - try - { - var response = _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.DeleteByBillingProfile(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _billingProfileRoleAssignmentBillingRoleAssignmentsRestClient.CreateDeleteByBillingProfileRequestUri(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new BillingArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleDefinitionCollection.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleDefinitionCollection.cs deleted file mode 100644 index bac5e53e4a3a..000000000000 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleDefinitionCollection.cs +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Billing -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetBillingProfileRoleDefinitions method from an instance of . - /// - public partial class BillingProfileRoleDefinitionCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics; - private readonly BillingRoleDefinitionRestOperations _billingProfileRoleDefinitionBillingRoleDefinitionRestClient; - - /// Initializes a new instance of the class for mocking. - protected BillingProfileRoleDefinitionCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal BillingProfileRoleDefinitionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Billing", BillingProfileRoleDefinitionResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(BillingProfileRoleDefinitionResource.ResourceType, out string billingProfileRoleDefinitionBillingRoleDefinitionApiVersion); - _billingProfileRoleDefinitionBillingRoleDefinitionRestClient = new BillingRoleDefinitionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, billingProfileRoleDefinitionBillingRoleDefinitionApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != BillingProfileResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, BillingProfileResource.ResourceType), nameof(id)); - } - - /// - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string roleDefinitionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(roleDefinitionName, nameof(roleDefinitionName)); - - using var scope = _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics.CreateScope("BillingProfileRoleDefinitionCollection.Get"); - scope.Start(); - try - { - var response = await _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.GetByBillingProfileAsync(Id.Parent.Name, Id.Name, roleDefinitionName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string roleDefinitionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(roleDefinitionName, nameof(roleDefinitionName)); - - using var scope = _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics.CreateScope("BillingProfileRoleDefinitionCollection.Get"); - scope.Start(); - try - { - var response = _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.GetByBillingProfile(Id.Parent.Name, Id.Name, roleDefinitionName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions - /// - /// - /// Operation Id - /// BillingRoleDefinition_ListByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.CreateListByBillingProfileRequest(Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.CreateListByBillingProfileNextPageRequest(nextLink, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BillingProfileRoleDefinitionResource(Client, BillingRoleDefinitionData.DeserializeBillingRoleDefinitionData(e)), _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics, Pipeline, "BillingProfileRoleDefinitionCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions - /// - /// - /// Operation Id - /// BillingRoleDefinition_ListByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.CreateListByBillingProfileRequest(Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.CreateListByBillingProfileNextPageRequest(nextLink, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BillingProfileRoleDefinitionResource(Client, BillingRoleDefinitionData.DeserializeBillingRoleDefinitionData(e)), _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics, Pipeline, "BillingProfileRoleDefinitionCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string roleDefinitionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(roleDefinitionName, nameof(roleDefinitionName)); - - using var scope = _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics.CreateScope("BillingProfileRoleDefinitionCollection.Exists"); - scope.Start(); - try - { - var response = await _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.GetByBillingProfileAsync(Id.Parent.Name, Id.Name, roleDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string roleDefinitionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(roleDefinitionName, nameof(roleDefinitionName)); - - using var scope = _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics.CreateScope("BillingProfileRoleDefinitionCollection.Exists"); - scope.Start(); - try - { - var response = _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.GetByBillingProfile(Id.Parent.Name, Id.Name, roleDefinitionName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string roleDefinitionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(roleDefinitionName, nameof(roleDefinitionName)); - - using var scope = _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics.CreateScope("BillingProfileRoleDefinitionCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.GetByBillingProfileAsync(Id.Parent.Name, Id.Name, roleDefinitionName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string roleDefinitionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(roleDefinitionName, nameof(roleDefinitionName)); - - using var scope = _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics.CreateScope("BillingProfileRoleDefinitionCollection.GetIfExists"); - scope.Start(); - try - { - var response = _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.GetByBillingProfile(Id.Parent.Name, Id.Name, roleDefinitionName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleDefinitionResource.Serialization.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleDefinitionResource.Serialization.cs deleted file mode 100644 index 40c21a3f0823..000000000000 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleDefinitionResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.Billing -{ - public partial class BillingProfileRoleDefinitionResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - BillingRoleDefinitionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - BillingRoleDefinitionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleDefinitionResource.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleDefinitionResource.cs deleted file mode 100644 index 954c12c91540..000000000000 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingProfileRoleDefinitionResource.cs +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.Billing -{ - /// - /// A Class representing a BillingProfileRoleDefinition along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetBillingProfileRoleDefinitionResource method. - /// Otherwise you can get one from its parent resource using the GetBillingProfileRoleDefinition method. - /// - public partial class BillingProfileRoleDefinitionResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The billingAccountName. - /// The billingProfileName. - /// The roleDefinitionName. - public static ResourceIdentifier CreateResourceIdentifier(string billingAccountName, string billingProfileName, string roleDefinitionName) - { - var resourceId = $"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics; - private readonly BillingRoleDefinitionRestOperations _billingProfileRoleDefinitionBillingRoleDefinitionRestClient; - private readonly BillingRoleDefinitionData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.Billing/billingAccounts/billingProfiles/billingRoleDefinitions"; - - /// Initializes a new instance of the class for mocking. - protected BillingProfileRoleDefinitionResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal BillingProfileRoleDefinitionResource(ArmClient client, BillingRoleDefinitionData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal BillingProfileRoleDefinitionResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Billing", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string billingProfileRoleDefinitionBillingRoleDefinitionApiVersion); - _billingProfileRoleDefinitionBillingRoleDefinitionRestClient = new BillingRoleDefinitionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, billingProfileRoleDefinitionBillingRoleDefinitionApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual BillingRoleDefinitionData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics.CreateScope("BillingProfileRoleDefinitionResource.Get"); - scope.Start(); - try - { - var response = await _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.GetByBillingProfileAsync(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// - /// - /// Request Path - /// /providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName} - /// - /// - /// Operation Id - /// BillingRoleDefinition_GetByBillingProfile - /// - /// - /// Default Api Version - /// 2024-04-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _billingProfileRoleDefinitionBillingRoleDefinitionClientDiagnostics.CreateScope("BillingProfileRoleDefinitionResource.Get"); - scope.Start(); - try - { - var response = _billingProfileRoleDefinitionBillingRoleDefinitionRestClient.GetByBillingProfile(Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new BillingProfileRoleDefinitionResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasData.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasData.cs index f2ca2a3bf83b..cc3300e759a5 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasData.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionAliasData.cs @@ -86,7 +86,7 @@ public BillingSubscriptionAliasData() /// The last month's charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// The current month to date charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// Next billing cycle details of the subscription. - /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts. + /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. /// The category of the product for which the subscription is purchased. Possible values include: AzureSupport, Hardware, ReservationOrder, SaaS, SavingsPlanOrder, Software, UsageBased, Other. /// Type of the product for which the subscription is purchased. /// Id of the product for which the subscription is purchased. @@ -234,7 +234,7 @@ public string NextBillingCycleBillingFrequency get => NextBillingCycleDetails?.NextBillingCycleBillingFrequency; } - /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts. + /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. [WirePath("properties.offerId")] public string OfferId { get; } /// The category of the product for which the subscription is purchased. Possible values include: AzureSupport, Hardware, ReservationOrder, SaaS, SavingsPlanOrder, Software, UsageBased, Other. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionData.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionData.cs index 426009b6bc7c..6a0262fcf6d6 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionData.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/BillingSubscriptionData.cs @@ -86,7 +86,7 @@ public BillingSubscriptionData() /// The last month's charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// The current month to date charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// Next billing cycle details of the subscription. - /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts. + /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. /// The category of the product for which the subscription is purchased. Possible values include: AzureSupport, Hardware, ReservationOrder, SaaS, SavingsPlanOrder, Software, UsageBased, Other. /// Type of the product for which the subscription is purchased. /// Id of the product for which the subscription is purchased. @@ -232,7 +232,7 @@ public string NextBillingCycleBillingFrequency get => NextBillingCycleDetails?.NextBillingCycleBillingFrequency; } - /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts. + /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. [WirePath("properties.offerId")] public string OfferId { get; } /// The category of the product for which the subscription is purchased. Possible values include: AzureSupport, Hardware, ReservationOrder, SaaS, SavingsPlanOrder, Software, UsageBased, Other. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/BillingExtensions.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/BillingExtensions.cs index cb1667c7197a..e7f5af10ab5e 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/BillingExtensions.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/BillingExtensions.cs @@ -148,25 +148,6 @@ public static BillingRequestResource GetBillingRequestResource(this ArmClient cl return GetMockableBillingArmClient(client).GetBillingRequestResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static BillingProfileRoleAssignmentResource GetBillingProfileRoleAssignmentResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableBillingArmClient(client).GetBillingProfileRoleAssignmentResource(id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -262,25 +243,6 @@ public static BillingEnrollmentAccountRoleAssignmentResource GetBillingEnrollmen return GetMockableBillingArmClient(client).GetBillingEnrollmentAccountRoleAssignmentResource(id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static BillingProfileRoleDefinitionResource GetBillingProfileRoleDefinitionResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableBillingArmClient(client).GetBillingProfileRoleDefinitionResource(id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingArmClient.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingArmClient.cs index ef46480f6189..0ed794ed0f9d 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingArmClient.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/MockableBillingArmClient.cs @@ -106,18 +106,6 @@ public virtual BillingRequestResource GetBillingRequestResource(ResourceIdentifi return new BillingRequestResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual BillingProfileRoleAssignmentResource GetBillingProfileRoleAssignmentResource(ResourceIdentifier id) - { - BillingProfileRoleAssignmentResource.ValidateResourceId(id); - return new BillingProfileRoleAssignmentResource(Client, id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -178,18 +166,6 @@ public virtual BillingEnrollmentAccountRoleAssignmentResource GetBillingEnrollme return new BillingEnrollmentAccountRoleAssignmentResource(Client, id); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual BillingProfileRoleDefinitionResource GetBillingProfileRoleDefinitionResource(ResourceIdentifier id) - { - BillingProfileRoleDefinitionResource.ValidateResourceId(id); - return new BillingProfileRoleDefinitionResource(Client, id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionPatch.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionPatch.cs index 892a129eaa03..2250d5215a2a 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionPatch.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Models/BillingSubscriptionPatch.cs @@ -82,7 +82,7 @@ public BillingSubscriptionPatch() /// The last month's charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// The current month to date charges. This field is only available for usage based subscriptions of Microsoft Customer Agreement billing accounts. /// Next billing cycle details of the subscription. - /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts. + /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. /// The category of the product for which the subscription is purchased. Possible values include: AzureSupport, Hardware, ReservationOrder, SaaS, SavingsPlanOrder, Software, UsageBased, Other. /// Type of the product for which the subscription is purchased. /// Id of the product for which the subscription is purchased. @@ -228,7 +228,7 @@ public string NextBillingCycleBillingFrequency get => NextBillingCycleDetails?.NextBillingCycleBillingFrequency; } - /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts. + /// The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. [WirePath("properties.offerId")] public string OfferId { get; } /// The category of the product for which the subscription is purchased. Possible values include: AzureSupport, Hardware, ReservationOrder, SaaS, SavingsPlanOrder, Software, UsageBased, Other. diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingRoleAssignmentsRestOperations.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingRoleAssignmentsRestOperations.cs index 872a5a0dae08..e0aad6a8521c 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingRoleAssignmentsRestOperations.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingRoleAssignmentsRestOperations.cs @@ -36,186 +36,6 @@ public BillingRoleAssignmentsRestOperations(HttpPipeline pipeline, string applic _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateDeleteByBillingProfileRequestUri(string billingAccountName, string billingProfileName, string billingRoleAssignmentName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteByBillingProfileRequest(string billingAccountName, string billingProfileName, string billingRoleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Deletes a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteByBillingProfileAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var message = CreateDeleteByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response DeleteByBillingProfile(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var message = CreateDeleteByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetByBillingProfileRequestUri(string billingAccountName, string billingProfileName, string billingRoleAssignmentName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetByBillingProfileRequest(string billingAccountName, string billingProfileName, string billingRoleAssignmentName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleAssignments/", false); - uri.AppendPath(billingRoleAssignmentName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetByBillingProfileAsync(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleAssignmentName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleAssignmentData.DeserializeBillingRoleAssignmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((BillingRoleAssignmentData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role assignment. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response GetByBillingProfile(string billingAccountName, string billingProfileName, string billingRoleAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(billingRoleAssignmentName, nameof(billingRoleAssignmentName)); - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName, billingRoleAssignmentName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleAssignmentData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleAssignmentData.DeserializeBillingRoleAssignmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((BillingRoleAssignmentData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - internal RequestUriBuilder CreateListByBillingProfileRequestUri(string billingAccountName, string billingProfileName, string filter, long? top, long? skip) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingRoleDefinitionRestOperations.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingRoleDefinitionRestOperations.cs index f5b96d6ccf79..fe06c9f40ee6 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingRoleDefinitionRestOperations.cs +++ b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/RestOperations/BillingRoleDefinitionRestOperations.cs @@ -36,102 +36,6 @@ public BillingRoleDefinitionRestOperations(HttpPipeline pipeline, string applica _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetByBillingProfileRequestUri(string billingAccountName, string billingProfileName, string roleDefinitionName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleDefinitions/", false); - uri.AppendPath(roleDefinitionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetByBillingProfileRequest(string billingAccountName, string billingProfileName, string roleDefinitionName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Billing/billingAccounts/", false); - uri.AppendPath(billingAccountName, true); - uri.AppendPath("/billingProfiles/", false); - uri.AppendPath(billingProfileName, true); - uri.AppendPath("/billingRoleDefinitions/", false); - uri.AppendPath(roleDefinitionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetByBillingProfileAsync(string billingAccountName, string billingProfileName, string roleDefinitionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(roleDefinitionName, nameof(roleDefinitionName)); - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName, roleDefinitionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = BillingRoleDefinitionData.DeserializeBillingRoleDefinitionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((BillingRoleDefinitionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. - /// The ID that uniquely identifies a billing account. - /// The ID that uniquely identifies a billing profile. - /// The ID that uniquely identifies a role definition. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response GetByBillingProfile(string billingAccountName, string billingProfileName, string roleDefinitionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(billingAccountName, nameof(billingAccountName)); - Argument.AssertNotNullOrEmpty(billingProfileName, nameof(billingProfileName)); - Argument.AssertNotNullOrEmpty(roleDefinitionName, nameof(roleDefinitionName)); - - using var message = CreateGetByBillingProfileRequest(billingAccountName, billingProfileName, roleDefinitionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - BillingRoleDefinitionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = BillingRoleDefinitionData.DeserializeBillingRoleDefinitionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((BillingRoleDefinitionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - internal RequestUriBuilder CreateListByBillingProfileRequestUri(string billingAccountName, string billingProfileName) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/billing/Azure.ResourceManager.Billing/src/autorest.md b/sdk/billing/Azure.ResourceManager.Billing/src/autorest.md index faf9ec9a87a4..33ed25dca826 100644 --- a/sdk/billing/Azure.ResourceManager.Billing/src/autorest.md +++ b/sdk/billing/Azure.ResourceManager.Billing/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: Billing namespace: Azure.ResourceManager.Billing -require: https://github.com/Azure/azure-rest-api-specs/blob/7dc76b4edb665c8f9e0c7b7c0aaf2f34f8b25833/specification/billing/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/billing/resource-manager/readme.md #tag: package-2024-04 output-folder: $(this-folder)/Generated clear-output-folder: true diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.net8.0.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.net8.0.cs index a255dd231bcc..531e35da8c07 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.net8.0.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.net8.0.cs @@ -76,34 +76,6 @@ protected DeletedManagedHsmResource() { } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class KeyVaultCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected KeyVaultCollection() { } - public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string vaultName, Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string vaultName, Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Exists(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class KeyVaultData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KeyVaultData(Azure.Core.AzureLocation location, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties) { } - public Azure.ResourceManager.KeyVault.Models.KeyVaultProperties Properties { get { throw null; } set { } } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.KeyVaultData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.KeyVaultData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public static partial class KeyVaultExtensions { public static Azure.Response CheckKeyVaultNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.KeyVault.Models.KeyVaultNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -122,14 +94,14 @@ public static partial class KeyVaultExtensions public static Azure.ResourceManager.KeyVault.DeletedManagedHsmCollection GetDeletedManagedHsms(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } public static Azure.Pageable GetDeletedManagedHsms(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetDeletedManagedHsmsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetKeyVault(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetKeyVaultAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetKeyVaultPrivateEndpointConnection(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetKeyVaultPrivateEndpointConnectionAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.KeyVault.KeyVaultResource GetKeyVaultResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.KeyVault.KeyVaultCollection GetKeyVaults(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } - public static Azure.Pageable GetKeyVaults(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetKeyVaultsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName) { throw null; } + public static Azure.Response GetKeyVaultSecret(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetKeyVaultSecretAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.KeyVault.KeyVaultSecretResource GetKeyVaultSecretResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.KeyVault.KeyVaultSecretCollection GetKeyVaultSecrets(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName) { throw null; } public static Azure.Response GetManagedHsm(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetManagedHsmAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.KeyVault.ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -137,6 +109,14 @@ public static partial class KeyVaultExtensions public static Azure.ResourceManager.KeyVault.ManagedHsmCollection GetManagedHsms(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetManagedHsms(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetManagedHsmsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetPrivateLinkResourcesByVault(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetPrivateLinkResourcesByVaultAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetVaultsByResourceGroup(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetVaultsByResourceGroupAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetVaultsBySubscription(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetVaultsBySubscriptionAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response UpdateAccessPolicyVault(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> UpdateAccessPolicyVaultAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class KeyVaultPrivateEndpointConnectionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -208,41 +188,6 @@ protected KeyVaultPrivateEndpointConnectionResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class KeyVaultResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public static readonly Azure.Core.ResourceType ResourceType; - protected KeyVaultResource() { } - public virtual Azure.ResourceManager.KeyVault.KeyVaultData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetKeyVaultPrivateEndpointConnection(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetKeyVaultPrivateEndpointConnectionAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections() { throw null; } - public virtual Azure.Response GetKeyVaultSecret(string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetKeyVaultSecretAsync(string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.KeyVault.KeyVaultSecretCollection GetKeyVaultSecrets() { throw null; } - public virtual Azure.Pageable GetPrivateLinkResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetPrivateLinkResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - Azure.ResourceManager.KeyVault.KeyVaultData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.KeyVaultData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - public virtual Azure.Response Update(Azure.ResourceManager.KeyVault.Models.KeyVaultPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateAccessPolicy(Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateAccessPolicyAsync(Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.KeyVault.Models.KeyVaultPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class KeyVaultSecretCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected KeyVaultSecretCollection() { } @@ -419,7 +364,6 @@ protected MockableKeyVaultArmClient() { } public virtual Azure.ResourceManager.KeyVault.DeletedKeyVaultResource GetDeletedKeyVaultResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.DeletedManagedHsmResource GetDeletedManagedHsmResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } - public virtual Azure.ResourceManager.KeyVault.KeyVaultResource GetKeyVaultResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.KeyVaultSecretResource GetKeyVaultSecretResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.ManagedHsmResource GetManagedHsmResource(Azure.Core.ResourceIdentifier id) { throw null; } @@ -427,12 +371,21 @@ protected MockableKeyVaultArmClient() { } public partial class MockableKeyVaultResourceGroupResource : Azure.ResourceManager.ArmResource { protected MockableKeyVaultResourceGroupResource() { } - public virtual Azure.Response GetKeyVault(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetKeyVaultAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.KeyVault.KeyVaultCollection GetKeyVaults() { throw null; } + public virtual Azure.Response GetKeyVaultPrivateEndpointConnection(string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKeyVaultPrivateEndpointConnectionAsync(string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections(string vaultName) { throw null; } + public virtual Azure.Response GetKeyVaultSecret(string vaultName, string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKeyVaultSecretAsync(string vaultName, string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KeyVault.KeyVaultSecretCollection GetKeyVaultSecrets(string vaultName) { throw null; } public virtual Azure.Response GetManagedHsm(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetManagedHsmAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.KeyVault.ManagedHsmCollection GetManagedHsms() { throw null; } + public virtual Azure.Pageable GetPrivateLinkResourcesByVault(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPrivateLinkResourcesByVaultAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVaultsByResourceGroup(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVaultsByResourceGroupAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateAccessPolicyVault(string vaultName, Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAccessPolicyVaultAsync(string vaultName, Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MockableKeyVaultSubscriptionResource : Azure.ResourceManager.ArmResource { @@ -451,10 +404,10 @@ protected MockableKeyVaultSubscriptionResource() { } public virtual Azure.ResourceManager.KeyVault.DeletedManagedHsmCollection GetDeletedManagedHsms() { throw null; } public virtual Azure.Pageable GetDeletedManagedHsms(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDeletedManagedHsmsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetKeyVaults(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetKeyVaultsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetManagedHsms(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetManagedHsmsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVaultsBySubscription(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVaultsBySubscriptionAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.KeyVault.Models @@ -471,9 +424,8 @@ public static partial class ArmKeyVaultModelFactory public static Azure.ResourceManager.KeyVault.Models.DeletedKeyVaultProperties DeletedKeyVaultProperties(Azure.Core.ResourceIdentifier vaultId = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledPurgeOn = default(System.DateTimeOffset?), System.Collections.Generic.IReadOnlyDictionary tags = null, bool? purgeProtectionEnabled = default(bool?)) { throw null; } public static Azure.ResourceManager.KeyVault.DeletedManagedHsmData DeletedManagedHsmData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.KeyVault.Models.DeletedManagedHsmProperties properties = null) { throw null; } public static Azure.ResourceManager.KeyVault.Models.DeletedManagedHsmProperties DeletedManagedHsmProperties(Azure.Core.ResourceIdentifier managedHsmId = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledPurgeOn = default(System.DateTimeOffset?), bool? purgeProtectionEnabled = default(bool?), System.Collections.Generic.IReadOnlyDictionary tags = null) { throw null; } + public static Azure.ResourceManager.KeyVault.Models.KeyVault KeyVault(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties = null) { throw null; } public static Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters KeyVaultAccessPolicyParameters(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IEnumerable accessPolicies = null) { throw null; } - public static Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent KeyVaultCreateOrUpdateContent(Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties = null) { throw null; } - public static Azure.ResourceManager.KeyVault.KeyVaultData KeyVaultData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties = null) { throw null; } public static Azure.ResourceManager.KeyVault.Models.KeyVaultNameAvailabilityContent KeyVaultNameAvailabilityContent(string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType)) { throw null; } public static Azure.ResourceManager.KeyVault.Models.KeyVaultNameAvailabilityResult KeyVaultNameAvailabilityResult(bool? nameAvailable = default(bool?), Azure.ResourceManager.KeyVault.Models.KeyVaultNameUnavailableReason? reason = default(Azure.ResourceManager.KeyVault.Models.KeyVaultNameUnavailableReason?), string message = null) { throw null; } public static Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionData KeyVaultPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.KeyVault.Models.KeyVaultPrivateLinkServiceConnectionState connectionState = null, Azure.ResourceManager.KeyVault.Models.KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.KeyVault.Models.KeyVaultPrivateEndpointConnectionProvisioningState?), Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IReadOnlyDictionary tags = null) { throw null; } @@ -678,6 +630,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.KeyVault.Models.IdentityAccessStoragePermission left, Azure.ResourceManager.KeyVault.Models.IdentityAccessStoragePermission right) { throw null; } public override string ToString() { throw null; } } + public partial class KeyVault : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVault(Azure.Core.AzureLocation location, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties) { } + public Azure.ResourceManager.KeyVault.Models.KeyVaultProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.KeyVault.Models.KeyVault System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.KeyVault.Models.KeyVault System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class KeyVaultAccessPolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public KeyVaultAccessPolicy(System.Guid tenantId, string objectId, Azure.ResourceManager.KeyVault.Models.IdentityAccessPermissions permissions) { } @@ -737,19 +700,6 @@ public enum KeyVaultCreateMode Default = 0, Recover = 1, } - public partial class KeyVaultCreateOrUpdateContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KeyVaultCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties) { } - public Azure.Core.AzureLocation Location { get { throw null; } } - public Azure.ResourceManager.KeyVault.Models.KeyVaultProperties Properties { get { throw null; } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class KeyVaultIPRule : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public KeyVaultIPRule(string addressRange) { } @@ -841,46 +791,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class KeyVaultPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KeyVaultPatch() { } - public Azure.ResourceManager.KeyVault.Models.KeyVaultPatchProperties Properties { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public enum KeyVaultPatchMode - { - Default = 0, - Recover = 1, - } - public partial class KeyVaultPatchProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KeyVaultPatchProperties() { } - public System.Collections.Generic.IList AccessPolicies { get { throw null; } } - public Azure.ResourceManager.KeyVault.Models.KeyVaultPatchMode? CreateMode { get { throw null; } set { } } - public bool? EnabledForDeployment { get { throw null; } set { } } - public bool? EnabledForDiskEncryption { get { throw null; } set { } } - public bool? EnabledForTemplateDeployment { get { throw null; } set { } } - public bool? EnablePurgeProtection { get { throw null; } set { } } - public bool? EnableRbacAuthorization { get { throw null; } set { } } - public bool? EnableSoftDelete { get { throw null; } set { } } - public Azure.ResourceManager.KeyVault.Models.KeyVaultNetworkRuleSet NetworkRuleSet { get { throw null; } set { } } - public string PublicNetworkAccess { get { throw null; } set { } } - public Azure.ResourceManager.KeyVault.Models.KeyVaultSku Sku { get { throw null; } set { } } - public int? SoftDeleteRetentionInDays { get { throw null; } set { } } - public System.Guid? TenantId { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultPatchProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultPatchProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class KeyVaultPrivateEndpointConnectionItemData : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal KeyVaultPrivateEndpointConnectionItemData() { } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs index a255dd231bcc..531e35da8c07 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs @@ -76,34 +76,6 @@ protected DeletedManagedHsmResource() { } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class KeyVaultCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected KeyVaultCollection() { } - public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string vaultName, Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string vaultName, Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Exists(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class KeyVaultData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KeyVaultData(Azure.Core.AzureLocation location, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties) { } - public Azure.ResourceManager.KeyVault.Models.KeyVaultProperties Properties { get { throw null; } set { } } - protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.KeyVaultData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.KeyVaultData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public static partial class KeyVaultExtensions { public static Azure.Response CheckKeyVaultNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.KeyVault.Models.KeyVaultNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -122,14 +94,14 @@ public static partial class KeyVaultExtensions public static Azure.ResourceManager.KeyVault.DeletedManagedHsmCollection GetDeletedManagedHsms(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } public static Azure.Pageable GetDeletedManagedHsms(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetDeletedManagedHsmsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetKeyVault(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetKeyVaultAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetKeyVaultPrivateEndpointConnection(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetKeyVaultPrivateEndpointConnectionAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.KeyVault.KeyVaultResource GetKeyVaultResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.KeyVault.KeyVaultCollection GetKeyVaults(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } - public static Azure.Pageable GetKeyVaults(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetKeyVaultsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName) { throw null; } + public static Azure.Response GetKeyVaultSecret(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetKeyVaultSecretAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.KeyVault.KeyVaultSecretResource GetKeyVaultSecretResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.KeyVault.KeyVaultSecretCollection GetKeyVaultSecrets(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName) { throw null; } public static Azure.Response GetManagedHsm(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetManagedHsmAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.KeyVault.ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -137,6 +109,14 @@ public static partial class KeyVaultExtensions public static Azure.ResourceManager.KeyVault.ManagedHsmCollection GetManagedHsms(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetManagedHsms(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetManagedHsmsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetPrivateLinkResourcesByVault(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetPrivateLinkResourcesByVaultAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetVaultsByResourceGroup(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetVaultsByResourceGroupAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetVaultsBySubscription(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetVaultsBySubscriptionAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response UpdateAccessPolicyVault(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> UpdateAccessPolicyVaultAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class KeyVaultPrivateEndpointConnectionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -208,41 +188,6 @@ protected KeyVaultPrivateEndpointConnectionResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class KeyVaultResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public static readonly Azure.Core.ResourceType ResourceType; - protected KeyVaultResource() { } - public virtual Azure.ResourceManager.KeyVault.KeyVaultData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetKeyVaultPrivateEndpointConnection(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetKeyVaultPrivateEndpointConnectionAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections() { throw null; } - public virtual Azure.Response GetKeyVaultSecret(string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetKeyVaultSecretAsync(string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.KeyVault.KeyVaultSecretCollection GetKeyVaultSecrets() { throw null; } - public virtual Azure.Pageable GetPrivateLinkResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetPrivateLinkResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - Azure.ResourceManager.KeyVault.KeyVaultData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.KeyVaultData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - public virtual Azure.Response Update(Azure.ResourceManager.KeyVault.Models.KeyVaultPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateAccessPolicy(Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateAccessPolicyAsync(Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.KeyVault.Models.KeyVaultPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class KeyVaultSecretCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected KeyVaultSecretCollection() { } @@ -419,7 +364,6 @@ protected MockableKeyVaultArmClient() { } public virtual Azure.ResourceManager.KeyVault.DeletedKeyVaultResource GetDeletedKeyVaultResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.DeletedManagedHsmResource GetDeletedManagedHsmResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionResource GetKeyVaultPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } - public virtual Azure.ResourceManager.KeyVault.KeyVaultResource GetKeyVaultResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.KeyVaultSecretResource GetKeyVaultSecretResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.ManagedHsmPrivateEndpointConnectionResource GetManagedHsmPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.KeyVault.ManagedHsmResource GetManagedHsmResource(Azure.Core.ResourceIdentifier id) { throw null; } @@ -427,12 +371,21 @@ protected MockableKeyVaultArmClient() { } public partial class MockableKeyVaultResourceGroupResource : Azure.ResourceManager.ArmResource { protected MockableKeyVaultResourceGroupResource() { } - public virtual Azure.Response GetKeyVault(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetKeyVaultAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.KeyVault.KeyVaultCollection GetKeyVaults() { throw null; } + public virtual Azure.Response GetKeyVaultPrivateEndpointConnection(string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKeyVaultPrivateEndpointConnectionAsync(string vaultName, string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections(string vaultName) { throw null; } + public virtual Azure.Response GetKeyVaultSecret(string vaultName, string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKeyVaultSecretAsync(string vaultName, string secretName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.KeyVault.KeyVaultSecretCollection GetKeyVaultSecrets(string vaultName) { throw null; } public virtual Azure.Response GetManagedHsm(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetManagedHsmAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.KeyVault.ManagedHsmCollection GetManagedHsms() { throw null; } + public virtual Azure.Pageable GetPrivateLinkResourcesByVault(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPrivateLinkResourcesByVaultAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVaultsByResourceGroup(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVaultsByResourceGroupAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateAccessPolicyVault(string vaultName, Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAccessPolicyVaultAsync(string vaultName, Azure.ResourceManager.KeyVault.Models.AccessPolicyUpdateKind operationKind, Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MockableKeyVaultSubscriptionResource : Azure.ResourceManager.ArmResource { @@ -451,10 +404,10 @@ protected MockableKeyVaultSubscriptionResource() { } public virtual Azure.ResourceManager.KeyVault.DeletedManagedHsmCollection GetDeletedManagedHsms() { throw null; } public virtual Azure.Pageable GetDeletedManagedHsms(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDeletedManagedHsmsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetKeyVaults(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetKeyVaultsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetManagedHsms(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetManagedHsmsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetVaultsBySubscription(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetVaultsBySubscriptionAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.KeyVault.Models @@ -471,9 +424,8 @@ public static partial class ArmKeyVaultModelFactory public static Azure.ResourceManager.KeyVault.Models.DeletedKeyVaultProperties DeletedKeyVaultProperties(Azure.Core.ResourceIdentifier vaultId = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledPurgeOn = default(System.DateTimeOffset?), System.Collections.Generic.IReadOnlyDictionary tags = null, bool? purgeProtectionEnabled = default(bool?)) { throw null; } public static Azure.ResourceManager.KeyVault.DeletedManagedHsmData DeletedManagedHsmData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.KeyVault.Models.DeletedManagedHsmProperties properties = null) { throw null; } public static Azure.ResourceManager.KeyVault.Models.DeletedManagedHsmProperties DeletedManagedHsmProperties(Azure.Core.ResourceIdentifier managedHsmId = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledPurgeOn = default(System.DateTimeOffset?), bool? purgeProtectionEnabled = default(bool?), System.Collections.Generic.IReadOnlyDictionary tags = null) { throw null; } + public static Azure.ResourceManager.KeyVault.Models.KeyVault KeyVault(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties = null) { throw null; } public static Azure.ResourceManager.KeyVault.Models.KeyVaultAccessPolicyParameters KeyVaultAccessPolicyParameters(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IEnumerable accessPolicies = null) { throw null; } - public static Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent KeyVaultCreateOrUpdateContent(Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties = null) { throw null; } - public static Azure.ResourceManager.KeyVault.KeyVaultData KeyVaultData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties = null) { throw null; } public static Azure.ResourceManager.KeyVault.Models.KeyVaultNameAvailabilityContent KeyVaultNameAvailabilityContent(string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType)) { throw null; } public static Azure.ResourceManager.KeyVault.Models.KeyVaultNameAvailabilityResult KeyVaultNameAvailabilityResult(bool? nameAvailable = default(bool?), Azure.ResourceManager.KeyVault.Models.KeyVaultNameUnavailableReason? reason = default(Azure.ResourceManager.KeyVault.Models.KeyVaultNameUnavailableReason?), string message = null) { throw null; } public static Azure.ResourceManager.KeyVault.KeyVaultPrivateEndpointConnectionData KeyVaultPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.KeyVault.Models.KeyVaultPrivateLinkServiceConnectionState connectionState = null, Azure.ResourceManager.KeyVault.Models.KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.KeyVault.Models.KeyVaultPrivateEndpointConnectionProvisioningState?), Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IReadOnlyDictionary tags = null) { throw null; } @@ -678,6 +630,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.KeyVault.Models.IdentityAccessStoragePermission left, Azure.ResourceManager.KeyVault.Models.IdentityAccessStoragePermission right) { throw null; } public override string ToString() { throw null; } } + public partial class KeyVault : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVault(Azure.Core.AzureLocation location, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties) { } + public Azure.ResourceManager.KeyVault.Models.KeyVaultProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.KeyVault.Models.KeyVault System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.KeyVault.Models.KeyVault System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class KeyVaultAccessPolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public KeyVaultAccessPolicy(System.Guid tenantId, string objectId, Azure.ResourceManager.KeyVault.Models.IdentityAccessPermissions permissions) { } @@ -737,19 +700,6 @@ public enum KeyVaultCreateMode Default = 0, Recover = 1, } - public partial class KeyVaultCreateOrUpdateContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KeyVaultCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.KeyVault.Models.KeyVaultProperties properties) { } - public Azure.Core.AzureLocation Location { get { throw null; } } - public Azure.ResourceManager.KeyVault.Models.KeyVaultProperties Properties { get { throw null; } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultCreateOrUpdateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class KeyVaultIPRule : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public KeyVaultIPRule(string addressRange) { } @@ -841,46 +791,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class KeyVaultPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KeyVaultPatch() { } - public Azure.ResourceManager.KeyVault.Models.KeyVaultPatchProperties Properties { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } - public enum KeyVaultPatchMode - { - Default = 0, - Recover = 1, - } - public partial class KeyVaultPatchProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel - { - public KeyVaultPatchProperties() { } - public System.Collections.Generic.IList AccessPolicies { get { throw null; } } - public Azure.ResourceManager.KeyVault.Models.KeyVaultPatchMode? CreateMode { get { throw null; } set { } } - public bool? EnabledForDeployment { get { throw null; } set { } } - public bool? EnabledForDiskEncryption { get { throw null; } set { } } - public bool? EnabledForTemplateDeployment { get { throw null; } set { } } - public bool? EnablePurgeProtection { get { throw null; } set { } } - public bool? EnableRbacAuthorization { get { throw null; } set { } } - public bool? EnableSoftDelete { get { throw null; } set { } } - public Azure.ResourceManager.KeyVault.Models.KeyVaultNetworkRuleSet NetworkRuleSet { get { throw null; } set { } } - public string PublicNetworkAccess { get { throw null; } set { } } - public Azure.ResourceManager.KeyVault.Models.KeyVaultSku Sku { get { throw null; } set { } } - public int? SoftDeleteRetentionInDays { get { throw null; } set { } } - public System.Guid? TenantId { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultPatchProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.KeyVault.Models.KeyVaultPatchProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - } public partial class KeyVaultPrivateEndpointConnectionItemData : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal KeyVaultPrivateEndpointConnectionItemData() { } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs index 3bb0cefc3c20..24b23d73b150 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultPrivateEndpointConnectionCollection.cs @@ -10,6 +10,7 @@ using Azure.Core; using Azure.Identity; using Azure.ResourceManager.KeyVault.Models; +using Azure.ResourceManager.Resources; using NUnit.Framework; namespace Azure.ResourceManager.KeyVault.Samples @@ -28,16 +29,16 @@ public async Task CreateOrUpdate_KeyVaultPutPrivateEndpointConnection() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultPrivateEndpointConnectionResource - KeyVaultPrivateEndpointConnectionCollection collection = keyVault.GetKeyVaultPrivateEndpointConnections(); + string vaultName = "sample-vault"; + KeyVaultPrivateEndpointConnectionCollection collection = resourceGroupResource.GetKeyVaultPrivateEndpointConnections(vaultName); // invoke the operation string privateEndpointConnectionName = "sample-pec"; @@ -72,16 +73,16 @@ public async Task Get_KeyVaultGetPrivateEndpointConnection() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultPrivateEndpointConnectionResource - KeyVaultPrivateEndpointConnectionCollection collection = keyVault.GetKeyVaultPrivateEndpointConnections(); + string vaultName = "sample-vault"; + KeyVaultPrivateEndpointConnectionCollection collection = resourceGroupResource.GetKeyVaultPrivateEndpointConnections(vaultName); // invoke the operation string privateEndpointConnectionName = "sample-pec"; @@ -106,16 +107,16 @@ public async Task GetAll_KeyVaultListPrivateEndpointConnection() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultPrivateEndpointConnectionResource - KeyVaultPrivateEndpointConnectionCollection collection = keyVault.GetKeyVaultPrivateEndpointConnections(); + string vaultName = "sample-vault"; + KeyVaultPrivateEndpointConnectionCollection collection = resourceGroupResource.GetKeyVaultPrivateEndpointConnections(vaultName); // invoke the operation and iterate over the result await foreach (KeyVaultPrivateEndpointConnectionResource item in collection.GetAllAsync()) @@ -142,16 +143,16 @@ public async Task Exists_KeyVaultGetPrivateEndpointConnection() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultPrivateEndpointConnectionResource - KeyVaultPrivateEndpointConnectionCollection collection = keyVault.GetKeyVaultPrivateEndpointConnections(); + string vaultName = "sample-vault"; + KeyVaultPrivateEndpointConnectionCollection collection = resourceGroupResource.GetKeyVaultPrivateEndpointConnections(vaultName); // invoke the operation string privateEndpointConnectionName = "sample-pec"; @@ -172,16 +173,16 @@ public async Task GetIfExists_KeyVaultGetPrivateEndpointConnection() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultPrivateEndpointConnectionResource - KeyVaultPrivateEndpointConnectionCollection collection = keyVault.GetKeyVaultPrivateEndpointConnections(); + string vaultName = "sample-vault"; + KeyVaultPrivateEndpointConnectionCollection collection = resourceGroupResource.GetKeyVaultPrivateEndpointConnections(vaultName); // invoke the operation string privateEndpointConnectionName = "sample-pec"; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs index b910dd73da4e..7c48e148e802 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_KeyVaultSecretCollection.cs @@ -10,6 +10,7 @@ using Azure.Core; using Azure.Identity; using Azure.ResourceManager.KeyVault.Models; +using Azure.ResourceManager.Resources; using NUnit.Framework; namespace Azure.ResourceManager.KeyVault.Samples @@ -28,16 +29,16 @@ public async Task CreateOrUpdate_CreateASecret() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultSecretResource - KeyVaultSecretCollection collection = keyVault.GetKeyVaultSecrets(); + string vaultName = "sample-vault"; + KeyVaultSecretCollection collection = resourceGroupResource.GetKeyVaultSecrets(vaultName); // invoke the operation string secretName = "secret-name"; @@ -67,16 +68,16 @@ public async Task Get_GetASecret() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultSecretResource - KeyVaultSecretCollection collection = keyVault.GetKeyVaultSecrets(); + string vaultName = "sample-vault"; + KeyVaultSecretCollection collection = resourceGroupResource.GetKeyVaultSecrets(vaultName); // invoke the operation string secretName = "secret-name"; @@ -101,16 +102,16 @@ public async Task GetAll_ListSecretsInTheVault() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultSecretResource - KeyVaultSecretCollection collection = keyVault.GetKeyVaultSecrets(); + string vaultName = "sample-vault"; + KeyVaultSecretCollection collection = resourceGroupResource.GetKeyVaultSecrets(vaultName); // invoke the operation and iterate over the result await foreach (KeyVaultSecretResource item in collection.GetAllAsync()) @@ -137,16 +138,16 @@ public async Task Exists_GetASecret() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultSecretResource - KeyVaultSecretCollection collection = keyVault.GetKeyVaultSecrets(); + string vaultName = "sample-vault"; + KeyVaultSecretCollection collection = resourceGroupResource.GetKeyVaultSecrets(vaultName); // invoke the operation string secretName = "secret-name"; @@ -167,16 +168,16 @@ public async Task GetIfExists_GetASecret() // authenticate your client ArmClient client = new ArmClient(cred); - // this example assumes you already have this KeyVaultResource created on azure - // for more information of creating KeyVaultResource, please refer to the document of KeyVaultResource + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "sample-group"; - string vaultName = "sample-vault"; - ResourceIdentifier keyVaultResourceId = KeyVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); - KeyVaultResource keyVault = client.GetKeyVaultResource(keyVaultResourceId); + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); // get the collection of this KeyVaultSecretResource - KeyVaultSecretCollection collection = keyVault.GetKeyVaultSecrets(); + string vaultName = "sample-vault"; + KeyVaultSecretCollection collection = resourceGroupResource.GetKeyVaultSecrets(vaultName); // invoke the operation string secretName = "secret-name"; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs new file mode 100644 index 000000000000..62b632cacec5 --- /dev/null +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.KeyVault.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.KeyVault.Samples +{ + public partial class Sample_ResourceGroupResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task UpdateAccessPolicyVault_AddAnAccessPolicyOrUpdateAnAccessPolicyWithNewPermissions() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/updateAccessPoliciesAdd.json + // this example is just showing the usage of "Vaults_UpdateAccessPolicy" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "sample-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // invoke the operation + string vaultName = "sample-vault"; + AccessPolicyUpdateKind operationKind = AccessPolicyUpdateKind.Add; + KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters = new KeyVaultAccessPolicyParameters(new KeyVaultAccessPolicyProperties(new KeyVaultAccessPolicy[] + { +new KeyVaultAccessPolicy(Guid.Parse("00000000-0000-0000-0000-000000000000"), "00000000-0000-0000-0000-000000000000", new IdentityAccessPermissions +{ +Keys = {IdentityAccessKeyPermission.Encrypt}, +Secrets = {IdentityAccessSecretPermission.Get}, +Certificates = {IdentityAccessCertificatePermission.Get}, +}) + })); + KeyVaultAccessPolicyParameters result = await resourceGroupResource.UpdateAccessPolicyVaultAsync(vaultName, operationKind, keyVaultAccessPolicyParameters); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetVaultsByResourceGroup_ListVaultsInTheSpecifiedResourceGroup() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listVaultByResourceGroup.json + // this example is just showing the usage of "Vaults_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "sample-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // invoke the operation and iterate over the result + int? top = 1; + await foreach (Models.KeyVault item in resourceGroupResource.GetVaultsByResourceGroupAsync(top: top)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetPrivateLinkResourcesByVault_KeyVaultListPrivateLinkResources() + { + // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listPrivateLinkResources.json + // this example is just showing the usage of "PrivateLinkResources_ListByVault" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "sample-group"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // invoke the operation and iterate over the result + string vaultName = "sample-vault"; + await foreach (KeyVaultPrivateLinkResourceData item in resourceGroupResource.GetPrivateLinkResourcesByVaultAsync(vaultName)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index c312e821476a..05574c7ebc08 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -19,7 +19,7 @@ public partial class Sample_SubscriptionResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task GetKeyVaults_ListVaultsInTheSpecifiedSubscription() + public async Task GetVaultsBySubscription_ListVaultsInTheSpecifiedSubscription() { // Generated from example definition: specification/keyvault/resource-manager/Microsoft.KeyVault/stable/2023-07-01/examples/listVaultBySubscription.json // this example is just showing the usage of "Vaults_ListBySubscription" operation, for the dependent resources, they will have to be created separately. @@ -37,13 +37,9 @@ public async Task GetKeyVaults_ListVaultsInTheSpecifiedSubscription() // invoke the operation and iterate over the result int? top = 1; - await foreach (KeyVaultResource item in subscriptionResource.GetKeyVaultsAsync(top: top)) + await foreach (Models.KeyVault item in subscriptionResource.GetVaultsBySubscriptionAsync(top: top)) { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - KeyVaultData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded: {item}"); } Console.WriteLine("Succeeded"); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs index ab20a59df3e6..1ef6e884b8f5 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ArmKeyVaultModelFactory.cs @@ -17,16 +17,50 @@ namespace Azure.ResourceManager.KeyVault.Models /// Model factory for models. public static partial class ArmKeyVaultModelFactory { - /// Initializes a new instance of . - /// The supported Azure location where the key vault should be created. - /// The tags that will be assigned to the key vault. + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource type of the access policy. + /// Properties of the access policy. + /// A new instance for mocking. + public static KeyVaultAccessPolicyParameters KeyVaultAccessPolicyParameters(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IEnumerable accessPolicies = null) + { + accessPolicies ??= new List(); + + return new KeyVaultAccessPolicyParameters( + id, + name, + resourceType, + systemData, + location, + accessPolicies != null ? new KeyVaultAccessPolicyProperties(accessPolicies?.ToList(), serializedAdditionalRawData: null) : null, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. /// Properties of the vault. - /// A new instance for mocking. - public static KeyVaultCreateOrUpdateContent KeyVaultCreateOrUpdateContent(AzureLocation location = default, IDictionary tags = null, KeyVaultProperties properties = null) + /// A new instance for mocking. + public static KeyVault KeyVault(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, KeyVaultProperties properties = null) { tags ??= new Dictionary(); - return new KeyVaultCreateOrUpdateContent(location, tags, properties, serializedAdditionalRawData: null); + return new KeyVault( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -92,59 +126,13 @@ public static KeyVaultPrivateEndpointConnectionItemData KeyVaultPrivateEndpointC serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Properties of the vault. - /// A new instance for mocking. - public static KeyVaultData KeyVaultData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, KeyVaultProperties properties = null) - { - tags ??= new Dictionary(); - - return new KeyVaultData( - id, - name, - resourceType, - systemData, - tags, - location, - properties, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The resource type of the access policy. - /// Properties of the access policy. - /// A new instance for mocking. - public static KeyVaultAccessPolicyParameters KeyVaultAccessPolicyParameters(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IEnumerable accessPolicies = null) - { - accessPolicies ??= new List(); - - return new KeyVaultAccessPolicyParameters( - id, - name, - resourceType, - systemData, - location, - accessPolicies != null ? new KeyVaultAccessPolicyProperties(accessPolicies?.ToList(), serializedAdditionalRawData: null) : null, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the vault. - /// A new instance for mocking. + /// A new instance for mocking. public static DeletedKeyVaultData DeletedKeyVaultData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DeletedKeyVaultProperties properties = null) { return new DeletedKeyVaultData( @@ -197,7 +185,7 @@ public static KeyVaultNameAvailabilityResult KeyVaultNameAvailabilityResult(bool return new KeyVaultNameAvailabilityResult(nameAvailable, reason, message, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -208,7 +196,7 @@ public static KeyVaultNameAvailabilityResult KeyVaultNameAvailabilityResult(bool /// Provisioning state of the private endpoint connection. /// Azure location of the key vault resource. /// Tags assigned to the key vault resource. - /// A new instance for mocking. + /// A new instance for mocking. public static KeyVaultPrivateEndpointConnectionData KeyVaultPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, ResourceIdentifier privateEndpointId = null, KeyVaultPrivateLinkServiceConnectionState connectionState = null, KeyVaultPrivateEndpointConnectionProvisioningState? provisioningState = null, AzureLocation? location = null, IReadOnlyDictionary tags = null) { tags ??= new Dictionary(); @@ -257,7 +245,7 @@ public static KeyVaultPrivateLinkResourceData KeyVaultPrivateLinkResourceData(Re serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -267,7 +255,7 @@ public static KeyVaultPrivateLinkResourceData KeyVaultPrivateLinkResourceData(Re /// Properties of the managed HSM. /// SKU details. /// Managed service identity (system assigned and/or user assigned identities). - /// A new instance for mocking. + /// A new instance for mocking. public static ManagedHsmData ManagedHsmData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedHsmProperties properties = null, ManagedHsmSku sku = null, ManagedServiceIdentity identity = null) { tags ??= new Dictionary(); @@ -364,7 +352,7 @@ public static ManagedHSMSecurityDomainProperties ManagedHSMSecurityDomainPropert return new ManagedHSMSecurityDomainProperties(activationStatus, activationStatusMessage, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -377,7 +365,7 @@ public static ManagedHSMSecurityDomainProperties ManagedHSMSecurityDomainPropert /// Provisioning state of the private endpoint connection. /// SKU details. /// Managed service identity (system assigned and/or user assigned identities). - /// A new instance for mocking. + /// A new instance for mocking. public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, ResourceIdentifier privateEndpointId = null, ManagedHsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, ManagedHsmPrivateEndpointConnectionProvisioningState? provisioningState = null, ManagedHsmSku sku = null, ManagedServiceIdentity identity = null) { tags ??= new Dictionary(); @@ -398,13 +386,13 @@ public static ManagedHsmPrivateEndpointConnectionData ManagedHsmPrivateEndpointC serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Properties of the deleted managed HSM. - /// A new instance for mocking. + /// A new instance for mocking. public static DeletedManagedHsmData DeletedManagedHsmData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DeletedManagedHsmProperties properties = null) { return new DeletedManagedHsmData( @@ -547,7 +535,7 @@ public static SecretBaseAttributes SecretBaseAttributes(bool? enabled = null, Da serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -555,7 +543,7 @@ public static SecretBaseAttributes SecretBaseAttributes(bool? enabled = null, Da /// Properties of the secret. /// Azure location of the key vault resource. /// Tags assigned to the key vault resource. - /// A new instance for mocking. + /// A new instance for mocking. public static KeyVaultSecretData KeyVaultSecretData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SecretProperties properties = null, AzureLocation? location = null, IReadOnlyDictionary tags = null) { tags ??= new Dictionary(); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs index 720334f5df2d..3c39d72a6017 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs @@ -33,25 +33,6 @@ private static MockableKeyVaultSubscriptionResource GetMockableKeyVaultSubscript return resource.GetCachedClient(client => new MockableKeyVaultSubscriptionResource(client, resource.Id)); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// is null. - /// Returns a object. - public static KeyVaultResource GetKeyVaultResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableKeyVaultArmClient(client).GetKeyVaultResource(id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -167,32 +148,34 @@ public static KeyVaultSecretResource GetKeyVaultSecretResource(this ArmClient cl } /// - /// Gets a collection of KeyVaultResources in the ResourceGroupResource. + /// Gets a collection of KeyVaultPrivateEndpointConnectionResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// is null. - /// An object representing collection of KeyVaultResources and their operations over a KeyVaultResource. - public static KeyVaultCollection GetKeyVaults(this ResourceGroupResource resourceGroupResource) + /// The name of the key vault. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of KeyVaultPrivateEndpointConnectionResources and their operations over a KeyVaultPrivateEndpointConnectionResource. + public static KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections(this ResourceGroupResource resourceGroupResource, string vaultName) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaults(); + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultPrivateEndpointConnections(vaultName); } /// - /// Gets the specified Azure key vault. + /// Gets the specified private endpoint connection associated with the key vault. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// Vaults_Get + /// PrivateEndpointConnections_Get /// /// /// Default Api Version @@ -200,37 +183,38 @@ public static KeyVaultCollection GetKeyVaults(this ResourceGroupResource resourc /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the vault. + /// The name of the key vault. + /// Name of the private endpoint connection associated with the key vault. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetKeyVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) + public static async Task> GetKeyVaultPrivateEndpointConnectionAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultAsync(vaultName, cancellationToken).ConfigureAwait(false); + return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultPrivateEndpointConnectionAsync(vaultName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); } /// - /// Gets the specified Azure key vault. + /// Gets the specified private endpoint connection associated with the key vault. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// Vaults_Get + /// PrivateEndpointConnections_Get /// /// /// Default Api Version @@ -238,25 +222,26 @@ public static async Task> GetKeyVaultAsync(this Resou /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the vault. + /// The name of the key vault. + /// Name of the private endpoint connection associated with the key vault. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetKeyVault(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) + public static Response GetKeyVaultPrivateEndpointConnection(this ResourceGroupResource resourceGroupResource, string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVault(vaultName, cancellationToken); + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultPrivateEndpointConnection(vaultName, privateEndpointConnectionName, cancellationToken); } /// @@ -352,6 +337,323 @@ public static Response GetManagedHsm(this ResourceGroupResou return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetManagedHsm(name, cancellationToken); } + /// + /// Gets a collection of KeyVaultSecretResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the vault. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of KeyVaultSecretResources and their operations over a KeyVaultSecretResource. + public static KeyVaultSecretCollection GetKeyVaultSecrets(this ResourceGroupResource resourceGroupResource, string vaultName) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultSecrets(vaultName); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// + /// + /// Operation Id + /// Secrets_Get + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the vault. + /// The name of the secret. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetKeyVaultSecretAsync(this ResourceGroupResource resourceGroupResource, string vaultName, string secretName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultSecretAsync(vaultName, secretName, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// + /// + /// Operation Id + /// Secrets_Get + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the vault. + /// The name of the secret. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetKeyVaultSecret(this ResourceGroupResource resourceGroupResource, string vaultName, string secretName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetKeyVaultSecret(vaultName, secretName, cancellationToken); + } + + /// + /// Update access policies in a key vault in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind} + /// + /// + /// Operation Id + /// Vaults_UpdateAccessPolicy + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the vault. + /// Name of the operation. + /// Access policy to merge into the vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> UpdateAccessPolicyVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableKeyVaultResourceGroupResource(resourceGroupResource).UpdateAccessPolicyVaultAsync(vaultName, operationKind, keyVaultAccessPolicyParameters, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update access policies in a key vault in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind} + /// + /// + /// Operation Id + /// Vaults_UpdateAccessPolicy + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the vault. + /// Name of the operation. + /// Access policy to merge into the vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static Response UpdateAccessPolicyVault(this ResourceGroupResource resourceGroupResource, string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).UpdateAccessPolicyVault(vaultName, operationKind, keyVaultAccessPolicyParameters, cancellationToken); + } + + /// + /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults + /// + /// + /// Operation Id + /// Vaults_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Maximum number of results to return. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetVaultsByResourceGroupAsync(this ResourceGroupResource resourceGroupResource, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetVaultsByResourceGroupAsync(top, cancellationToken); + } + + /// + /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults + /// + /// + /// Operation Id + /// Vaults_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Maximum number of results to return. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetVaultsByResourceGroup(this ResourceGroupResource resourceGroupResource, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetVaultsByResourceGroup(top, cancellationToken); + } + + /// + /// Gets the private link resources supported for the key vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources + /// + /// + /// Operation Id + /// PrivateLinkResources_ListByVault + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the key vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetPrivateLinkResourcesByVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetPrivateLinkResourcesByVaultAsync(vaultName, cancellationToken); + } + + /// + /// Gets the private link resources supported for the key vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources + /// + /// + /// Operation Id + /// PrivateLinkResources_ListByVault + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the key vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetPrivateLinkResourcesByVault(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableKeyVaultResourceGroupResource(resourceGroupResource).GetPrivateLinkResourcesByVault(vaultName, cancellationToken); + } + /// /// Gets a collection of DeletedKeyVaultResources in the SubscriptionResource. /// @@ -559,24 +861,24 @@ public static Response GetDeletedManagedHsm(this Subs /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// Maximum number of results to return. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetKeyVaultsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetVaultsBySubscriptionAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetKeyVaultsAsync(top, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetVaultsBySubscriptionAsync(top, cancellationToken); } /// @@ -596,24 +898,24 @@ public static AsyncPageable GetKeyVaultsAsync(this Subscriptio /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// Maximum number of results to return. /// The cancellation token to use. /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetKeyVaults(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetVaultsBySubscription(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetKeyVaults(top, cancellationToken); + return GetMockableKeyVaultSubscriptionResource(subscriptionResource).GetVaultsBySubscription(top, cancellationToken); } /// @@ -631,6 +933,10 @@ public static Pageable GetKeyVaults(this SubscriptionResource /// Default Api Version /// 2023-07-01 /// + /// + /// Resource + /// + /// /// /// /// Mocking @@ -663,6 +969,10 @@ public static AsyncPageable GetDeletedKeyVaultsAsync(th /// Default Api Version /// 2023-07-01 /// + /// + /// Resource + /// + /// /// /// /// Mocking @@ -697,7 +1007,7 @@ public static Pageable GetDeletedKeyVaults(this Subscri /// /// /// Resource - /// + /// /// /// /// @@ -733,7 +1043,7 @@ public static async Task> CheckKeyVault /// /// /// Resource - /// + /// /// /// /// diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs index 7e34193bd5fa..229c17c31243 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultArmClient.cs @@ -34,18 +34,6 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// The resource ID of the resource to get. - /// Returns a object. - public virtual KeyVaultResource GetKeyVaultResource(ResourceIdentifier id) - { - KeyVaultResource.ValidateResourceId(id); - return new KeyVaultResource(Client, id); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs index cddb41101444..a063a7f8420b 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultResourceGroupResource.cs @@ -8,13 +8,21 @@ using System; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.KeyVault.Models; namespace Azure.ResourceManager.KeyVault.Mocking { /// A class to add extension methods to ResourceGroupResource. public partial class MockableKeyVaultResourceGroupResource : ArmResource { + private ClientDiagnostics _deletedKeyVaultVaultsClientDiagnostics; + private VaultsRestOperations _deletedKeyVaultVaultsRestClient; + private ClientDiagnostics _privateLinkResourcesClientDiagnostics; + private PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; + /// Initializes a new instance of the class for mocking. protected MockableKeyVaultResourceGroupResource() { @@ -27,29 +35,37 @@ internal MockableKeyVaultResourceGroupResource(ArmClient client, ResourceIdentif { } + private ClientDiagnostics DeletedKeyVaultVaultsClientDiagnostics => _deletedKeyVaultVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", DeletedKeyVaultResource.ResourceType.Namespace, Diagnostics); + private VaultsRestOperations DeletedKeyVaultVaultsRestClient => _deletedKeyVaultVaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedKeyVaultResource.ResourceType)); + private ClientDiagnostics PrivateLinkResourcesClientDiagnostics => _privateLinkResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private PrivateLinkResourcesRestOperations PrivateLinkResourcesRestClient => _privateLinkResourcesRestClient ??= new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private string GetApiVersionOrNull(ResourceType resourceType) { TryGetApiVersion(resourceType, out string apiVersion); return apiVersion; } - /// Gets a collection of KeyVaultResources in the ResourceGroupResource. - /// An object representing collection of KeyVaultResources and their operations over a KeyVaultResource. - public virtual KeyVaultCollection GetKeyVaults() + /// Gets a collection of KeyVaultPrivateEndpointConnectionResources in the ResourceGroupResource. + /// The name of the key vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of KeyVaultPrivateEndpointConnectionResources and their operations over a KeyVaultPrivateEndpointConnectionResource. + public virtual KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections(string vaultName) { - return GetCachedClient(client => new KeyVaultCollection(client, Id)); + return new KeyVaultPrivateEndpointConnectionCollection(Client, Id, vaultName); } /// - /// Gets the specified Azure key vault. + /// Gets the specified private endpoint connection associated with the key vault. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// Vaults_Get + /// PrivateEndpointConnections_Get /// /// /// Default Api Version @@ -57,30 +73,31 @@ public virtual KeyVaultCollection GetKeyVaults() /// /// /// Resource - /// + /// /// /// /// - /// The name of the vault. + /// The name of the key vault. + /// Name of the private endpoint connection associated with the key vault. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetKeyVaultAsync(string vaultName, CancellationToken cancellationToken = default) + public virtual async Task> GetKeyVaultPrivateEndpointConnectionAsync(string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return await GetKeyVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + return await GetKeyVaultPrivateEndpointConnections(vaultName).GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); } /// - /// Gets the specified Azure key vault. + /// Gets the specified private endpoint connection associated with the key vault. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} /// /// /// Operation Id - /// Vaults_Get + /// PrivateEndpointConnections_Get /// /// /// Default Api Version @@ -88,18 +105,19 @@ public virtual async Task> GetKeyVaultAsync(string va /// /// /// Resource - /// + /// /// /// /// - /// The name of the vault. + /// The name of the key vault. + /// Name of the private endpoint connection associated with the key vault. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetKeyVault(string vaultName, CancellationToken cancellationToken = default) + public virtual Response GetKeyVaultPrivateEndpointConnection(string vaultName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { - return GetKeyVaults().Get(vaultName, cancellationToken); + return GetKeyVaultPrivateEndpointConnections(vaultName).Get(privateEndpointConnectionName, cancellationToken); } /// Gets a collection of ManagedHsmResources in the ResourceGroupResource. @@ -170,5 +188,293 @@ public virtual Response GetManagedHsm(string name, Cancellat { return GetManagedHsms().Get(name, cancellationToken); } + + /// Gets a collection of KeyVaultSecretResources in the ResourceGroupResource. + /// The name of the vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// An object representing collection of KeyVaultSecretResources and their operations over a KeyVaultSecretResource. + public virtual KeyVaultSecretCollection GetKeyVaultSecrets(string vaultName) + { + return new KeyVaultSecretCollection(Client, Id, vaultName); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// + /// + /// Operation Id + /// Secrets_Get + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the vault. + /// The name of the secret. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKeyVaultSecretAsync(string vaultName, string secretName, CancellationToken cancellationToken = default) + { + return await GetKeyVaultSecrets(vaultName).GetAsync(secretName, cancellationToken).ConfigureAwait(false); + } + + /// + /// 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. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} + /// + /// + /// Operation Id + /// Secrets_Get + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the vault. + /// The name of the secret. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKeyVaultSecret(string vaultName, string secretName, CancellationToken cancellationToken = default) + { + return GetKeyVaultSecrets(vaultName).Get(secretName, cancellationToken); + } + + /// + /// Update access policies in a key vault in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind} + /// + /// + /// Operation Id + /// Vaults_UpdateAccessPolicy + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the vault. + /// Name of the operation. + /// Access policy to merge into the vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> UpdateAccessPolicyVaultAsync(string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters)); + + using var scope = DeletedKeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultResourceGroupResource.UpdateAccessPolicyVault"); + scope.Start(); + try + { + var response = await DeletedKeyVaultVaultsRestClient.UpdateAccessPolicyAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, operationKind, keyVaultAccessPolicyParameters, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update access policies in a key vault in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind} + /// + /// + /// Operation Id + /// Vaults_UpdateAccessPolicy + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the vault. + /// Name of the operation. + /// Access policy to merge into the vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response UpdateAccessPolicyVault(string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters)); + + using var scope = DeletedKeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultResourceGroupResource.UpdateAccessPolicyVault"); + scope.Start(); + try + { + var response = DeletedKeyVaultVaultsRestClient.UpdateAccessPolicy(Id.SubscriptionId, Id.ResourceGroupName, vaultName, operationKind, keyVaultAccessPolicyParameters, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults + /// + /// + /// Operation Id + /// Vaults_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Maximum number of results to return. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVaultsByResourceGroupAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedKeyVaultVaultsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedKeyVaultVaultsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Models.KeyVault.DeserializeKeyVault(e), DeletedKeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultResourceGroupResource.GetVaultsByResourceGroup", "value", "nextLink", cancellationToken); + } + + /// + /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults + /// + /// + /// Operation Id + /// Vaults_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Maximum number of results to return. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVaultsByResourceGroup(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedKeyVaultVaultsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedKeyVaultVaultsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Models.KeyVault.DeserializeKeyVault(e), DeletedKeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultResourceGroupResource.GetVaultsByResourceGroup", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the private link resources supported for the key vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources + /// + /// + /// Operation Id + /// PrivateLinkResources_ListByVault + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// + /// The name of the key vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPrivateLinkResourcesByVaultAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkResourcesRestClient.CreateListByVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => KeyVaultPrivateLinkResourceData.DeserializeKeyVaultPrivateLinkResourceData(e), PrivateLinkResourcesClientDiagnostics, Pipeline, "MockableKeyVaultResourceGroupResource.GetPrivateLinkResourcesByVault", "value", null, cancellationToken); + } + + /// + /// Gets the private link resources supported for the key vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources + /// + /// + /// Operation Id + /// PrivateLinkResources_ListByVault + /// + /// + /// Default Api Version + /// 2023-07-01 + /// + /// + /// + /// The name of the key vault. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPrivateLinkResourcesByVault(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => PrivateLinkResourcesRestClient.CreateListByVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => KeyVaultPrivateLinkResourceData.DeserializeKeyVaultPrivateLinkResourceData(e), PrivateLinkResourcesClientDiagnostics, Pipeline, "MockableKeyVaultResourceGroupResource.GetPrivateLinkResourcesByVault", "value", null, cancellationToken); + } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs index 09d7573c8c38..81872fe0bc58 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/MockableKeyVaultSubscriptionResource.cs @@ -18,10 +18,8 @@ namespace Azure.ResourceManager.KeyVault.Mocking /// A class to add extension methods to SubscriptionResource. public partial class MockableKeyVaultSubscriptionResource : ArmResource { - private ClientDiagnostics _keyVaultVaultsClientDiagnostics; - private VaultsRestOperations _keyVaultVaultsRestClient; - private ClientDiagnostics _vaultsClientDiagnostics; - private VaultsRestOperations _vaultsRestClient; + private ClientDiagnostics _deletedKeyVaultVaultsClientDiagnostics; + private VaultsRestOperations _deletedKeyVaultVaultsRestClient; private ClientDiagnostics _managedHsmClientDiagnostics; private ManagedHsmsRestOperations _managedHsmRestClient; private ClientDiagnostics _managedHsmsClientDiagnostics; @@ -39,10 +37,8 @@ internal MockableKeyVaultSubscriptionResource(ArmClient client, ResourceIdentifi { } - private ClientDiagnostics KeyVaultVaultsClientDiagnostics => _keyVaultVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultResource.ResourceType.Namespace, Diagnostics); - private VaultsRestOperations KeyVaultVaultsRestClient => _keyVaultVaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(KeyVaultResource.ResourceType)); - private ClientDiagnostics VaultsClientDiagnostics => _vaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private VaultsRestOperations VaultsRestClient => _vaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DeletedKeyVaultVaultsClientDiagnostics => _deletedKeyVaultVaultsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", DeletedKeyVaultResource.ResourceType.Namespace, Diagnostics); + private VaultsRestOperations DeletedKeyVaultVaultsRestClient => _deletedKeyVaultVaultsRestClient ??= new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedKeyVaultResource.ResourceType)); private ClientDiagnostics ManagedHsmClientDiagnostics => _managedHsmClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ManagedHsmResource.ResourceType.Namespace, Diagnostics); private ManagedHsmsRestOperations ManagedHsmRestClient => _managedHsmRestClient ??= new ManagedHsmsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedHsmResource.ResourceType)); private ClientDiagnostics ManagedHsmsClientDiagnostics => _managedHsmsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -213,18 +209,18 @@ public virtual Response GetDeletedManagedHsm(AzureLoc /// /// /// Resource - /// + /// /// /// /// /// Maximum number of results to return. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetKeyVaultsAsync(int? top = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVaultsBySubscriptionAsync(int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), KeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetKeyVaults", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedKeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedKeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Models.KeyVault.DeserializeKeyVault(e), DeletedKeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetVaultsBySubscription", "value", "nextLink", cancellationToken); } /// @@ -244,18 +240,18 @@ public virtual AsyncPageable GetKeyVaultsAsync(int? top = null /// /// /// Resource - /// + /// /// /// /// /// Maximum number of results to return. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetKeyVaults(int? top = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVaultsBySubscription(int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), KeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetKeyVaults", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedKeyVaultVaultsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedKeyVaultVaultsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Models.KeyVault.DeserializeKeyVault(e), DeletedKeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetVaultsBySubscription", "value", "nextLink", cancellationToken); } /// @@ -273,15 +269,19 @@ public virtual Pageable GetKeyVaults(int? top = null, Cancella /// Default Api Version /// 2023-07-01 /// + /// + /// Resource + /// + /// /// /// /// The cancellation token to use. /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetDeletedKeyVaultsAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => VaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), VaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedKeyVaultVaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedKeyVaultVaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), DeletedKeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults", "value", "nextLink", cancellationToken); } /// @@ -299,15 +299,19 @@ public virtual AsyncPageable GetDeletedKeyVaultsAsync(C /// Default Api Version /// 2023-07-01 /// + /// + /// Resource + /// + /// /// /// /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetDeletedKeyVaults(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => VaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => VaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), VaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => DeletedKeyVaultVaultsRestClient.CreateListDeletedRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DeletedKeyVaultVaultsRestClient.CreateListDeletedNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DeletedKeyVaultResource(Client, DeletedKeyVaultData.DeserializeDeletedKeyVaultData(e)), DeletedKeyVaultVaultsClientDiagnostics, Pipeline, "MockableKeyVaultSubscriptionResource.GetDeletedKeyVaults", "value", "nextLink", cancellationToken); } /// @@ -327,7 +331,7 @@ public virtual Pageable GetDeletedKeyVaults(Cancellatio /// /// /// Resource - /// + /// /// /// /// @@ -338,11 +342,11 @@ public virtual async Task> CheckKeyVaul { Argument.AssertNotNull(content, nameof(content)); - using var scope = KeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability"); + using var scope = DeletedKeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability"); scope.Start(); try { - var response = await KeyVaultVaultsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + var response = await DeletedKeyVaultVaultsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -369,7 +373,7 @@ public virtual async Task> CheckKeyVaul /// /// /// Resource - /// + /// /// /// /// @@ -380,11 +384,11 @@ public virtual Response CheckKeyVaultNameAvailab { Argument.AssertNotNull(content, nameof(content)); - using var scope = KeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability"); + using var scope = DeletedKeyVaultVaultsClientDiagnostics.CreateScope("MockableKeyVaultSubscriptionResource.CheckKeyVaultNameAvailability"); scope.Start(); try { - var response = KeyVaultVaultsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + var response = DeletedKeyVaultVaultsRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs deleted file mode 100644 index efd240b0a565..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultCollection.cs +++ /dev/null @@ -1,497 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; -using Azure.ResourceManager.Resources; - -namespace Azure.ResourceManager.KeyVault -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetKeyVaults method from an instance of . - /// - public partial class KeyVaultCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _keyVaultVaultsClientDiagnostics; - private readonly VaultsRestOperations _keyVaultVaultsRestClient; - - /// Initializes a new instance of the class for mocking. - protected KeyVaultCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal KeyVaultCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _keyVaultVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(KeyVaultResource.ResourceType, out string keyVaultVaultsApiVersion); - _keyVaultVaultsRestClient = new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultVaultsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); - } - - /// - /// Create or update a key vault in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Name of the vault. - /// Parameters to create or update the vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string vaultName, KeyVaultCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _keyVaultVaultsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content, cancellationToken).ConfigureAwait(false); - var operation = new KeyVaultArmOperation(new KeyVaultOperationSource(Client), _keyVaultVaultsClientDiagnostics, Pipeline, _keyVaultVaultsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create or update a key vault in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Name of the vault. - /// Parameters to create or update the vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string vaultName, KeyVaultCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _keyVaultVaultsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content, cancellationToken); - var operation = new KeyVaultArmOperation(new KeyVaultOperationSource(Client), _keyVaultVaultsClientDiagnostics, Pipeline, _keyVaultVaultsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the specified Azure key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.Get"); - scope.Start(); - try - { - var response = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the specified Azure key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.Get"); - scope.Start(); - try - { - var response = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults - /// - /// - /// Operation Id - /// Vaults_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Maximum number of results to return. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultVaultsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultVaultsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), _keyVaultVaultsClientDiagnostics, Pipeline, "KeyVaultCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// The List operation gets information about the vaults associated with the subscription and within the specified resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults - /// - /// - /// Operation Id - /// Vaults_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Maximum number of results to return. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(int? top = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultVaultsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultVaultsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultResource(Client, KeyVaultData.DeserializeKeyVaultData(e)), _keyVaultVaultsClientDiagnostics, Pipeline, "KeyVaultCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.Exists"); - scope.Start(); - try - { - var response = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.Exists"); - scope.Start(); - try - { - var response = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the vault. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultCollection.GetIfExists"); - scope.Start(); - try - { - var response = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs index cbab25128bd1..8d88e8932758 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionCollection.cs @@ -14,18 +14,20 @@ using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.KeyVault { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetKeyVaultPrivateEndpointConnections method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetKeyVaultPrivateEndpointConnections method from an instance of . /// public partial class KeyVaultPrivateEndpointConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics; private readonly PrivateEndpointConnectionsRestOperations _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient; + private readonly string _vaultName; /// Initializes a new instance of the class for mocking. protected KeyVaultPrivateEndpointConnectionCollection() @@ -35,8 +37,12 @@ protected KeyVaultPrivateEndpointConnectionCollection() /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal KeyVaultPrivateEndpointConnectionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + /// The name of the key vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal KeyVaultPrivateEndpointConnectionCollection(ArmClient client, ResourceIdentifier id, string vaultName) : base(client, id) { + _vaultName = vaultName; _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultPrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(KeyVaultPrivateEndpointConnectionResource.ResourceType, out string keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); @@ -47,8 +53,8 @@ internal KeyVaultPrivateEndpointConnectionCollection(ArmClient client, ResourceI internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != KeyVaultResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, KeyVaultResource.ResourceType), nameof(id)); + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); } /// @@ -87,8 +93,8 @@ public virtual async Task(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -138,8 +144,8 @@ public virtual ArmOperation CreateOrU scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Put(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); - var uri = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreatePutRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); + var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Put(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, privateEndpointConnectionName, data, cancellationToken); + var uri = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreatePutRequestUri(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, privateEndpointConnectionName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -186,7 +192,7 @@ public virtual async Task> G scope.Start(); try { - var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); @@ -231,7 +237,7 @@ public virtual Response Get(string pr scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken); + var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, privateEndpointConnectionName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); @@ -268,8 +274,8 @@ public virtual Response Get(string pr /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, _vaultName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, _vaultName); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultPrivateEndpointConnectionResource(Client, KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(e)), _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "KeyVaultPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -298,8 +304,8 @@ public virtual AsyncPageable GetAllAs /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, _vaultName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListByResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, _vaultName); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultPrivateEndpointConnectionResource(Client, KeyVaultPrivateEndpointConnectionData.DeserializeKeyVaultPrivateEndpointConnectionData(e)), _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "KeyVaultPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -336,7 +342,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn scope.Start(); try { - var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -379,7 +385,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, privateEndpointConnectionName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -422,7 +428,7 @@ public virtual async Task(response.GetRawResponse()); return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); @@ -467,7 +473,7 @@ public virtual NullableResponse GetIf scope.Start(); try { - var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + var response = _keyVaultPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, privateEndpointConnectionName, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new KeyVaultPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs index 03cf5de486c0..8ebbd59d2be6 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultPrivateEndpointConnectionResource.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.KeyVault { @@ -18,7 +19,7 @@ namespace Azure.ResourceManager.KeyVault /// A Class representing a KeyVaultPrivateEndpointConnection along with the instance operations that can be performed on it. /// If you have a you can construct a /// from an instance of using the GetKeyVaultPrivateEndpointConnectionResource method. - /// Otherwise you can get one from its parent resource using the GetKeyVaultPrivateEndpointConnection method. + /// Otherwise you can get one from its parent resource using the GetKeyVaultPrivateEndpointConnection method. /// public partial class KeyVaultPrivateEndpointConnectionResource : ArmResource { diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.Serialization.cs deleted file mode 100644 index 8a2c4bb95ebf..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.Serialization.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Azure.ResourceManager.KeyVault -{ - public partial class KeyVaultResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - KeyVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - KeyVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs deleted file mode 100644 index b4b49e0a267e..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs +++ /dev/null @@ -1,974 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.KeyVault.Models; -using Azure.ResourceManager.Resources; - -namespace Azure.ResourceManager.KeyVault -{ - /// - /// A Class representing a KeyVault along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetKeyVaultResource method. - /// Otherwise you can get one from its parent resource using the GetKeyVault method. - /// - public partial class KeyVaultResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The vaultName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _keyVaultVaultsClientDiagnostics; - private readonly VaultsRestOperations _keyVaultVaultsRestClient; - private readonly ClientDiagnostics _privateLinkResourcesClientDiagnostics; - private readonly PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; - private readonly KeyVaultData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.KeyVault/vaults"; - - /// Initializes a new instance of the class for mocking. - protected KeyVaultResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal KeyVaultResource(ArmClient client, KeyVaultData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal KeyVaultResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _keyVaultVaultsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string keyVaultVaultsApiVersion); - _keyVaultVaultsRestClient = new VaultsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultVaultsApiVersion); - _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual KeyVaultData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// Gets a collection of KeyVaultPrivateEndpointConnectionResources in the KeyVault. - /// An object representing collection of KeyVaultPrivateEndpointConnectionResources and their operations over a KeyVaultPrivateEndpointConnectionResource. - public virtual KeyVaultPrivateEndpointConnectionCollection GetKeyVaultPrivateEndpointConnections() - { - return GetCachedClient(client => new KeyVaultPrivateEndpointConnectionCollection(client, Id)); - } - - /// - /// Gets the specified private endpoint connection associated with the key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Name of the private endpoint connection associated with the key vault. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetKeyVaultPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - return await GetKeyVaultPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets the specified private endpoint connection associated with the key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Name of the private endpoint connection associated with the key vault. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetKeyVaultPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - return GetKeyVaultPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); - } - - /// Gets a collection of KeyVaultSecretResources in the KeyVault. - /// An object representing collection of KeyVaultSecretResources and their operations over a KeyVaultSecretResource. - public virtual KeyVaultSecretCollection GetKeyVaultSecrets() - { - return GetCachedClient(client => new KeyVaultSecretCollection(client, Id)); - } - - /// - /// 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. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the secret. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetKeyVaultSecretAsync(string secretName, CancellationToken cancellationToken = default) - { - return await GetKeyVaultSecrets().GetAsync(secretName, cancellationToken).ConfigureAwait(false); - } - - /// - /// 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. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the secret. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetKeyVaultSecret(string secretName, CancellationToken cancellationToken = default) - { - return GetKeyVaultSecrets().Get(secretName, cancellationToken); - } - - /// - /// Gets the specified Azure key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Get"); - scope.Start(); - try - { - var response = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the specified Azure key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Get"); - scope.Start(); - try - { - var response = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes the specified Azure key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Delete - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Delete"); - scope.Start(); - try - { - var response = await _keyVaultVaultsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _keyVaultVaultsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes the specified Azure key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Delete - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Delete"); - scope.Start(); - try - { - var response = _keyVaultVaultsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var uri = _keyVaultVaultsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new KeyVaultArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a key vault in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Update - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Parameters to patch the vault. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(KeyVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Update"); - scope.Start(); - try - { - var response = await _keyVaultVaultsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update a key vault in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Update - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Parameters to patch the vault. - /// The cancellation token to use. - /// is null. - public virtual Response Update(KeyVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.Update"); - scope.Start(); - try - { - var response = _keyVaultVaultsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - return Response.FromValue(new KeyVaultResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update access policies in a key vault in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind} - /// - /// - /// Operation Id - /// Vaults_UpdateAccessPolicy - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// - /// Name of the operation. - /// Access policy to merge into the vault. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAccessPolicyAsync(AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.UpdateAccessPolicy"); - scope.Start(); - try - { - var response = await _keyVaultVaultsRestClient.UpdateAccessPolicyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, operationKind, keyVaultAccessPolicyParameters, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Update access policies in a key vault in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind} - /// - /// - /// Operation Id - /// Vaults_UpdateAccessPolicy - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// - /// Name of the operation. - /// Access policy to merge into the vault. - /// The cancellation token to use. - /// is null. - public virtual Response UpdateAccessPolicy(AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(keyVaultAccessPolicyParameters, nameof(keyVaultAccessPolicyParameters)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.UpdateAccessPolicy"); - scope.Start(); - try - { - var response = _keyVaultVaultsRestClient.UpdateAccessPolicy(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, operationKind, keyVaultAccessPolicyParameters, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the private link resources supported for the key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources - /// - /// - /// Operation Id - /// PrivateLinkResources_ListByVault - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPrivateLinkResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => KeyVaultPrivateLinkResourceData.DeserializeKeyVaultPrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "KeyVaultResource.GetPrivateLinkResources", "value", null, cancellationToken); - } - - /// - /// Gets the private link resources supported for the key vault. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources - /// - /// - /// Operation Id - /// PrivateLinkResources_ListByVault - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPrivateLinkResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByVaultRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => KeyVaultPrivateLinkResourceData.DeserializeKeyVaultPrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "KeyVaultResource.GetPrivateLinkResources", "value", null, cancellationToken); - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.AddTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new KeyVaultPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. - /// The cancellation token to use. - /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.AddTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new KeyVaultPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = Update(patch, cancellationToken: cancellationToken); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.SetTags"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new KeyVaultPatch(); - patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. - /// The cancellation token to use. - /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tags, nameof(tags)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.SetTags"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new KeyVaultPatch(); - patch.Tags.ReplaceWith(tags); - var result = Update(patch, cancellationToken: cancellationToken); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.RemoveTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _keyVaultVaultsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new KeyVaultPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} - /// - /// - /// Operation Id - /// Vaults_Get - /// - /// - /// Default Api Version - /// 2023-07-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The cancellation token to use. - /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(key, nameof(key)); - - using var scope = _keyVaultVaultsClientDiagnostics.CreateScope("KeyVaultResource.RemoveTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _keyVaultVaultsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new KeyVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new KeyVaultPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = Update(patch, cancellationToken: cancellationToken); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs index c70fc0fe0156..09809296ec43 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretCollection.cs @@ -15,18 +15,20 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager.KeyVault.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.KeyVault { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetKeyVaultSecrets method from an instance of . + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetKeyVaultSecrets method from an instance of . /// public partial class KeyVaultSecretCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _keyVaultSecretSecretsClientDiagnostics; private readonly SecretsRestOperations _keyVaultSecretSecretsRestClient; + private readonly string _vaultName; /// Initializes a new instance of the class for mocking. protected KeyVaultSecretCollection() @@ -36,8 +38,12 @@ protected KeyVaultSecretCollection() /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal KeyVaultSecretCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + /// The name of the vault. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal KeyVaultSecretCollection(ArmClient client, ResourceIdentifier id, string vaultName) : base(client, id) { + _vaultName = vaultName; _keyVaultSecretSecretsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.KeyVault", KeyVaultSecretResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(KeyVaultSecretResource.ResourceType, out string keyVaultSecretSecretsApiVersion); _keyVaultSecretSecretsRestClient = new SecretsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultSecretSecretsApiVersion); @@ -48,8 +54,8 @@ internal KeyVaultSecretCollection(ArmClient client, ResourceIdentifier id) : bas internal static void ValidateResourceId(ResourceIdentifier id) { - if (id.ResourceType != KeyVaultResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, KeyVaultResource.ResourceType), nameof(id)); + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); } /// @@ -88,8 +94,8 @@ public virtual async Task> CreateOrUpdateAs scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, content, cancellationToken).ConfigureAwait(false); - var uri = _keyVaultSecretSecretsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, content); + var response = await _keyVaultSecretSecretsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, content, cancellationToken).ConfigureAwait(false); + var uri = _keyVaultSecretSecretsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, content); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultSecretResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -139,8 +145,8 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, content, cancellationToken); - var uri = _keyVaultSecretSecretsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, content); + var response = _keyVaultSecretSecretsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, content, cancellationToken); + var uri = _keyVaultSecretSecretsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, content); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new KeyVaultArmOperation(Response.FromValue(new KeyVaultSecretResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -187,7 +193,7 @@ public virtual async Task> GetAsync(string secr scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken).ConfigureAwait(false); + var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); @@ -232,7 +238,7 @@ public virtual Response Get(string secretName, Cancellat scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken); + var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); @@ -270,8 +276,8 @@ public virtual Response Get(string secretName, Cancellat /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultSecretSecretsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultSecretSecretsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultSecretSecretsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultSecretSecretsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, _vaultName, top); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultSecretResource(Client, KeyVaultSecretData.DeserializeKeyVaultSecretData(e)), _keyVaultSecretSecretsClientDiagnostics, Pipeline, "KeyVaultSecretCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -301,8 +307,8 @@ public virtual AsyncPageable GetAllAsync(int? top = null /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(int? top = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultSecretSecretsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultSecretSecretsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + HttpMessage FirstPageRequest(int? pageSizeHint) => _keyVaultSecretSecretsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultSecretSecretsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, _vaultName, top); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultSecretResource(Client, KeyVaultSecretData.DeserializeKeyVaultSecretData(e)), _keyVaultSecretSecretsClientDiagnostics, Pipeline, "KeyVaultSecretCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -339,7 +345,7 @@ public virtual async Task> ExistsAsync(string secretName, Cancell scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -382,7 +388,7 @@ public virtual Response Exists(string secretName, CancellationToken cancel scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken); + var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -425,7 +431,7 @@ public virtual async Task> GetIfExistsA scope.Start(); try { - var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _keyVaultSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); @@ -470,7 +476,7 @@ public virtual NullableResponse GetIfExists(string secre scope.Start(); try { - var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, secretName, cancellationToken: cancellationToken); + var response = _keyVaultSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, _vaultName, secretName, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new KeyVaultSecretResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs index f5f7f3916b4f..8b1e453aa612 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultSecretResource.cs @@ -12,6 +12,7 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager.KeyVault.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.KeyVault { @@ -19,7 +20,7 @@ namespace Azure.ResourceManager.KeyVault /// A Class representing a KeyVaultSecret along with the instance operations that can be performed on it. /// If you have a you can construct a /// from an instance of using the GetKeyVaultSecretResource method. - /// Otherwise you can get one from its parent resource using the GetKeyVaultSecret method. + /// Otherwise you can get one from its parent resource using the GetKeyVaultSecret method. /// public partial class KeyVaultSecretResource : ArmResource { diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultOperationSource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultOperationSource.cs deleted file mode 100644 index bdb140cc182f..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/LongRunningOperation/KeyVaultOperationSource.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault -{ - internal class KeyVaultOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal KeyVaultOperationSource(ArmClient client) - { - _client = client; - } - - KeyVaultResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - var data = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return new KeyVaultResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - var data = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return new KeyVaultResource(_client, data); - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVault.Serialization.cs similarity index 85% rename from sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.Serialization.cs rename to sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVault.Serialization.cs index 6c536e0c2bcf..8d284a754806 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVault.Serialization.cs @@ -12,16 +12,15 @@ using System.Text; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.KeyVault.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.KeyVault +namespace Azure.ResourceManager.KeyVault.Models { - public partial class KeyVaultData : IUtf8JsonSerializable, IJsonModel + public partial class KeyVault : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -32,10 +31,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(KeyVaultData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(KeyVault)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -43,19 +42,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteObjectValue(Properties, options); } - KeyVaultData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + KeyVault IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(KeyVaultData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(KeyVault)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultData(document.RootElement, options); + return DeserializeKeyVault(document.RootElement, options); } - internal static KeyVaultData DeserializeKeyVaultData(JsonElement element, ModelReaderWriterOptions options = null) + internal static KeyVault DeserializeKeyVault(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -63,7 +62,7 @@ internal static KeyVaultData DeserializeKeyVaultData(JsonElement element, ModelR { return null; } - Models.KeyVaultProperties properties = default; + KeyVaultProperties properties = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -76,7 +75,7 @@ internal static KeyVaultData DeserializeKeyVaultData(JsonElement element, ModelR { if (property.NameEquals("properties"u8)) { - properties = Models.KeyVaultProperties.DeserializeKeyVaultProperties(property.Value, options); + properties = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value, options); continue; } if (property.NameEquals("tags"u8)) @@ -128,7 +127,7 @@ internal static KeyVaultData DeserializeKeyVaultData(JsonElement element, ModelR } } serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultData( + return new KeyVault( id, name, type, @@ -271,9 +270,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) return BinaryData.FromString(builder.ToString()); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { @@ -282,26 +281,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions option case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(KeyVaultData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(KeyVault)} does not support writing '{options.Format}' format."); } } - KeyVaultData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + KeyVault IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeKeyVaultData(document.RootElement, options); + return DeserializeKeyVault(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(KeyVaultData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(KeyVault)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVault.cs similarity index 76% rename from sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.cs rename to sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVault.cs index cdb24d19be23..f2a6704a217a 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVault.cs @@ -8,16 +8,12 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.KeyVault.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.KeyVault +namespace Azure.ResourceManager.KeyVault.Models { - /// - /// A class representing the KeyVault data model. - /// Resource information with extended details. - /// - public partial class KeyVaultData : TrackedResourceData + /// Resource information with extended details. + public partial class KeyVault : TrackedResourceData { /// /// Keeps track of any properties unknown to the library. @@ -51,18 +47,18 @@ public partial class KeyVaultData : TrackedResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The location. /// Properties of the vault. /// is null. - public KeyVaultData(AzureLocation location, Models.KeyVaultProperties properties) : base(location) + public KeyVault(AzureLocation location, KeyVaultProperties properties) : base(location) { Argument.AssertNotNull(properties, nameof(properties)); Properties = properties; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -71,19 +67,19 @@ public KeyVaultData(AzureLocation location, Models.KeyVaultProperties properties /// The location. /// Properties of the vault. /// Keeps track of any properties unknown to the library. - internal KeyVaultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, Models.KeyVaultProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal KeyVault(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, KeyVaultProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal KeyVaultData() + /// Initializes a new instance of for deserialization. + internal KeyVault() { } /// Properties of the vault. [WirePath("properties")] - public Models.KeyVaultProperties Properties { get; set; } + public KeyVaultProperties Properties { get; set; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.Serialization.cs deleted file mode 100644 index 4b3d15d1319d..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.Serialization.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - public partial class KeyVaultCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultCreateOrUpdateContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultCreateOrUpdateContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultCreateOrUpdateContent(document.RootElement, options); - } - - internal static KeyVaultCreateOrUpdateContent DeserializeKeyVaultCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AzureLocation location = default; - IDictionary tags = default; - KeyVaultProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("properties"u8)) - { - properties = KeyVaultProperties.DeserializeKeyVaultProperties(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultCreateOrUpdateContent(location, tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(KeyVaultCreateOrUpdateContent)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeKeyVaultCreateOrUpdateContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultCreateOrUpdateContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.cs deleted file mode 100644 index 6d72a105868e..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultCreateOrUpdateContent.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// Parameters for creating or updating a vault. - public partial class KeyVaultCreateOrUpdateContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The supported Azure location where the key vault should be created. - /// Properties of the vault. - /// is null. - public KeyVaultCreateOrUpdateContent(AzureLocation location, KeyVaultProperties properties) - { - Argument.AssertNotNull(properties, nameof(properties)); - - Location = location; - Tags = new ChangeTrackingDictionary(); - Properties = properties; - } - - /// Initializes a new instance of . - /// The supported Azure location where the key vault should be created. - /// The tags that will be assigned to the key vault. - /// Properties of the vault. - /// Keeps track of any properties unknown to the library. - internal KeyVaultCreateOrUpdateContent(AzureLocation location, IDictionary tags, KeyVaultProperties properties, IDictionary serializedAdditionalRawData) - { - Location = location; - Tags = tags; - Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal KeyVaultCreateOrUpdateContent() - { - } - - /// The supported Azure location where the key vault should be created. - [WirePath("location")] - public AzureLocation Location { get; } - /// The tags that will be assigned to the key vault. - [WirePath("tags")] - public IDictionary Tags { get; } - /// Properties of the vault. - [WirePath("properties")] - public KeyVaultProperties Properties { get; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.Serialization.cs deleted file mode 100644 index b5525a10b6ae..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.Serialization.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - public partial class KeyVaultPatch : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultPatch)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(Properties)) - { - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultPatch)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultPatch(document.RootElement, options); - } - - internal static KeyVaultPatch DeserializeKeyVaultPatch(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary tags = default; - KeyVaultPatchProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - properties = KeyVaultPatchProperties.DeserializeKeyVaultPatchProperties(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(KeyVaultPatch)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeKeyVaultPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultPatch)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.cs deleted file mode 100644 index 43fccf1bbf45..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatch.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// Parameters for creating or updating a vault. - public partial class KeyVaultPatch - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public KeyVaultPatch() - { - Tags = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The tags that will be assigned to the key vault. - /// Properties of the vault. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPatch(IDictionary tags, KeyVaultPatchProperties properties, IDictionary serializedAdditionalRawData) - { - Tags = tags; - Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The tags that will be assigned to the key vault. - [WirePath("tags")] - public IDictionary Tags { get; } - /// Properties of the vault. - [WirePath("properties")] - public KeyVaultPatchProperties Properties { get; set; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.Serialization.cs deleted file mode 100644 index 562f2beb7c5b..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.KeyVault.Models -{ - internal static partial class KeyVaultPatchModeExtensions - { - public static string ToSerialString(this KeyVaultPatchMode value) => value switch - { - KeyVaultPatchMode.Default => "default", - KeyVaultPatchMode.Recover => "recover", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultPatchMode value.") - }; - - public static KeyVaultPatchMode ToKeyVaultPatchMode(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "default")) return KeyVaultPatchMode.Default; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "recover")) return KeyVaultPatchMode.Recover; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown KeyVaultPatchMode value."); - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.cs deleted file mode 100644 index 0a21b41a40dc..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchMode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// The vault's create mode to indicate whether the vault need to be recovered or not. - public enum KeyVaultPatchMode - { - /// default. - Default, - /// recover. - Recover - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.Serialization.cs deleted file mode 100644 index ed6c37d8633e..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.Serialization.cs +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - public partial class KeyVaultPatchProperties : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultPatchProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId.Value); - } - if (Optional.IsDefined(Sku)) - { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); - } - if (Optional.IsCollectionDefined(AccessPolicies)) - { - writer.WritePropertyName("accessPolicies"u8); - writer.WriteStartArray(); - foreach (var item in AccessPolicies) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(EnabledForDeployment)) - { - writer.WritePropertyName("enabledForDeployment"u8); - writer.WriteBooleanValue(EnabledForDeployment.Value); - } - if (Optional.IsDefined(EnabledForDiskEncryption)) - { - writer.WritePropertyName("enabledForDiskEncryption"u8); - writer.WriteBooleanValue(EnabledForDiskEncryption.Value); - } - if (Optional.IsDefined(EnabledForTemplateDeployment)) - { - writer.WritePropertyName("enabledForTemplateDeployment"u8); - writer.WriteBooleanValue(EnabledForTemplateDeployment.Value); - } - if (Optional.IsDefined(EnableSoftDelete)) - { - writer.WritePropertyName("enableSoftDelete"u8); - writer.WriteBooleanValue(EnableSoftDelete.Value); - } - if (Optional.IsDefined(EnableRbacAuthorization)) - { - writer.WritePropertyName("enableRbacAuthorization"u8); - writer.WriteBooleanValue(EnableRbacAuthorization.Value); - } - if (Optional.IsDefined(SoftDeleteRetentionInDays)) - { - writer.WritePropertyName("softDeleteRetentionInDays"u8); - writer.WriteNumberValue(SoftDeleteRetentionInDays.Value); - } - if (Optional.IsDefined(CreateMode)) - { - writer.WritePropertyName("createMode"u8); - writer.WriteStringValue(CreateMode.Value.ToSerialString()); - } - if (Optional.IsDefined(EnablePurgeProtection)) - { - writer.WritePropertyName("enablePurgeProtection"u8); - writer.WriteBooleanValue(EnablePurgeProtection.Value); - } - if (Optional.IsDefined(NetworkRuleSet)) - { - writer.WritePropertyName("networkAcls"u8); - writer.WriteObjectValue(NetworkRuleSet, options); - } - if (Optional.IsDefined(PublicNetworkAccess)) - { - writer.WritePropertyName("publicNetworkAccess"u8); - writer.WriteStringValue(PublicNetworkAccess); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KeyVaultPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(KeyVaultPatchProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKeyVaultPatchProperties(document.RootElement, options); - } - - internal static KeyVaultPatchProperties DeserializeKeyVaultPatchProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Guid? tenantId = default; - KeyVaultSku sku = default; - IList accessPolicies = default; - bool? enabledForDeployment = default; - bool? enabledForDiskEncryption = default; - bool? enabledForTemplateDeployment = default; - bool? enableSoftDelete = default; - bool? enableRbacAuthorization = default; - int? softDeleteRetentionInDays = default; - KeyVaultPatchMode? createMode = default; - bool? enablePurgeProtection = default; - KeyVaultNetworkRuleSet networkAcls = default; - string publicNetworkAccess = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tenantId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - tenantId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("sku"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sku = KeyVaultSku.DeserializeKeyVaultSku(property.Value, options); - continue; - } - if (property.NameEquals("accessPolicies"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(KeyVaultAccessPolicy.DeserializeKeyVaultAccessPolicy(item, options)); - } - accessPolicies = array; - continue; - } - if (property.NameEquals("enabledForDeployment"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabledForDeployment = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("enabledForDiskEncryption"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabledForDiskEncryption = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("enabledForTemplateDeployment"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabledForTemplateDeployment = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("enableSoftDelete"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableSoftDelete = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("enableRbacAuthorization"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableRbacAuthorization = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("softDeleteRetentionInDays"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - softDeleteRetentionInDays = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("createMode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createMode = property.Value.GetString().ToKeyVaultPatchMode(); - continue; - } - if (property.NameEquals("enablePurgeProtection"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enablePurgeProtection = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("networkAcls"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkAcls = KeyVaultNetworkRuleSet.DeserializeKeyVaultNetworkRuleSet(property.Value, options); - continue; - } - if (property.NameEquals("publicNetworkAccess"u8)) - { - publicNetworkAccess = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KeyVaultPatchProperties( - tenantId, - sku, - accessPolicies ?? new ChangeTrackingList(), - enabledForDeployment, - enabledForDiskEncryption, - enabledForTemplateDeployment, - enableSoftDelete, - enableRbacAuthorization, - softDeleteRetentionInDays, - createMode, - enablePurgeProtection, - networkAcls, - publicNetworkAccess, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options); - default: - throw new FormatException($"The model {nameof(KeyVaultPatchProperties)} does not support writing '{options.Format}' format."); - } - } - - KeyVaultPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeKeyVaultPatchProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KeyVaultPatchProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.cs deleted file mode 100644 index 8aa5ce2cf91d..000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/KeyVaultPatchProperties.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// Properties of the vault. - public partial class KeyVaultPatchProperties - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public KeyVaultPatchProperties() - { - AccessPolicies = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - /// SKU details. - /// 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. - /// Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. - /// Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. - /// Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. - /// Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot be reverted to false. - /// 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. - /// softDelete data retention days. It accepts >=7 and <=90. - /// The vault's create mode to indicate whether the vault need to be recovered or not. - /// 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. - /// A collection of rules governing the accessibility of the vault from specific network locations. - /// 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. - /// Keeps track of any properties unknown to the library. - internal KeyVaultPatchProperties(Guid? tenantId, KeyVaultSku sku, IList accessPolicies, bool? enabledForDeployment, bool? enabledForDiskEncryption, bool? enabledForTemplateDeployment, bool? enableSoftDelete, bool? enableRbacAuthorization, int? softDeleteRetentionInDays, KeyVaultPatchMode? createMode, bool? enablePurgeProtection, KeyVaultNetworkRuleSet networkRuleSet, string publicNetworkAccess, IDictionary serializedAdditionalRawData) - { - TenantId = tenantId; - Sku = sku; - AccessPolicies = accessPolicies; - EnabledForDeployment = enabledForDeployment; - EnabledForDiskEncryption = enabledForDiskEncryption; - EnabledForTemplateDeployment = enabledForTemplateDeployment; - EnableSoftDelete = enableSoftDelete; - EnableRbacAuthorization = enableRbacAuthorization; - SoftDeleteRetentionInDays = softDeleteRetentionInDays; - CreateMode = createMode; - EnablePurgeProtection = enablePurgeProtection; - NetworkRuleSet = networkRuleSet; - PublicNetworkAccess = publicNetworkAccess; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - [WirePath("tenantId")] - public Guid? TenantId { get; set; } - /// SKU details. - [WirePath("sku")] - public KeyVaultSku Sku { get; set; } - /// 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. - [WirePath("accessPolicies")] - public IList AccessPolicies { get; } - /// Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. - [WirePath("enabledForDeployment")] - public bool? EnabledForDeployment { get; set; } - /// Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. - [WirePath("enabledForDiskEncryption")] - public bool? EnabledForDiskEncryption { get; set; } - /// Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. - [WirePath("enabledForTemplateDeployment")] - public bool? EnabledForTemplateDeployment { get; set; } - /// Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot be reverted to false. - [WirePath("enableSoftDelete")] - public bool? EnableSoftDelete { get; set; } - /// 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. - [WirePath("enableRbacAuthorization")] - public bool? EnableRbacAuthorization { get; set; } - /// softDelete data retention days. It accepts >=7 and <=90. - [WirePath("softDeleteRetentionInDays")] - public int? SoftDeleteRetentionInDays { get; set; } - /// The vault's create mode to indicate whether the vault need to be recovered or not. - [WirePath("createMode")] - public KeyVaultPatchMode? CreateMode { get; set; } - /// 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. - [WirePath("enablePurgeProtection")] - public bool? EnablePurgeProtection { get; set; } - /// A collection of rules governing the accessibility of the vault from specific network locations. - [WirePath("networkAcls")] - public KeyVaultNetworkRuleSet NetworkRuleSet { get; set; } - /// 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. - [WirePath("publicNetworkAccess")] - public string PublicNetworkAccess { get; set; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.Serialization.cs index 5aa2a685d03b..da82f7584e17 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.Serialization.cs @@ -88,7 +88,7 @@ internal static VaultListResult DeserializeVaultListResult(JsonElement element, { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; string nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -100,10 +100,10 @@ internal static VaultListResult DeserializeVaultListResult(JsonElement element, { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(KeyVaultData.DeserializeKeyVaultData(item, options)); + array.Add(KeyVault.DeserializeKeyVault(item, options)); } value = array; continue; @@ -119,7 +119,7 @@ internal static VaultListResult DeserializeVaultListResult(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new VaultListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new VaultListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.cs index 5ccd44b0cc19..5e549a363966 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VaultListResult.cs @@ -48,14 +48,14 @@ internal partial class VaultListResult /// Initializes a new instance of . internal VaultListResult() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of . /// The list of vaults. /// The URL to get the next set of vaults. /// Keeps track of any properties unknown to the library. - internal VaultListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal VaultListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -63,7 +63,7 @@ internal VaultListResult(IReadOnlyList value, string nextLink, IDi } /// The list of vaults. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The URL to get the next set of vaults. public string NextLink { get; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsRestOperations.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsRestOperations.cs index a0a47004dcc5..99b780af3a57 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsRestOperations.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/RestOperations/VaultsRestOperations.cs @@ -36,380 +36,6 @@ public VaultsRestOperations(HttpPipeline pipeline, string applicationId, Uri end _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultCreateOrUpdateContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultCreateOrUpdateContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Create or update a key vault in the specified subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the Resource Group to which the server belongs. - /// Name of the vault. - /// Parameters to create or update the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vaultName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or update a key vault in the specified subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the Resource Group to which the server belongs. - /// Name of the vault. - /// Parameters to create or update the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultCreateOrUpdateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vaultName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultPatch patch) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update a key vault in the specified subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the Resource Group to which the server belongs. - /// Name of the vault. - /// Parameters to patch the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vaultName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - KeyVaultData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a key vault in the specified subscription. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the Resource Group to which the server belongs. - /// Name of the vault. - /// Parameters to patch the vault. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string vaultName, KeyVaultPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vaultName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - KeyVaultData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string vaultName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string vaultName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Deletes the specified Azure key vault. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the Resource Group to which the vault belongs. - /// The name of the vault to delete. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes the specified Azure key vault. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the Resource Group to which the vault belongs. - /// The name of the vault to delete. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string vaultName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); - uri.AppendPath(vaultName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the specified Azure key vault. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the Resource Group to which the vault belongs. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KeyVaultData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((KeyVaultData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the specified Azure key vault. - /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the Resource Group to which the vault belongs. - /// The name of the vault. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KeyVaultData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = KeyVaultData.DeserializeKeyVaultData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((KeyVaultData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - internal RequestUriBuilder CreateUpdateAccessPolicyRequestUri(string subscriptionId, string resourceGroupName, string vaultName, AccessPolicyUpdateKind operationKind, KeyVaultAccessPolicyParameters keyVaultAccessPolicyParameters) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/autorest.md b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/autorest.md index d31ada843283..d5d65a80d5a4 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/autorest.md +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/autorest.md @@ -7,7 +7,7 @@ azure-arm: true csharp: true library-name: KeyVault namespace: Azure.ResourceManager.KeyVault -require: https://github.com/Azure/azure-rest-api-specs/blob/d1296700aa6cd650970e9891dd58eef5698327fd/specification/keyvault/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/keyvault/resource-manager/readme.md #tag: package-2023-07 output-folder: $(this-folder)/Generated clear-output-folder: true