From d042622bb0bc709c346ae71df445538c80444d42 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 23 Feb 2023 13:29:21 +0000 Subject: [PATCH] CodeGen from PR 22774 in Azure/azure-rest-api-specs Merge a06ef6dc00703f7527ef771ebfbdf49f6362d33e into 8468620c009664ed91a3148c04cf77b6c8eb7b6f --- ...nager.ConfidentialLedger.netstandard2.0.cs | 110 +++ .../src/Generated/ConfidentialLedgerData.cs | 6 +- .../ConfidentialLedgerExtensions.cs | 119 ++++ .../ResourceGroupResourceExtensionClient.cs | 7 + .../SubscriptionResourceExtensionClient.cs | 50 ++ .../ManagedCCFOperationSource.cs | 40 ++ .../src/Generated/ManagedCCFCollection.cs | 343 ++++++++++ .../src/Generated/ManagedCCFData.cs | 40 ++ .../src/Generated/ManagedCCFResource.cs | 609 +++++++++++++++++ .../ConfidentialLedgerData.Serialization.cs | 18 +- .../Models/DeploymentType.Serialization.cs | 62 ++ .../src/Generated/Models/DeploymentType.cs | 34 + .../src/Generated/Models/LanguageRuntime.cs | 51 ++ .../Models/ManagedCCFData.Serialization.cs | 112 +++ .../Models/ManagedCCFList.Serialization.cs | 47 ++ .../src/Generated/Models/ManagedCCFList.cs | 37 + .../ManagedCCFProperties.Serialization.cs | 128 ++++ .../Generated/Models/ManagedCCFProperties.cs | 57 ++ ...MemberIdentityCertificate.Serialization.cs | 72 ++ .../Models/MemberIdentityCertificate.cs | 67 ++ .../src/Generated/Models/RunningState.cs | 60 ++ .../ConfidentialLedgerRestOperations.cs | 6 +- .../RestOperations/LedgerRestOperations.cs | 58 +- .../ManagedCCFRestOperations.cs | 646 ++++++++++++++++++ .../src/autorest.md | 2 +- 25 files changed, 2746 insertions(+), 35 deletions(-) create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/LongRunningOperation/ManagedCCFOperationSource.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFCollection.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFData.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFResource.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/DeploymentType.Serialization.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/DeploymentType.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/LanguageRuntime.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFData.Serialization.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFList.Serialization.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFList.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFProperties.Serialization.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFProperties.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/MemberIdentityCertificate.Serialization.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/MemberIdentityCertificate.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/RunningState.cs create mode 100644 sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ManagedCCFRestOperations.cs diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/api/Azure.ResourceManager.ConfidentialLedger.netstandard2.0.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/api/Azure.ResourceManager.ConfidentialLedger.netstandard2.0.cs index 1eb3dd4234c4..4811e5371403 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/api/Azure.ResourceManager.ConfidentialLedger.netstandard2.0.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/api/Azure.ResourceManager.ConfidentialLedger.netstandard2.0.cs @@ -19,6 +19,7 @@ public partial class ConfidentialLedgerData : Azure.ResourceManager.Models.Track { public ConfidentialLedgerData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } public Azure.ResourceManager.ConfidentialLedger.Models.ConfidentialLedgerProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.ConfidentialLedger.Models.RunningState? RunningState { get { throw null; } set { } } } public static partial class ConfidentialLedgerExtensions { @@ -30,6 +31,12 @@ public static partial class ConfidentialLedgerExtensions public static Azure.ResourceManager.ConfidentialLedger.ConfidentialLedgerCollection GetConfidentialLedgers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetConfidentialLedgers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetConfidentialLedgersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetManagedCCF(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string appName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetManagedCCFAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string appName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ConfidentialLedger.ManagedCCFResource GetManagedCCFResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ConfidentialLedger.ManagedCCFCollection GetManagedCCFs(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetManagedCCFs(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetManagedCCFsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class ConfidentialLedgerResource : Azure.ResourceManager.ArmResource { @@ -51,6 +58,46 @@ protected ConfidentialLedgerResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ConfidentialLedger.ConfidentialLedgerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ConfidentialLedger.ConfidentialLedgerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class ManagedCCFCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ManagedCCFCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string appName, Azure.ResourceManager.ConfidentialLedger.ManagedCCFData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string appName, Azure.ResourceManager.ConfidentialLedger.ManagedCCFData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string appName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string appName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string appName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string appName, 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 ManagedCCFData : Azure.ResourceManager.Models.TrackedResourceData + { + public ManagedCCFData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.ConfidentialLedger.Models.ManagedCCFProperties Properties { get { throw null; } set { } } + } + public partial class ManagedCCFResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ManagedCCFResource() { } + public virtual Azure.ResourceManager.ConfidentialLedger.ManagedCCFData 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 appName) { 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 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; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.ConfidentialLedger.ManagedCCFData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ConfidentialLedger.ManagedCCFData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } } namespace Azure.ResourceManager.ConfidentialLedger.Models { @@ -171,4 +218,67 @@ public ConfidentialLedgerProperties() { } public static bool operator !=(Azure.ResourceManager.ConfidentialLedger.Models.ConfidentialLedgerType left, Azure.ResourceManager.ConfidentialLedger.Models.ConfidentialLedgerType right) { throw null; } public override string ToString() { throw null; } } + public partial class DeploymentType + { + public DeploymentType() { } + public System.Uri AppSourceUri { get { throw null; } set { } } + public Azure.ResourceManager.ConfidentialLedger.Models.LanguageRuntime? LanguageRuntime { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct LanguageRuntime : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public LanguageRuntime(string value) { throw null; } + public static Azure.ResourceManager.ConfidentialLedger.Models.LanguageRuntime CPP { get { throw null; } } + public static Azure.ResourceManager.ConfidentialLedger.Models.LanguageRuntime JS { get { throw null; } } + public bool Equals(Azure.ResourceManager.ConfidentialLedger.Models.LanguageRuntime other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.ConfidentialLedger.Models.LanguageRuntime left, Azure.ResourceManager.ConfidentialLedger.Models.LanguageRuntime right) { throw null; } + public static implicit operator Azure.ResourceManager.ConfidentialLedger.Models.LanguageRuntime (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ConfidentialLedger.Models.LanguageRuntime left, Azure.ResourceManager.ConfidentialLedger.Models.LanguageRuntime right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ManagedCCFProperties + { + public ManagedCCFProperties() { } + public string AppName { get { throw null; } } + public System.Uri AppUri { get { throw null; } } + public Azure.ResourceManager.ConfidentialLedger.Models.DeploymentType DeploymentType { get { throw null; } set { } } + public System.Uri IdentityServiceUri { get { throw null; } } + public System.Collections.Generic.IList MemberIdentityCertificates { get { throw null; } } + public int? NodeCount { get { throw null; } set { } } + public Azure.ResourceManager.ConfidentialLedger.Models.ConfidentialLedgerProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class MemberIdentityCertificate + { + public MemberIdentityCertificate() { } + public string Certificate { get { throw null; } set { } } + public string Encryptionkey { get { throw null; } set { } } + public System.BinaryData Tags { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RunningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RunningState(string value) { throw null; } + public static Azure.ResourceManager.ConfidentialLedger.Models.RunningState Active { get { throw null; } } + public static Azure.ResourceManager.ConfidentialLedger.Models.RunningState Paused { get { throw null; } } + public static Azure.ResourceManager.ConfidentialLedger.Models.RunningState Pausing { get { throw null; } } + public static Azure.ResourceManager.ConfidentialLedger.Models.RunningState Resuming { get { throw null; } } + public static Azure.ResourceManager.ConfidentialLedger.Models.RunningState Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.ConfidentialLedger.Models.RunningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.ConfidentialLedger.Models.RunningState left, Azure.ResourceManager.ConfidentialLedger.Models.RunningState right) { throw null; } + public static implicit operator Azure.ResourceManager.ConfidentialLedger.Models.RunningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ConfidentialLedger.Models.RunningState left, Azure.ResourceManager.ConfidentialLedger.Models.RunningState right) { throw null; } + public override string ToString() { throw null; } + } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerData.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerData.cs index def7af453d91..5d89900f202d 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerData.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ConfidentialLedgerData.cs @@ -28,12 +28,16 @@ public ConfidentialLedgerData(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. + /// Object representing RunningState for Ledger. /// Properties of Confidential Ledger Resource. - internal ConfidentialLedgerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ConfidentialLedgerProperties properties) : base(id, name, resourceType, systemData, tags, location) + internal ConfidentialLedgerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RunningState? runningState, ConfidentialLedgerProperties properties) : base(id, name, resourceType, systemData, tags, location) { + RunningState = runningState; Properties = properties; } + /// Object representing RunningState for Ledger. + public RunningState? RunningState { get; set; } /// Properties of Confidential Ledger Resource. public ConfidentialLedgerProperties Properties { get; set; } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs index 062e4f02ea9f..f9b6d7b83b51 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs @@ -120,6 +120,50 @@ public static Pageable GetConfidentialLedgers(this S return GetExtensionClient(subscriptionResource).GetConfidentialLedgers(filter, cancellationToken); } + /// + /// Retrieves the properties of all Managed CCF. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/managedCCFs + /// + /// + /// Operation Id + /// ManagedCCF_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetManagedCCFsAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscriptionResource).GetManagedCCFsAsync(filter, cancellationToken); + } + + /// + /// Retrieves the properties of all Managed CCF. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/managedCCFs + /// + /// + /// Operation Id + /// ManagedCCF_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetManagedCCFs(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) + { + return GetExtensionClient(subscriptionResource).GetManagedCCFs(filter, cancellationToken); + } + private static ResourceGroupResourceExtensionClient GetExtensionClient(ResourceGroupResource resourceGroupResource) { return resourceGroupResource.GetCachedClient((client) => @@ -185,6 +229,62 @@ public static Response GetConfidentialLedger(this Re return resourceGroupResource.GetConfidentialLedgers().Get(ledgerName, cancellationToken); } + /// Gets a collection of ManagedCCFResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of ManagedCCFResources and their operations over a ManagedCCFResource. + public static ManagedCCFCollection GetManagedCCFs(this ResourceGroupResource resourceGroupResource) + { + return GetExtensionClient(resourceGroupResource).GetManagedCCFs(); + } + + /// + /// Retrieves the properties of a Managed CCF app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// The instance the method will execute against. + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetManagedCCFAsync(this ResourceGroupResource resourceGroupResource, string appName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetManagedCCFs().GetAsync(appName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the properties of a Managed CCF app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// The instance the method will execute against. + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetManagedCCF(this ResourceGroupResource resourceGroupResource, string appName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetManagedCCFs().Get(appName, cancellationToken); + } + #region ConfidentialLedgerResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -203,5 +303,24 @@ public static ConfidentialLedgerResource GetConfidentialLedgerResource(this ArmC ); } #endregion + + #region ManagedCCFResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedCCFResource GetManagedCCFResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ManagedCCFResource.ValidateResourceId(id); + return new ManagedCCFResource(client, id); + } + ); + } + #endregion } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs index 46889b2124f0..7e9a66d5b224 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -37,5 +37,12 @@ public virtual ConfidentialLedgerCollection GetConfidentialLedgers() { return GetCachedClient(Client => new ConfidentialLedgerCollection(Client, Id)); } + + /// Gets a collection of ManagedCCFResources in the ResourceGroupResource. + /// An object representing collection of ManagedCCFResources and their operations over a ManagedCCFResource. + public virtual ManagedCCFCollection GetManagedCCFs() + { + return GetCachedClient(Client => new ManagedCCFCollection(Client, Id)); + } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 5622a105fac2..7dcc34190b25 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -23,6 +23,8 @@ internal partial class SubscriptionResourceExtensionClient : ArmResource private ConfidentialLedgerRestOperations _defaultRestClient; private ClientDiagnostics _confidentialLedgerLedgerClientDiagnostics; private LedgerRestOperations _confidentialLedgerLedgerRestClient; + private ClientDiagnostics _managedCCFClientDiagnostics; + private ManagedCCFRestOperations _managedCCFRestClient; /// Initializes a new instance of the class for mocking. protected SubscriptionResourceExtensionClient() @@ -40,6 +42,8 @@ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifie private ConfidentialLedgerRestOperations DefaultRestClient => _defaultRestClient ??= new ConfidentialLedgerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics ConfidentialLedgerLedgerClientDiagnostics => _confidentialLedgerLedgerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ConfidentialLedgerResource.ResourceType.Namespace, Diagnostics); private LedgerRestOperations ConfidentialLedgerLedgerRestClient => _confidentialLedgerLedgerRestClient ??= new LedgerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConfidentialLedgerResource.ResourceType)); + private ClientDiagnostics ManagedCCFClientDiagnostics => _managedCCFClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ManagedCCFResource.ResourceType.Namespace, Diagnostics); + private ManagedCCFRestOperations ManagedCCFRestClient => _managedCCFRestClient ??= new ManagedCCFRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedCCFResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -154,5 +158,51 @@ public virtual Pageable GetConfidentialLedgers(strin HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfidentialLedgerLedgerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConfidentialLedgerResource(Client, ConfidentialLedgerData.DeserializeConfidentialLedgerData(e)), ConfidentialLedgerLedgerClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetConfidentialLedgers", "value", "nextLink", cancellationToken); } + + /// + /// Retrieves the properties of all Managed CCF. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/managedCCFs + /// + /// + /// Operation Id + /// ManagedCCF_ListBySubscription + /// + /// + /// + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedCCFsAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedCCFRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedCCFRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedCCFResource(Client, ManagedCCFData.DeserializeManagedCCFData(e)), ManagedCCFClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedCCFs", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves the properties of all Managed CCF. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/managedCCFs + /// + /// + /// Operation Id + /// ManagedCCF_ListBySubscription + /// + /// + /// + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedCCFs(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedCCFRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedCCFRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, filter); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedCCFResource(Client, ManagedCCFData.DeserializeManagedCCFData(e)), ManagedCCFClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedCCFs", "value", "nextLink", cancellationToken); + } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/LongRunningOperation/ManagedCCFOperationSource.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/LongRunningOperation/ManagedCCFOperationSource.cs new file mode 100644 index 000000000000..3177de3ef174 --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/LongRunningOperation/ManagedCCFOperationSource.cs @@ -0,0 +1,40 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ConfidentialLedger +{ + internal class ManagedCCFOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ManagedCCFOperationSource(ArmClient client) + { + _client = client; + } + + ManagedCCFResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ManagedCCFData.DeserializeManagedCCFData(document.RootElement); + return new ManagedCCFResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ManagedCCFData.DeserializeManagedCCFData(document.RootElement); + return new ManagedCCFResource(_client, data); + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFCollection.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFCollection.cs new file mode 100644 index 000000000000..de245a1cd402 --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFCollection.cs @@ -0,0 +1,343 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ConfidentialLedger +{ + /// + /// 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 GetManagedCCFs method from an instance of . + /// + public partial class ManagedCCFCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _managedCCFClientDiagnostics; + private readonly ManagedCCFRestOperations _managedCCFRestClient; + + /// Initializes a new instance of the class for mocking. + protected ManagedCCFCollection() + { + } + + /// 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 ManagedCCFCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedCCFClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ManagedCCFResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ManagedCCFResource.ResourceType, out string managedCCFApiVersion); + _managedCCFRestClient = new ManagedCCFRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedCCFApiVersion); +#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)); + } + + /// + /// Creates a Managed CCF with the specified Managed CCF parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Create + /// + /// + /// + /// 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 Managed CCF. + /// Managed CCF Create Request Body. + /// 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 appName, ManagedCCFData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _managedCCFRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, appName, data, cancellationToken).ConfigureAwait(false); + var operation = new ConfidentialLedgerArmOperation(new ManagedCCFOperationSource(Client), _managedCCFClientDiagnostics, Pipeline, _managedCCFRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, appName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a Managed CCF with the specified Managed CCF parameters. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Create + /// + /// + /// + /// 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 Managed CCF. + /// Managed CCF Create Request Body. + /// 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 appName, ManagedCCFData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _managedCCFRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, appName, data, cancellationToken); + var operation = new ConfidentialLedgerArmOperation(new ManagedCCFOperationSource(Client), _managedCCFClientDiagnostics, Pipeline, _managedCCFRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, appName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieves the properties of a Managed CCF app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFCollection.Get"); + scope.Start(); + try + { + var response = await _managedCCFRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, appName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedCCFResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieves the properties of a Managed CCF app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFCollection.Get"); + scope.Start(); + try + { + var response = _managedCCFRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, appName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedCCFResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieves the properties of all Managed CCF apps. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs + /// + /// + /// Operation Id + /// ManagedCCF_ListByResourceGroup + /// + /// + /// + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// 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, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedCCFRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedCCFRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedCCFResource(Client, ManagedCCFData.DeserializeManagedCCFData(e)), _managedCCFClientDiagnostics, Pipeline, "ManagedCCFCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Retrieves the properties of all Managed CCF apps. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs + /// + /// + /// Operation Id + /// ManagedCCF_ListByResourceGroup + /// + /// + /// + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedCCFRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedCCFRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, filter); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedCCFResource(Client, ManagedCCFData.DeserializeManagedCCFData(e)), _managedCCFClientDiagnostics, Pipeline, "ManagedCCFCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFCollection.Exists"); + scope.Start(); + try + { + var response = await _managedCCFRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, appName, 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.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// Name of the Managed CCF. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFCollection.Exists"); + scope.Start(); + try + { + var response = _managedCCFRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, appName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFData.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFData.cs new file mode 100644 index 000000000000..c66fdcc8e650 --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFData.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ConfidentialLedger.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ConfidentialLedger +{ + /// A class representing the ManagedCCF data model. + public partial class ManagedCCFData : TrackedResourceData + { + /// Initializes a new instance of ManagedCCFData. + /// The location. + public ManagedCCFData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ManagedCCFData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Properties of Managed CCF Resource. + internal ManagedCCFData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedCCFProperties properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Properties of Managed CCF Resource. + public ManagedCCFProperties Properties { get; set; } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFResource.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFResource.cs new file mode 100644 index 000000000000..bbc7f584b44b --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/ManagedCCFResource.cs @@ -0,0 +1,609 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ConfidentialLedger +{ + /// + /// A Class representing a ManagedCCF 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 GetManagedCCFResource method. + /// Otherwise you can get one from its parent resource using the GetManagedCCF method. + /// + public partial class ManagedCCFResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string appName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _managedCCFClientDiagnostics; + private readonly ManagedCCFRestOperations _managedCCFRestClient; + private readonly ManagedCCFData _data; + + /// Initializes a new instance of the class for mocking. + protected ManagedCCFResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ManagedCCFResource(ArmClient client, ManagedCCFData 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 ManagedCCFResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedCCFClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ConfidentialLedger", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string managedCCFApiVersion); + _managedCCFRestClient = new ManagedCCFRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedCCFApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ConfidentialLedger/managedCCFs"; + + /// 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 ManagedCCFData 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)); + } + + /// + /// Retrieves the properties of a Managed CCF app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.Get"); + scope.Start(); + try + { + var response = await _managedCCFRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedCCFResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieves the properties of a Managed CCF app. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.Get"); + scope.Start(); + try + { + var response = _managedCCFRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedCCFResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an existing Managed CCF. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Delete + /// + /// + /// + /// 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 = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.Delete"); + scope.Start(); + try + { + var response = await _managedCCFRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ConfidentialLedgerArmOperation(_managedCCFClientDiagnostics, Pipeline, _managedCCFRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an existing Managed CCF. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Delete + /// + /// + /// + /// 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 = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.Delete"); + scope.Start(); + try + { + var response = _managedCCFRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new ConfidentialLedgerArmOperation(_managedCCFClientDiagnostics, Pipeline, _managedCCFRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates properties of Managed CCF + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Update + /// + /// + /// + /// 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. + /// Request body for Updating Managed CCF App. + /// The cancellation token to use. + /// is null. + public virtual async Task UpdateAsync(WaitUntil waitUntil, ManagedCCFData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.Update"); + scope.Start(); + try + { + var response = await _managedCCFRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ConfidentialLedgerArmOperation(_managedCCFClientDiagnostics, Pipeline, _managedCCFRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates properties of Managed CCF + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Update + /// + /// + /// + /// 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. + /// Request body for Updating Managed CCF App. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ManagedCCFData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.Update"); + scope.Start(); + try + { + var response = _managedCCFRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); + var operation = new ConfidentialLedgerArmOperation(_managedCCFClientDiagnostics, Pipeline, _managedCCFRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// 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 = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.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 _managedCCFRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedCCFResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ManagedCCFData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// 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 = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.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 = _managedCCFRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ManagedCCFResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ManagedCCFData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Get(cancellationToken: cancellationToken); + } + } + 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.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// 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 = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.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 _managedCCFRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedCCFResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ManagedCCFData(current.Location); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false); + } + } + 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.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// 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 = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.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 = _managedCCFRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ManagedCCFResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ManagedCCFData(current.Location); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Get(cancellationToken: cancellationToken); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// 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 = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.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 _managedCCFRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedCCFResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ManagedCCFData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/managedCCFs/{appName} + /// + /// + /// Operation Id + /// ManagedCCF_Get + /// + /// + /// + /// 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 = _managedCCFClientDiagnostics.CreateScope("ManagedCCFResource.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 = _managedCCFRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ManagedCCFResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ManagedCCFData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Get(cancellationToken: cancellationToken); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerData.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerData.Serialization.cs index 3a719d28b831..cf0406416c31 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerData.Serialization.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ConfidentialLedgerData.Serialization.cs @@ -18,6 +18,11 @@ public partial class ConfidentialLedgerData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(RunningState)) + { + writer.WritePropertyName("runningState"u8); + writer.WriteStringValue(RunningState.Value.ToString()); + } if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); @@ -41,6 +46,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ConfidentialLedgerData DeserializeConfidentialLedgerData(JsonElement element) { + Optional runningState = default; Optional properties = default; Optional> tags = default; AzureLocation location = default; @@ -50,6 +56,16 @@ internal static ConfidentialLedgerData DeserializeConfidentialLedgerData(JsonEle Optional systemData = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("runningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + runningState = new RunningState(property.Value.GetString()); + continue; + } if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -106,7 +122,7 @@ internal static ConfidentialLedgerData DeserializeConfidentialLedgerData(JsonEle continue; } } - return new ConfidentialLedgerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + return new ConfidentialLedgerData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(runningState), properties.Value); } } } diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/DeploymentType.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/DeploymentType.Serialization.cs new file mode 100644 index 000000000000..6ff706934423 --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/DeploymentType.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ConfidentialLedger.Models +{ + public partial class DeploymentType : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(LanguageRuntime)) + { + writer.WritePropertyName("languageRuntime"u8); + writer.WriteStringValue(LanguageRuntime.Value.ToString()); + } + if (Optional.IsDefined(AppSourceUri)) + { + writer.WritePropertyName("appSourceUri"u8); + writer.WriteStringValue(AppSourceUri.AbsoluteUri); + } + writer.WriteEndObject(); + } + + internal static DeploymentType DeserializeDeploymentType(JsonElement element) + { + Optional languageRuntime = default; + Optional appSourceUri = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("languageRuntime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + languageRuntime = new LanguageRuntime(property.Value.GetString()); + continue; + } + if (property.NameEquals("appSourceUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + appSourceUri = null; + continue; + } + appSourceUri = new Uri(property.Value.GetString()); + continue; + } + } + return new DeploymentType(Optional.ToNullable(languageRuntime), appSourceUri.Value); + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/DeploymentType.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/DeploymentType.cs new file mode 100644 index 000000000000..2f082e0d741c --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/DeploymentType.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ConfidentialLedger.Models +{ + /// Object representing DeploymentType for Managed CCF. + public partial class DeploymentType + { + /// Initializes a new instance of DeploymentType. + public DeploymentType() + { + } + + /// Initializes a new instance of DeploymentType. + /// Unique name for the Managed CCF. + /// Source Uri containing ManagedCCF code. + internal DeploymentType(LanguageRuntime? languageRuntime, Uri appSourceUri) + { + LanguageRuntime = languageRuntime; + AppSourceUri = appSourceUri; + } + + /// Unique name for the Managed CCF. + public LanguageRuntime? LanguageRuntime { get; set; } + /// Source Uri containing ManagedCCF code. + public Uri AppSourceUri { get; set; } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/LanguageRuntime.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/LanguageRuntime.cs new file mode 100644 index 000000000000..d0b20546da29 --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/LanguageRuntime.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ConfidentialLedger.Models +{ + /// Object representing LanguageRuntime for Manged CCF. + public readonly partial struct LanguageRuntime : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LanguageRuntime(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CPPValue = "CPP"; + private const string JSValue = "JS"; + + /// CPP. + public static LanguageRuntime CPP { get; } = new LanguageRuntime(CPPValue); + /// JS. + public static LanguageRuntime JS { get; } = new LanguageRuntime(JSValue); + /// Determines if two values are the same. + public static bool operator ==(LanguageRuntime left, LanguageRuntime right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LanguageRuntime left, LanguageRuntime right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LanguageRuntime(string value) => new LanguageRuntime(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LanguageRuntime other && Equals(other); + /// + public bool Equals(LanguageRuntime other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFData.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFData.Serialization.cs new file mode 100644 index 000000000000..dbec0a2ee190 --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFData.Serialization.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ConfidentialLedger.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ConfidentialLedger +{ + public partial class ManagedCCFData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static ManagedCCFData DeserializeManagedCCFData(JsonElement element) + { + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = ManagedCCFProperties.DeserializeManagedCCFProperties(property.Value); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + 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("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new ManagedCCFData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFList.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFList.Serialization.cs new file mode 100644 index 000000000000..77cca80a8e6d --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ConfidentialLedger; + +namespace Azure.ResourceManager.ConfidentialLedger.Models +{ + internal partial class ManagedCCFList + { + internal static ManagedCCFList DeserializeManagedCCFList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedCCFData.DeserializeManagedCCFData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedCCFList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFList.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFList.cs new file mode 100644 index 000000000000..9289178025dc --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ConfidentialLedger; + +namespace Azure.ResourceManager.ConfidentialLedger.Models +{ + /// Object that includes an array of Managed CCF and a possible link for next set. + internal partial class ManagedCCFList + { + /// Initializes a new instance of ManagedCCFList. + internal ManagedCCFList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedCCFList. + /// List of Managed CCF. + /// The URL the client should use to fetch the next page (per server side paging). + internal ManagedCCFList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of Managed CCF. + public IReadOnlyList Value { get; } + /// The URL the client should use to fetch the next page (per server side paging). + public string NextLink { get; } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFProperties.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFProperties.Serialization.cs new file mode 100644 index 000000000000..979860db89e5 --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFProperties.Serialization.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ConfidentialLedger.Models +{ + public partial class ManagedCCFProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(MemberIdentityCertificates)) + { + writer.WritePropertyName("memberIdentityCertificates"u8); + writer.WriteStartArray(); + foreach (var item in MemberIdentityCertificates) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DeploymentType)) + { + writer.WritePropertyName("deploymentType"u8); + writer.WriteObjectValue(DeploymentType); + } + if (Optional.IsDefined(NodeCount)) + { + writer.WritePropertyName("nodeCount"u8); + writer.WriteNumberValue(NodeCount.Value); + } + writer.WriteEndObject(); + } + + internal static ManagedCCFProperties DeserializeManagedCCFProperties(JsonElement element) + { + Optional appName = default; + Optional appUri = default; + Optional identityServiceUri = default; + Optional> memberIdentityCertificates = default; + Optional deploymentType = default; + Optional provisioningState = default; + Optional nodeCount = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("appName"u8)) + { + appName = property.Value.GetString(); + continue; + } + if (property.NameEquals("appUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + appUri = null; + continue; + } + appUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("identityServiceUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + identityServiceUri = null; + continue; + } + identityServiceUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("memberIdentityCertificates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MemberIdentityCertificate.DeserializeMemberIdentityCertificate(item)); + } + memberIdentityCertificates = array; + continue; + } + if (property.NameEquals("deploymentType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deploymentType = DeploymentType.DeserializeDeploymentType(property.Value); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ConfidentialLedgerProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("nodeCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + nodeCount = property.Value.GetInt32(); + continue; + } + } + return new ManagedCCFProperties(appName.Value, appUri.Value, identityServiceUri.Value, Optional.ToList(memberIdentityCertificates), deploymentType.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(nodeCount)); + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFProperties.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFProperties.cs new file mode 100644 index 000000000000..dc3417ba7e2b --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/ManagedCCFProperties.cs @@ -0,0 +1,57 @@ +// 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.ConfidentialLedger.Models +{ + /// Additional Managed CCF properties. + public partial class ManagedCCFProperties + { + /// Initializes a new instance of ManagedCCFProperties. + public ManagedCCFProperties() + { + MemberIdentityCertificates = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedCCFProperties. + /// Unique name for the Managed CCF. + /// Endpoint for calling Managed CCF Service. + /// Endpoint for accessing network identity. + /// List of member identity certificates for Managed CCF. + /// Deployment Type of Managed CCF. + /// Provisioning state of Ledger Resource. + /// Number of CCF nodes in the Managed CCF. + internal ManagedCCFProperties(string appName, Uri appUri, Uri identityServiceUri, IList memberIdentityCertificates, DeploymentType deploymentType, ConfidentialLedgerProvisioningState? provisioningState, int? nodeCount) + { + AppName = appName; + AppUri = appUri; + IdentityServiceUri = identityServiceUri; + MemberIdentityCertificates = memberIdentityCertificates; + DeploymentType = deploymentType; + ProvisioningState = provisioningState; + NodeCount = nodeCount; + } + + /// Unique name for the Managed CCF. + public string AppName { get; } + /// Endpoint for calling Managed CCF Service. + public Uri AppUri { get; } + /// Endpoint for accessing network identity. + public Uri IdentityServiceUri { get; } + /// List of member identity certificates for Managed CCF. + public IList MemberIdentityCertificates { get; } + /// Deployment Type of Managed CCF. + public DeploymentType DeploymentType { get; set; } + /// Provisioning state of Ledger Resource. + public ConfidentialLedgerProvisioningState? ProvisioningState { get; } + /// Number of CCF nodes in the Managed CCF. + public int? NodeCount { get; set; } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/MemberIdentityCertificate.Serialization.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/MemberIdentityCertificate.Serialization.cs new file mode 100644 index 000000000000..75510d4bb93f --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/MemberIdentityCertificate.Serialization.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ConfidentialLedger.Models +{ + public partial class MemberIdentityCertificate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Certificate)) + { + writer.WritePropertyName("certificate"u8); + writer.WriteStringValue(Certificate); + } + if (Optional.IsDefined(Encryptionkey)) + { + writer.WritePropertyName("encryptionkey"u8); + writer.WriteStringValue(Encryptionkey); + } + if (Optional.IsDefined(Tags)) + { + writer.WritePropertyName("tags"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Tags); +#else + JsonSerializer.Serialize(writer, JsonDocument.Parse(Tags.ToString()).RootElement); +#endif + } + writer.WriteEndObject(); + } + + internal static MemberIdentityCertificate DeserializeMemberIdentityCertificate(JsonElement element) + { + Optional certificate = default; + Optional encryptionkey = default; + Optional tags = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("certificate"u8)) + { + certificate = property.Value.GetString(); + continue; + } + if (property.NameEquals("encryptionkey"u8)) + { + encryptionkey = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + tags = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + } + return new MemberIdentityCertificate(certificate.Value, encryptionkey.Value, tags.Value); + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/MemberIdentityCertificate.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/MemberIdentityCertificate.cs new file mode 100644 index 000000000000..22a1d8b47502 --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/MemberIdentityCertificate.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ConfidentialLedger.Models +{ + /// Object representing MemberIdentityCertificate for Managed CCF. + public partial class MemberIdentityCertificate + { + /// Initializes a new instance of MemberIdentityCertificate. + public MemberIdentityCertificate() + { + } + + /// Initializes a new instance of MemberIdentityCertificate. + /// Member Identity Certificate. + /// Member Identity Certificate Encryption Key. + /// Anything. + internal MemberIdentityCertificate(string certificate, string encryptionkey, BinaryData tags) + { + Certificate = certificate; + Encryptionkey = encryptionkey; + Tags = tags; + } + + /// Member Identity Certificate. + public string Certificate { get; set; } + /// Member Identity Certificate Encryption Key. + public string Encryptionkey { get; set; } + /// + /// Anything + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formated 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" }. + /// + /// + /// + /// + public BinaryData Tags { get; set; } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/RunningState.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/RunningState.cs new file mode 100644 index 000000000000..73118177c6ca --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Models/RunningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ConfidentialLedger.Models +{ + /// Object representing RunningState for Confidential Ledger. + public readonly partial struct RunningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RunningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string PausedValue = "Paused"; + private const string UnknownValue = "Unknown"; + private const string PausingValue = "Pausing"; + private const string ResumingValue = "Resuming"; + + /// Active. + public static RunningState Active { get; } = new RunningState(ActiveValue); + /// Paused. + public static RunningState Paused { get; } = new RunningState(PausedValue); + /// Unknown. + public static RunningState Unknown { get; } = new RunningState(UnknownValue); + /// Pausing. + public static RunningState Pausing { get; } = new RunningState(PausingValue); + /// Resuming. + public static RunningState Resuming { get; } = new RunningState(ResumingValue); + /// Determines if two values are the same. + public static bool operator ==(RunningState left, RunningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RunningState left, RunningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RunningState(string value) => new RunningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RunningState other && Equals(other); + /// + public bool Equals(RunningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ConfidentialLedgerRestOperations.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ConfidentialLedgerRestOperations.cs index 13685754d8e5..41ff9253e8a4 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ConfidentialLedgerRestOperations.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ConfidentialLedgerRestOperations.cs @@ -33,7 +33,7 @@ public ConfidentialLedgerRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-05-13"; + _apiVersion = apiVersion ?? "2023-01-26-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,7 +59,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, C } /// To check whether a resource name is available. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + /// The ID of the target subscription. /// Name availability request payload. /// The cancellation token to use. /// or is null. @@ -86,7 +86,7 @@ public async Task> CheckNameA } /// To check whether a resource name is available. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + /// The ID of the target subscription. /// Name availability request payload. /// The cancellation token to use. /// or is null. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/LedgerRestOperations.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/LedgerRestOperations.cs index 360e0a598805..169b8c47f35e 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/LedgerRestOperations.cs +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/LedgerRestOperations.cs @@ -33,7 +33,7 @@ public LedgerRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-05-13"; + _apiVersion = apiVersion ?? "2023-01-26-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -58,8 +58,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Retrieves the properties of a Confidential Ledger. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// Name of the Confidential Ledger. /// The cancellation token to use. /// , or is null. @@ -89,8 +89,8 @@ public async Task> GetAsync(string subscription } /// Retrieves the properties of a Confidential Ledger. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// Name of the Confidential Ledger. /// The cancellation token to use. /// , or is null. @@ -140,8 +140,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes an existing Confidential Ledger. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// Name of the Confidential Ledger. /// The cancellation token to use. /// , or is null. @@ -166,8 +166,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes an existing Confidential Ledger. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// Name of the Confidential Ledger. /// The cancellation token to use. /// , or is null. @@ -216,8 +216,8 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Creates a Confidential Ledger with the specified ledger parameters. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// Name of the Confidential Ledger. /// Confidential Ledger Create Request Body. /// The cancellation token to use. @@ -243,8 +243,8 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } /// Creates a Confidential Ledger with the specified ledger parameters. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// Name of the Confidential Ledger. /// Confidential Ledger Create Request Body. /// The cancellation token to use. @@ -294,8 +294,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates properties of Confidential Ledger. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// Name of the Confidential Ledger. /// Confidential Ledger request body for Updating Ledger. /// The cancellation token to use. @@ -321,8 +321,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates properties of Confidential Ledger. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// Name of the Confidential Ledger. /// Confidential Ledger request body for Updating Ledger. /// The cancellation token to use. @@ -371,8 +371,8 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str } /// Retrieves the properties of all Confidential Ledgers. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. /// The cancellation token to use. /// or is null. @@ -399,8 +399,8 @@ public async Task> ListByResourceGroupAsync(str } /// Retrieves the properties of all Confidential Ledgers. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. /// The cancellation token to use. /// or is null. @@ -448,7 +448,7 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, stri } /// Retrieves the properties of all Confidential Ledgers. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + /// The ID of the target subscription. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. /// The cancellation token to use. /// is null. @@ -474,7 +474,7 @@ public async Task> ListBySubscriptionAsync(stri } /// Retrieves the properties of all Confidential Ledgers. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + /// The ID of the target subscription. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. /// The cancellation token to use. /// is null. @@ -515,8 +515,8 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// Retrieves the properties of all Confidential Ledgers. /// The URL to the next page of results. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. /// The cancellation token to use. /// , or is null. @@ -545,8 +545,8 @@ public async Task> ListByResourceGroupNextPageA /// Retrieves the properties of all Confidential Ledgers. /// The URL to the next page of results. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. /// The cancellation token to use. /// , or is null. @@ -589,7 +589,7 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// Retrieves the properties of all Confidential Ledgers. /// The URL to the next page of results. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + /// The ID of the target subscription. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. /// The cancellation token to use. /// or is null. @@ -617,7 +617,7 @@ public async Task> ListBySubscriptionNextPageAs /// Retrieves the properties of all Confidential Ledgers. /// The URL to the next page of results. - /// The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + /// The ID of the target subscription. /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. /// The cancellation token to use. /// or is null. diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ManagedCCFRestOperations.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ManagedCCFRestOperations.cs new file mode 100644 index 000000000000..61dc3c1c608b --- /dev/null +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/RestOperations/ManagedCCFRestOperations.cs @@ -0,0 +1,646 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ConfidentialLedger.Models; + +namespace Azure.ResourceManager.ConfidentialLedger +{ + internal partial class ManagedCCFRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ManagedCCFRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ManagedCCFRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-01-26-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string appName) + { + 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.ConfidentialLedger/managedCCFs/", false); + uri.AppendPath(appName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Retrieves the properties of a Managed CCF app. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the Managed CCF. + /// 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 appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, appName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedCCFData.DeserializeManagedCCFData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedCCFData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Retrieves the properties of a Managed CCF app. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the Managed CCF. + /// 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 appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, appName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedCCFData.DeserializeManagedCCFData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedCCFData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string appName) + { + 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.ConfidentialLedger/managedCCFs/", false); + uri.AppendPath(appName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes an existing Managed CCF. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the Managed CCF. + /// 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 appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, appName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes an existing Managed CCF. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the Managed CCF. + /// 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 appName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, appName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string appName, ManagedCCFData data) + { + 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.ConfidentialLedger/managedCCFs/", false); + uri.AppendPath(appName, 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(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a Managed CCF with the specified Managed CCF parameters. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the Managed CCF. + /// Managed CCF Create Request Body. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string appName, ManagedCCFData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, appName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates a Managed CCF with the specified Managed CCF parameters. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the Managed CCF. + /// Managed CCF Create Request Body. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string appName, ManagedCCFData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, appName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string appName, ManagedCCFData data) + { + 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.ConfidentialLedger/managedCCFs/", false); + uri.AppendPath(appName, 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(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates properties of Managed CCF. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the Managed CCF. + /// Request body for Updating Managed CCF App. + /// 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 appName, ManagedCCFData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, appName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates properties of Managed CCF. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// Name of the Managed CCF. + /// Request body for Updating Managed CCF App. + /// 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 appName, ManagedCCFData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(appName, nameof(appName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, appName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter) + { + 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.ConfidentialLedger/managedCCFs", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Retrieves the properties of all Managed CCF apps. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedCCFList.DeserializeManagedCCFList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Retrieves the properties of all Managed CCF apps. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedCCFList.DeserializeManagedCCFList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter) + { + 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("/providers/Microsoft.ConfidentialLedger/managedCCFs/", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Retrieves the properties of all Managed CCF. + /// The ID of the target subscription. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedCCFList.DeserializeManagedCCFList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Retrieves the properties of all Managed CCF. + /// The ID of the target subscription. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedCCFList.DeserializeManagedCCFList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Retrieves the properties of all Managed CCF apps. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedCCFList.DeserializeManagedCCFList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Retrieves the properties of all Managed CCF apps. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedCCFList.DeserializeManagedCCFList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Retrieves the properties of all Managed CCF. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedCCFList.DeserializeManagedCCFList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Retrieves the properties of all Managed CCF. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedCCFList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedCCFList.DeserializeManagedCCFList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/autorest.md b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/autorest.md index dbd498ebdf6e..844b442a1656 100644 --- a/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/autorest.md +++ b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/autorest.md @@ -9,7 +9,7 @@ generate-model-factory: false csharp: true library-name: ConfidentialLedger namespace: Azure.ResourceManager.ConfidentialLedger -require: https://github.com/Azure/azure-rest-api-specs/blob/e7bcafa885ef773c6309d6a8f3a65c5019df413d/specification/confidentialledger/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/confidentialledger/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true