diff --git a/doc/GeneratorMigration/Library_Inventory.md b/doc/GeneratorMigration/Library_Inventory.md index 2080a7e81dc6..989f1132d0f5 100644 --- a/doc/GeneratorMigration/Library_Inventory.md +++ b/doc/GeneratorMigration/Library_Inventory.md @@ -2,11 +2,11 @@ ## Summary -- Total libraries: 412 -- Management Plane (Swagger): 167 -- Management Plane (TSP-Old): 52 +- Total libraries: 414 +- Management Plane (Swagger): 165 +- Management Plane (TSP-Old): 55 - Management Plane (TypeSpec - @azure-typespec/http-client-csharp): 0 -- Management Plane (TypeSpec - @azure-typespec/http-client-csharp-mgmt): 3 +- Management Plane (TypeSpec - @azure-typespec/http-client-csharp-mgmt): 4 - Management Plane (TypeSpec - @typespec/http-client-csharp): 0 - Data Plane (Swagger): 115 - Data Plane (TSP-Old): 27 @@ -202,24 +202,26 @@ Total: 115 ## Management Plane Libraries using TypeSpec (@azure-typespec/http-client-csharp-mgmt) -TypeSpec with @azure-typespec/http-client-csharp-mgmt generator is detected by the presence of a tsp-location.yaml file with an emitterPackageJsonPath value referencing @azure-typespec/http-client-csharp-mgmt, or through special handling for specific libraries. Total: 3 +TypeSpec with @azure-typespec/http-client-csharp-mgmt generator is detected by the presence of a tsp-location.yaml file with an emitterPackageJsonPath value referencing @azure-typespec/http-client-csharp-mgmt, or through special handling for specific libraries. Total: 4 | Service | Library | Path | | ------- | ------- | ---- | | computerecommender | Azure.ResourceManager.Compute.Recommender | sdk/computerecommender/Azure.ResourceManager.Compute.Recommender | +| hybridkubernetes | Azure.ResourceManager.Kubernetes | sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes | | portalservices | Azure.ResourceManager.PortalServicesCopilot | sdk/portalservices/Azure.ResourceManager.PortalServicesCopilot | | storageactions | Azure.ResourceManager.StorageActions | sdk/storageactions/Azure.ResourceManager.StorageActions | ## Management Plane Libraries using TypeSpec (Old Generator) -TypeSpec with old generator is detected by the presence of a tsp-location.yaml file without an emitterPackageJsonPath value, tspconfig.yaml file, tsp directory, or *.tsp files. Total: 52 +TypeSpec with old generator is detected by the presence of a tsp-location.yaml file without an emitterPackageJsonPath value, tspconfig.yaml file, tsp directory, or *.tsp files. Total: 55 | Service | Library | Path | | ------- | ------- | ---- | | agricultureplatform | Azure.ResourceManager.AgriculturePlatform | sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform | | arizeaiobservabilityeval | Azure.ResourceManager.ArizeAIObservabilityEval | sdk/arizeaiobservabilityeval/Azure.ResourceManager.ArizeAIObservabilityEval | | avs | Azure.ResourceManager.Avs | sdk/avs/Azure.ResourceManager.Avs | +| azurestackhci | Azure.ResourceManager.Hci.Vm | sdk/azurestackhci/Azure.ResourceManager.Hci.Vm | | carbon | Azure.ResourceManager.CarbonOptimization | sdk/carbon/Azure.ResourceManager.CarbonOptimization | | chaos | Azure.ResourceManager.Chaos | sdk/chaos/Azure.ResourceManager.Chaos | | cloudhealth | Azure.ResourceManager.CloudHealth | sdk/cloudhealth/Azure.ResourceManager.CloudHealth | @@ -254,6 +256,7 @@ TypeSpec with old generator is detected by the presence of a tsp-location.yaml f | planetarycomputer | Azure.ResourceManager.PlanetaryComputer | sdk/planetarycomputer/Azure.ResourceManager.PlanetaryComputer | | playwright | Azure.ResourceManager.Playwright | sdk/playwright/Azure.ResourceManager.Playwright | | purestorageblock | Azure.ResourceManager.PureStorageBlock | sdk/purestorageblock/Azure.ResourceManager.PureStorageBlock | +| quota | Azure.ResourceManager.Quota | sdk/quota/Azure.ResourceManager.Quota | | recoveryservices | Azure.ResourceManager.RecoveryServices | sdk/recoveryservices/Azure.ResourceManager.RecoveryServices | | recoveryservices-datareplication | Azure.ResourceManager.RecoveryServicesDataReplication | sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication | | resources | Azure.ResourceManager.Resources.Bicep | sdk/resources/Azure.ResourceManager.Resources.Bicep | @@ -266,6 +269,7 @@ TypeSpec with old generator is detected by the presence of a tsp-location.yaml f | storagediscovery | Azure.ResourceManager.StorageDiscovery | sdk/storagediscovery/Azure.ResourceManager.StorageDiscovery | | storagemover | Azure.ResourceManager.StorageMover | sdk/storagemover/Azure.ResourceManager.StorageMover | | terraform | Azure.ResourceManager.Terraform | sdk/terraform/Azure.ResourceManager.Terraform | +| virtualenclaves | Azure.ResourceManager.VirtualEnclaves | sdk/virtualenclaves/Azure.ResourceManager.VirtualEnclaves | | weightsandbiases | Azure.ResourceManager.WeightsAndBiases | sdk/weightsandbiases/Azure.ResourceManager.WeightsAndBiases | | workloadorchestration | Azure.ResourceManager.WorkloadOrchestration | sdk/workloadorchestration/Azure.ResourceManager.WorkloadOrchestration | | workloadssapvirtualinstance | Azure.ResourceManager.WorkloadsSapVirtualInstance | sdk/workloadssapvirtualinstance/Azure.ResourceManager.WorkloadsSapVirtualInstance | @@ -273,7 +277,7 @@ TypeSpec with old generator is detected by the presence of a tsp-location.yaml f ## Management Plane Libraries using Swagger -Total: 167 +Total: 165 | Service | Library | Path | | ------- | ------- | ---- | @@ -352,7 +356,6 @@ Total: 167 | healthcareapis | Azure.ResourceManager.HealthcareApis | sdk/healthcareapis/Azure.ResourceManager.HealthcareApis | | hybridaks | Azure.ResourceManager.HybridContainerService | sdk/hybridaks/Azure.ResourceManager.HybridContainerService | | hybridcompute | Azure.ResourceManager.HybridCompute | sdk/hybridcompute/Azure.ResourceManager.HybridCompute | -| hybridkubernetes | Azure.ResourceManager.Kubernetes | sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes | | hybridnetwork | Azure.ResourceManager.HybridNetwork | sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork | | iot | Azure.ResourceManager.IotFirmwareDefense | sdk/iot/Azure.ResourceManager.IotFirmwareDefense | | iotcentral | Azure.ResourceManager.IotCentral | sdk/iotcentral/Azure.ResourceManager.IotCentral | @@ -402,7 +405,6 @@ Total: 167 | purview | Azure.ResourceManager.Purview | sdk/purview/Azure.ResourceManager.Purview | | quantum | Azure.ResourceManager.Quantum | sdk/quantum/Azure.ResourceManager.Quantum | | qumulo | Azure.ResourceManager.Qumulo | sdk/qumulo/Azure.ResourceManager.Qumulo | -| quota | Azure.ResourceManager.Quota | sdk/quota/Azure.ResourceManager.Quota | | recoveryservices-backup | Azure.ResourceManager.RecoveryServicesBackup | sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup | | recoveryservices-siterecovery | Azure.ResourceManager.RecoveryServicesSiteRecovery | sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery | | redis | Azure.ResourceManager.Redis | sdk/redis/Azure.ResourceManager.Redis | diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/CHANGELOG.md b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/CHANGELOG.md index 0d3da3652f11..8cfbb6e5d30a 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/CHANGELOG.md +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/CHANGELOG.md @@ -6,6 +6,8 @@ ### Breaking Changes +- Disabled client flatten on `ConnectedClusterData` since client flatten feature is now marked as deprecated. + ### Bugs Fixed ### Other Changes diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.net8.0.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.net8.0.cs index 75d2fa2980d7..550a2d982f86 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.net8.0.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.net8.0.cs @@ -25,23 +25,14 @@ protected ConnectedClusterCollection() { } } public partial class ConnectedClusterData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public ConnectedClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.Models.ManagedServiceIdentity identity, string agentPublicKeyCertificate) { } - public string AgentPublicKeyCertificate { get { throw null; } set { } } - public string AgentVersion { get { throw null; } } - public Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? ConnectivityStatus { get { throw null; } } - public string Distribution { get { throw null; } set { } } + public ConnectedClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties properties, Azure.ResourceManager.Models.ManagedServiceIdentity identity) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } - public string Infrastructure { get { throw null; } set { } } - public string KubernetesVersion { get { throw null; } } - public System.DateTimeOffset? LastConnectivityOn { get { throw null; } } - public System.DateTimeOffset? ManagedIdentityCertificateExpirationOn { get { throw null; } } - public string Offering { get { throw null; } } - public string PrivateLinkScopeResourceId { get { throw null; } set { } } - public Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? PrivateLinkState { get { throw null; } set { } } - public Azure.ResourceManager.Kubernetes.Models.ProvisioningState? ProvisioningState { get { throw null; } set { } } - public int? TotalCoreCount { get { throw null; } } - public int? TotalNodeCount { get { throw null; } } + public Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind? Kind { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties Properties { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.ConnectedClusterData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.ConnectedClusterData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -108,12 +99,87 @@ protected MockableKubernetesSubscriptionResource() { } } namespace Azure.ResourceManager.Kubernetes.Models { + public partial class AadProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AadProfile() { } + public System.Collections.Generic.IList AdminGroupObjectIDs { get { throw null; } } + public bool? EnableAzureRBAC { get { throw null; } set { } } + public string TenantID { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.AadProfile JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.AadProfile PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.AadProfile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.AadProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AgentError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgentError() { } + public string Component { get { throw null; } } + public string Message { get { throw null; } } + public string Severity { get { throw null; } } + public System.DateTimeOffset? Time { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.AgentError JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.AgentError PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.AgentError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.AgentError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ArcAgentProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArcAgentProfile() { } + public Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions? AgentAutoUpgrade { get { throw null; } set { } } + public System.Collections.Generic.IList AgentErrors { get { throw null; } } + public string AgentState { get { throw null; } } + public string DesiredAgentVersion { get { throw null; } set { } } + public System.Collections.Generic.IList SystemComponents { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ArcAgentryConfigurations : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArcAgentryConfigurations() { } + public string Feature { get { throw null; } set { } } + public System.Collections.Generic.IDictionary ProtectedSettings { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Settings { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ArcAgentryConfigurations JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ArcAgentryConfigurations PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.ArcAgentryConfigurations System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.ArcAgentryConfigurations System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public static partial class ArmKubernetesModelFactory { - public static Azure.ResourceManager.Kubernetes.ConnectedClusterData ConnectedClusterData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, string agentPublicKeyCertificate = null, string kubernetesVersion = null, int? totalNodeCount = default(int?), int? totalCoreCount = default(int?), string agentVersion = null, Azure.ResourceManager.Kubernetes.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Kubernetes.Models.ProvisioningState?), string distribution = null, string infrastructure = null, string offering = null, System.DateTimeOffset? managedIdentityCertificateExpirationOn = default(System.DateTimeOffset?), System.DateTimeOffset? lastConnectivityOn = default(System.DateTimeOffset?), Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? connectivityStatus = default(Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus?), Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? privateLinkState = default(Azure.ResourceManager.Kubernetes.Models.PrivateLinkState?), string privateLinkScopeResourceId = null) { throw null; } - public static Azure.ResourceManager.Kubernetes.Models.CredentialResult CredentialResult(string name = null, byte[] value = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.AadProfile AadProfile(bool? enableAzureRBAC = default(bool?), System.Collections.Generic.IEnumerable adminGroupObjectIDs = null, string tenantID = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.AgentError AgentError(string message = null, string severity = null, string component = null, System.DateTimeOffset? time = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile ArcAgentProfile(string desiredAgentVersion = null, Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions? agentAutoUpgrade = default(Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions?), System.Collections.Generic.IEnumerable systemComponents = null, System.Collections.Generic.IEnumerable agentErrors = null, string agentState = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.ConnectedClusterData ConnectedClusterData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind? kind = default(Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind?)) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch ConnectedClusterPatch(System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties properties = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties ConnectedClusterProperties(string agentPublicKeyCertificate = null, string kubernetesVersion = null, int? totalNodeCount = default(int?), int? totalCoreCount = default(int?), string agentVersion = null, Azure.ResourceManager.Kubernetes.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Kubernetes.Models.ProvisioningState?), string distribution = null, string distributionVersion = null, string infrastructure = null, string offering = null, System.DateTimeOffset? managedIdentityCertificateExpirationTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastConnectivityTime = default(System.DateTimeOffset?), Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? connectivityStatus = default(Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus?), Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? privateLinkState = default(Azure.ResourceManager.Kubernetes.Models.PrivateLinkState?), string privateLinkScopeResourceId = null, Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit? azureHybridBenefit = default(Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit?), Azure.ResourceManager.Kubernetes.Models.AadProfile aadProfile = null, Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile arcAgentProfile = null, Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity securityWorkloadIdentity = null, Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile oidcIssuerProfile = null, bool? gatewayEnabled = default(bool?), System.Collections.Generic.IEnumerable arcAgentryConfigurations = null, System.Collections.Generic.IReadOnlyDictionary miscellaneousProperties = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.CredentialResult CredentialResult(string name = null, System.BinaryData value = null) { throw null; } public static Azure.ResourceManager.Kubernetes.Models.CredentialResults CredentialResults(Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig hybridConnectionConfig = null, System.Collections.Generic.IEnumerable kubeconfigs = null) { throw null; } - public static Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig HybridConnectionConfig(long? expirationTime = default(long?), string hybridConnectionName = null, string relay = null, string token = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig HybridConnectionConfig(long? expirationTime = default(long?), string hybridConnectionName = null, string relay = null, string token = null, string relayTid = null, string relayType = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties ListClusterUserCredentialProperties(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod authenticationMethod = default(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod), bool clientProxy = false) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile OidcIssuerProfile(bool? enabled = default(bool?), string issuerUri = null, string selfHostedIssuerUri = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.SystemComponent SystemComponent(string type = null, string userSpecifiedVersion = null, int? majorVersion = default(int?), string currentVersion = null) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AuthenticationMethod : System.IEquatable @@ -130,27 +196,144 @@ public static partial class ArmKubernetesModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod left, Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod right) { throw null; } public static implicit operator Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod left, Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AutoUpgradeOptions : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AutoUpgradeOptions(string value) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions Disabled { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions 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.Kubernetes.Models.AutoUpgradeOptions left, Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions right) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions left, Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AzureHybridBenefit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AzureHybridBenefit(string value) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit False { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit NotApplicable { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit True { get { throw null; } } + public bool Equals(Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit 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.Kubernetes.Models.AzureHybridBenefit left, Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit right) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit left, Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ConnectedClusterKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ConnectedClusterKind(string value) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind AWS { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind GCP { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind ProvisionedCluster { get { throw null; } } + public bool Equals(Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind 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.Kubernetes.Models.ConnectedClusterKind left, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind right) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind left, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind right) { throw null; } + public override string ToString() { throw null; } + } public partial class ConnectedClusterPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ConnectedClusterPatch() { } - public System.BinaryData Properties { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConnectedClusterPatchProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectedClusterPatchProperties() { } + public Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit? AzureHybridBenefit { get { throw null; } set { } } + public string Distribution { get { throw null; } set { } } + public string DistributionVersion { get { throw null; } set { } } + public bool? GatewayEnabled { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConnectedClusterProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectedClusterProperties(string agentPublicKeyCertificate) { } + public Azure.ResourceManager.Kubernetes.Models.AadProfile AadProfile { get { throw null; } set { } } + public string AgentPublicKeyCertificate { get { throw null; } set { } } + public string AgentVersion { get { throw null; } } + public Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile ArcAgentProfile { get { throw null; } set { } } + public System.Collections.Generic.IList ArcAgentryConfigurations { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit? AzureHybridBenefit { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? ConnectivityStatus { get { throw null; } } + public string Distribution { get { throw null; } set { } } + public string DistributionVersion { get { throw null; } set { } } + public bool? GatewayEnabled { get { throw null; } set { } } + public string Infrastructure { get { throw null; } set { } } + public string KubernetesVersion { get { throw null; } } + public System.DateTimeOffset? LastConnectivityTime { get { throw null; } } + public System.DateTimeOffset? ManagedIdentityCertificateExpirationTime { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary MiscellaneousProperties { get { throw null; } } + public string Offering { get { throw null; } } + public Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile OidcIssuerProfile { get { throw null; } set { } } + public string PrivateLinkScopeResourceId { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? PrivateLinkState { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.ProvisioningState? ProvisioningState { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity SecurityWorkloadIdentity { get { throw null; } set { } } + public int? TotalCoreCount { get { throw null; } } + public int? TotalNodeCount { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ConnectivityStatus : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; public ConnectivityStatus(string value) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus AgentNotInstalled { get { throw null; } } public static Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus Connected { get { throw null; } } public static Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus Connecting { get { throw null; } } public static Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus Expired { get { throw null; } } @@ -162,6 +345,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus left, Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus right) { throw null; } public static implicit operator Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus left, Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus right) { throw null; } public override string ToString() { throw null; } } @@ -169,8 +353,11 @@ public partial class CredentialResult : System.ClientModel.Primitives.IJsonModel { internal CredentialResult() { } public string Name { get { throw null; } } - public byte[] Value { get { throw null; } } + public System.BinaryData Value { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.CredentialResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.CredentialResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.CredentialResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.CredentialResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -182,7 +369,10 @@ public partial class CredentialResults : System.ClientModel.Primitives.IJsonMode internal CredentialResults() { } public Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig HybridConnectionConfig { get { throw null; } } public System.Collections.Generic.IReadOnlyList Kubeconfigs { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.CredentialResults JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.CredentialResults PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.CredentialResults System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.CredentialResults System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -195,8 +385,13 @@ internal HybridConnectionConfig() { } public long? ExpirationTime { get { throw null; } } public string HybridConnectionName { get { throw null; } } public string Relay { get { throw null; } } + public string RelayTid { get { throw null; } } + public string RelayType { get { throw null; } } public string Token { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -208,13 +403,32 @@ public partial class ListClusterUserCredentialProperties : System.ClientModel.Pr public ListClusterUserCredentialProperties(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod authenticationMethod, bool clientProxy) { } public Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod AuthenticationMethod { get { throw null; } } public bool ClientProxy { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class OidcIssuerProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OidcIssuerProfile() { } + public bool? Enabled { get { throw null; } set { } } + public string IssuerUri { get { throw null; } } + public string SelfHostedIssuerUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct PrivateLinkState : System.IEquatable { @@ -230,6 +444,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Kubernetes.Models.PrivateLinkState left, Azure.ResourceManager.Kubernetes.Models.PrivateLinkState right) { throw null; } public static implicit operator Azure.ResourceManager.Kubernetes.Models.PrivateLinkState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.PrivateLinkState left, Azure.ResourceManager.Kubernetes.Models.PrivateLinkState right) { throw null; } public override string ToString() { throw null; } } @@ -253,7 +468,39 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Kubernetes.Models.ProvisioningState left, Azure.ResourceManager.Kubernetes.Models.ProvisioningState right) { throw null; } public static implicit operator Azure.ResourceManager.Kubernetes.Models.ProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.ProvisioningState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.ProvisioningState left, Azure.ResourceManager.Kubernetes.Models.ProvisioningState right) { throw null; } public override string ToString() { throw null; } } + public partial class SecurityProfileWorkloadIdentity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecurityProfileWorkloadIdentity() { } + public bool? Enabled { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SystemComponent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SystemComponent() { } + public string CurrentVersion { get { throw null; } } + public int? MajorVersion { get { throw null; } set { } } + public string Type { get { throw null; } set { } } + public string UserSpecifiedVersion { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.SystemComponent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.SystemComponent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.SystemComponent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.SystemComponent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.netstandard2.0.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.netstandard2.0.cs index 75d2fa2980d7..550a2d982f86 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.netstandard2.0.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/api/Azure.ResourceManager.Kubernetes.netstandard2.0.cs @@ -25,23 +25,14 @@ protected ConnectedClusterCollection() { } } public partial class ConnectedClusterData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public ConnectedClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.Models.ManagedServiceIdentity identity, string agentPublicKeyCertificate) { } - public string AgentPublicKeyCertificate { get { throw null; } set { } } - public string AgentVersion { get { throw null; } } - public Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? ConnectivityStatus { get { throw null; } } - public string Distribution { get { throw null; } set { } } + public ConnectedClusterData(Azure.Core.AzureLocation location, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties properties, Azure.ResourceManager.Models.ManagedServiceIdentity identity) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } - public string Infrastructure { get { throw null; } set { } } - public string KubernetesVersion { get { throw null; } } - public System.DateTimeOffset? LastConnectivityOn { get { throw null; } } - public System.DateTimeOffset? ManagedIdentityCertificateExpirationOn { get { throw null; } } - public string Offering { get { throw null; } } - public string PrivateLinkScopeResourceId { get { throw null; } set { } } - public Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? PrivateLinkState { get { throw null; } set { } } - public Azure.ResourceManager.Kubernetes.Models.ProvisioningState? ProvisioningState { get { throw null; } set { } } - public int? TotalCoreCount { get { throw null; } } - public int? TotalNodeCount { get { throw null; } } + public Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind? Kind { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties Properties { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.ConnectedClusterData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.ConnectedClusterData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -108,12 +99,87 @@ protected MockableKubernetesSubscriptionResource() { } } namespace Azure.ResourceManager.Kubernetes.Models { + public partial class AadProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AadProfile() { } + public System.Collections.Generic.IList AdminGroupObjectIDs { get { throw null; } } + public bool? EnableAzureRBAC { get { throw null; } set { } } + public string TenantID { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.AadProfile JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.AadProfile PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.AadProfile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.AadProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AgentError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgentError() { } + public string Component { get { throw null; } } + public string Message { get { throw null; } } + public string Severity { get { throw null; } } + public System.DateTimeOffset? Time { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.AgentError JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.AgentError PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.AgentError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.AgentError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ArcAgentProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArcAgentProfile() { } + public Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions? AgentAutoUpgrade { get { throw null; } set { } } + public System.Collections.Generic.IList AgentErrors { get { throw null; } } + public string AgentState { get { throw null; } } + public string DesiredAgentVersion { get { throw null; } set { } } + public System.Collections.Generic.IList SystemComponents { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ArcAgentryConfigurations : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArcAgentryConfigurations() { } + public string Feature { get { throw null; } set { } } + public System.Collections.Generic.IDictionary ProtectedSettings { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Settings { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ArcAgentryConfigurations JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ArcAgentryConfigurations PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.ArcAgentryConfigurations System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.ArcAgentryConfigurations System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public static partial class ArmKubernetesModelFactory { - public static Azure.ResourceManager.Kubernetes.ConnectedClusterData ConnectedClusterData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, string agentPublicKeyCertificate = null, string kubernetesVersion = null, int? totalNodeCount = default(int?), int? totalCoreCount = default(int?), string agentVersion = null, Azure.ResourceManager.Kubernetes.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Kubernetes.Models.ProvisioningState?), string distribution = null, string infrastructure = null, string offering = null, System.DateTimeOffset? managedIdentityCertificateExpirationOn = default(System.DateTimeOffset?), System.DateTimeOffset? lastConnectivityOn = default(System.DateTimeOffset?), Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? connectivityStatus = default(Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus?), Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? privateLinkState = default(Azure.ResourceManager.Kubernetes.Models.PrivateLinkState?), string privateLinkScopeResourceId = null) { throw null; } - public static Azure.ResourceManager.Kubernetes.Models.CredentialResult CredentialResult(string name = null, byte[] value = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.AadProfile AadProfile(bool? enableAzureRBAC = default(bool?), System.Collections.Generic.IEnumerable adminGroupObjectIDs = null, string tenantID = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.AgentError AgentError(string message = null, string severity = null, string component = null, System.DateTimeOffset? time = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile ArcAgentProfile(string desiredAgentVersion = null, Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions? agentAutoUpgrade = default(Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions?), System.Collections.Generic.IEnumerable systemComponents = null, System.Collections.Generic.IEnumerable agentErrors = null, string agentState = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.ConnectedClusterData ConnectedClusterData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind? kind = default(Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind?)) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch ConnectedClusterPatch(System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties properties = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties ConnectedClusterProperties(string agentPublicKeyCertificate = null, string kubernetesVersion = null, int? totalNodeCount = default(int?), int? totalCoreCount = default(int?), string agentVersion = null, Azure.ResourceManager.Kubernetes.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Kubernetes.Models.ProvisioningState?), string distribution = null, string distributionVersion = null, string infrastructure = null, string offering = null, System.DateTimeOffset? managedIdentityCertificateExpirationTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastConnectivityTime = default(System.DateTimeOffset?), Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? connectivityStatus = default(Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus?), Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? privateLinkState = default(Azure.ResourceManager.Kubernetes.Models.PrivateLinkState?), string privateLinkScopeResourceId = null, Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit? azureHybridBenefit = default(Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit?), Azure.ResourceManager.Kubernetes.Models.AadProfile aadProfile = null, Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile arcAgentProfile = null, Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity securityWorkloadIdentity = null, Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile oidcIssuerProfile = null, bool? gatewayEnabled = default(bool?), System.Collections.Generic.IEnumerable arcAgentryConfigurations = null, System.Collections.Generic.IReadOnlyDictionary miscellaneousProperties = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.CredentialResult CredentialResult(string name = null, System.BinaryData value = null) { throw null; } public static Azure.ResourceManager.Kubernetes.Models.CredentialResults CredentialResults(Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig hybridConnectionConfig = null, System.Collections.Generic.IEnumerable kubeconfigs = null) { throw null; } - public static Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig HybridConnectionConfig(long? expirationTime = default(long?), string hybridConnectionName = null, string relay = null, string token = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig HybridConnectionConfig(long? expirationTime = default(long?), string hybridConnectionName = null, string relay = null, string token = null, string relayTid = null, string relayType = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties ListClusterUserCredentialProperties(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod authenticationMethod = default(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod), bool clientProxy = false) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile OidcIssuerProfile(bool? enabled = default(bool?), string issuerUri = null, string selfHostedIssuerUri = null) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.SystemComponent SystemComponent(string type = null, string userSpecifiedVersion = null, int? majorVersion = default(int?), string currentVersion = null) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AuthenticationMethod : System.IEquatable @@ -130,27 +196,144 @@ public static partial class ArmKubernetesModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod left, Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod right) { throw null; } public static implicit operator Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod left, Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AutoUpgradeOptions : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AutoUpgradeOptions(string value) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions Disabled { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions 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.Kubernetes.Models.AutoUpgradeOptions left, Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions right) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions left, Azure.ResourceManager.Kubernetes.Models.AutoUpgradeOptions right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AzureHybridBenefit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AzureHybridBenefit(string value) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit False { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit NotApplicable { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit True { get { throw null; } } + public bool Equals(Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit 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.Kubernetes.Models.AzureHybridBenefit left, Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit right) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit left, Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ConnectedClusterKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ConnectedClusterKind(string value) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind AWS { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind GCP { get { throw null; } } + public static Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind ProvisionedCluster { get { throw null; } } + public bool Equals(Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind 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.Kubernetes.Models.ConnectedClusterKind left, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind right) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind left, Azure.ResourceManager.Kubernetes.Models.ConnectedClusterKind right) { throw null; } + public override string ToString() { throw null; } + } public partial class ConnectedClusterPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ConnectedClusterPatch() { } - public System.BinaryData Properties { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class ConnectedClusterPatchProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectedClusterPatchProperties() { } + public Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit? AzureHybridBenefit { get { throw null; } set { } } + public string Distribution { get { throw null; } set { } } + public string DistributionVersion { get { throw null; } set { } } + public bool? GatewayEnabled { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.ConnectedClusterPatchProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConnectedClusterProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectedClusterProperties(string agentPublicKeyCertificate) { } + public Azure.ResourceManager.Kubernetes.Models.AadProfile AadProfile { get { throw null; } set { } } + public string AgentPublicKeyCertificate { get { throw null; } set { } } + public string AgentVersion { get { throw null; } } + public Azure.ResourceManager.Kubernetes.Models.ArcAgentProfile ArcAgentProfile { get { throw null; } set { } } + public System.Collections.Generic.IList ArcAgentryConfigurations { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.AzureHybridBenefit? AzureHybridBenefit { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? ConnectivityStatus { get { throw null; } } + public string Distribution { get { throw null; } set { } } + public string DistributionVersion { get { throw null; } set { } } + public bool? GatewayEnabled { get { throw null; } set { } } + public string Infrastructure { get { throw null; } set { } } + public string KubernetesVersion { get { throw null; } } + public System.DateTimeOffset? LastConnectivityTime { get { throw null; } } + public System.DateTimeOffset? ManagedIdentityCertificateExpirationTime { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary MiscellaneousProperties { get { throw null; } } + public string Offering { get { throw null; } } + public Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile OidcIssuerProfile { get { throw null; } set { } } + public string PrivateLinkScopeResourceId { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? PrivateLinkState { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.ProvisioningState? ProvisioningState { get { throw null; } set { } } + public Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity SecurityWorkloadIdentity { get { throw null; } set { } } + public int? TotalCoreCount { get { throw null; } } + public int? TotalNodeCount { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.ConnectedClusterProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ConnectivityStatus : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; public ConnectivityStatus(string value) { throw null; } + public static Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus AgentNotInstalled { get { throw null; } } public static Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus Connected { get { throw null; } } public static Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus Connecting { get { throw null; } } public static Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus Expired { get { throw null; } } @@ -162,6 +345,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus left, Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus right) { throw null; } public static implicit operator Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus left, Azure.ResourceManager.Kubernetes.Models.ConnectivityStatus right) { throw null; } public override string ToString() { throw null; } } @@ -169,8 +353,11 @@ public partial class CredentialResult : System.ClientModel.Primitives.IJsonModel { internal CredentialResult() { } public string Name { get { throw null; } } - public byte[] Value { get { throw null; } } + public System.BinaryData Value { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.CredentialResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.CredentialResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.CredentialResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.CredentialResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -182,7 +369,10 @@ public partial class CredentialResults : System.ClientModel.Primitives.IJsonMode internal CredentialResults() { } public Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig HybridConnectionConfig { get { throw null; } } public System.Collections.Generic.IReadOnlyList Kubeconfigs { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.CredentialResults JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.CredentialResults PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.CredentialResults System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.CredentialResults System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -195,8 +385,13 @@ internal HybridConnectionConfig() { } public long? ExpirationTime { get { throw null; } } public string HybridConnectionName { get { throw null; } } public string Relay { get { throw null; } } + public string RelayTid { get { throw null; } } + public string RelayType { get { throw null; } } public string Token { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.HybridConnectionConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -208,13 +403,32 @@ public partial class ListClusterUserCredentialProperties : System.ClientModel.Pr public ListClusterUserCredentialProperties(Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod authenticationMethod, bool clientProxy) { } public Azure.ResourceManager.Kubernetes.Models.AuthenticationMethod AuthenticationMethod { get { throw null; } } public bool ClientProxy { get { throw null; } } + protected virtual Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Kubernetes.Models.ListClusterUserCredentialProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class OidcIssuerProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OidcIssuerProfile() { } + public bool? Enabled { get { throw null; } set { } } + public string IssuerUri { get { throw null; } } + public string SelfHostedIssuerUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.OidcIssuerProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct PrivateLinkState : System.IEquatable { @@ -230,6 +444,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Kubernetes.Models.PrivateLinkState left, Azure.ResourceManager.Kubernetes.Models.PrivateLinkState right) { throw null; } public static implicit operator Azure.ResourceManager.Kubernetes.Models.PrivateLinkState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.PrivateLinkState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.PrivateLinkState left, Azure.ResourceManager.Kubernetes.Models.PrivateLinkState right) { throw null; } public override string ToString() { throw null; } } @@ -253,7 +468,39 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Kubernetes.Models.ProvisioningState left, Azure.ResourceManager.Kubernetes.Models.ProvisioningState right) { throw null; } public static implicit operator Azure.ResourceManager.Kubernetes.Models.ProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Kubernetes.Models.ProvisioningState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.Kubernetes.Models.ProvisioningState left, Azure.ResourceManager.Kubernetes.Models.ProvisioningState right) { throw null; } public override string ToString() { throw null; } } + public partial class SecurityProfileWorkloadIdentity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecurityProfileWorkloadIdentity() { } + public bool? Enabled { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.SecurityProfileWorkloadIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SystemComponent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SystemComponent() { } + public string CurrentVersion { get { throw null; } } + public int? MajorVersion { get { throw null; } set { } } + public string Type { get { throw null; } set { } } + public string UserSpecifiedVersion { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Kubernetes.Models.SystemComponent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Kubernetes.Models.SystemComponent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.Kubernetes.Models.SystemComponent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Kubernetes.Models.SystemComponent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ArmKubernetesModelFactory.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ArmKubernetesModelFactory.cs index 2ecff9d3f0c7..69f2631fce4c 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ArmKubernetesModelFactory.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ArmKubernetesModelFactory.cs @@ -9,21 +9,42 @@ using System.Collections.Generic; using System.Linq; using Azure.Core; +using Azure.ResourceManager.Kubernetes; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Kubernetes.Models { - /// Model factory for models. + /// A factory class for creating instances of the models for mocking. public static partial class ArmKubernetesModelFactory { - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The identity of the connected cluster. Current supported identity types: None, SystemAssigned. + /// Represents a connected cluster. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. + /// Describes the connected cluster resource properties. + /// The identity of the connected cluster. + /// The kind of connected cluster. + /// A new instance for mocking. + public static ConnectedClusterData ConnectedClusterData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, ConnectedClusterProperties properties = default, ManagedServiceIdentity identity = default, ConnectedClusterKind? kind = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new ConnectedClusterData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties: null, + tags, + location, + properties, + identity, + kind); + } + /// Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. /// The Kubernetes version of the connected cluster resource. /// Number of nodes present in the connected cluster resource. @@ -31,26 +52,29 @@ public static partial class ArmKubernetesModelFactory /// Version of the agent running on the connected cluster resource. /// Provisioning state of the connected cluster resource. /// The Kubernetes distribution running on this connected cluster. + /// The Kubernetes distribution version on this connected cluster. /// The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on. /// Connected cluster offering. - /// Expiration time of the managed identity certificate. - /// Time representing the last instance when heart beat was received from the cluster. + /// Expiration time of the managed identity certificate. + /// Time representing the last instance when heart beat was received from the cluster. /// Represents the connectivity status of the connected cluster. /// Property which describes the state of private link on a connected cluster resource. - /// The resource id of the private link scope this connected cluster is assigned to, if any. - /// A new instance for mocking. - public static ConnectedClusterData ConnectedClusterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, string agentPublicKeyCertificate = null, string kubernetesVersion = null, int? totalNodeCount = null, int? totalCoreCount = null, string agentVersion = null, ProvisioningState? provisioningState = null, string distribution = null, string infrastructure = null, string offering = null, DateTimeOffset? managedIdentityCertificateExpirationOn = null, DateTimeOffset? lastConnectivityOn = null, ConnectivityStatus? connectivityStatus = null, PrivateLinkState? privateLinkState = null, string privateLinkScopeResourceId = null) + /// This is populated only if privateLinkState is enabled. The resource id of the private link scope this connected cluster is assigned to, if any. + /// Indicates whether Azure Hybrid Benefit is opted in. + /// AAD profile for the connected cluster. + /// Arc agentry configuration for the provisioned cluster. + /// The workload identity feature webhook. + /// Open ID Connect (OIDC) Issuer Profile for the connected cluster. + /// Indicates whether the gateway for arc router connectivity is enabled. + /// Configuration settings for customizing the behavior of the connected cluster. + /// More properties related to the Connected Cluster. + /// A new instance for mocking. + public static ConnectedClusterProperties ConnectedClusterProperties(string agentPublicKeyCertificate = default, string kubernetesVersion = default, int? totalNodeCount = default, int? totalCoreCount = default, string agentVersion = default, ProvisioningState? provisioningState = default, string distribution = default, string distributionVersion = default, string infrastructure = default, string offering = default, DateTimeOffset? managedIdentityCertificateExpirationTime = default, DateTimeOffset? lastConnectivityTime = default, ConnectivityStatus? connectivityStatus = default, PrivateLinkState? privateLinkState = default, string privateLinkScopeResourceId = default, AzureHybridBenefit? azureHybridBenefit = default, AadProfile aadProfile = default, ArcAgentProfile arcAgentProfile = default, SecurityProfileWorkloadIdentity securityWorkloadIdentity = default, OidcIssuerProfile oidcIssuerProfile = default, bool? gatewayEnabled = default, IEnumerable arcAgentryConfigurations = default, IReadOnlyDictionary miscellaneousProperties = default) { - tags ??= new Dictionary(); + arcAgentryConfigurations ??= new ChangeTrackingList(); + miscellaneousProperties ??= new ChangeTrackingDictionary(); - return new ConnectedClusterData( - id, - name, - resourceType, - systemData, - tags, - location, - identity, + return new ConnectedClusterProperties( agentPublicKeyCertificate, kubernetesVersion, totalNodeCount, @@ -58,45 +82,148 @@ public static ConnectedClusterData ConnectedClusterData(ResourceIdentifier id = agentVersion, provisioningState, distribution, + distributionVersion, infrastructure, offering, - managedIdentityCertificateExpirationOn, - lastConnectivityOn, + managedIdentityCertificateExpirationTime, + lastConnectivityTime, connectivityStatus, privateLinkState, privateLinkScopeResourceId, - serializedAdditionalRawData: null); + azureHybridBenefit, + aadProfile, + arcAgentProfile, + securityWorkloadIdentity is null ? default : new SecurityProfile(securityWorkloadIdentity, new Dictionary()), + oidcIssuerProfile, + gatewayEnabled is null ? default : new Gateway(gatewayEnabled, new Dictionary()), + arcAgentryConfigurations.ToList(), + miscellaneousProperties, + additionalBinaryDataProperties: null); + } + + /// AAD Profile specifies attributes for Azure Active Directory integration. + /// Whether to enable Azure RBAC for Kubernetes authorization. + /// The list of AAD group object IDs that will have admin role of the cluster. + /// The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + /// A new instance for mocking. + public static AadProfile AadProfile(bool? enableAzureRBAC = default, IEnumerable adminGroupObjectIDs = default, string tenantID = default) + { + adminGroupObjectIDs ??= new ChangeTrackingList(); + + return new AadProfile(enableAzureRBAC, adminGroupObjectIDs.ToList(), tenantID, additionalBinaryDataProperties: null); + } + + /// Defines the Arc Agent properties for the clusters. + /// Version of the Arc agents to be installed on the cluster resource. + /// Indicates whether the Arc agents on the be upgraded automatically to the latest version. Defaults to Enabled. + /// List of system extensions that are installed on the cluster resource. + /// List of arc agentry and system components errors on the cluster resource. + /// Represents the current state of the Arc agentry and its dependent components. + /// A new instance for mocking. + public static ArcAgentProfile ArcAgentProfile(string desiredAgentVersion = default, AutoUpgradeOptions? agentAutoUpgrade = default, IEnumerable systemComponents = default, IEnumerable agentErrors = default, string agentState = default) + { + systemComponents ??= new ChangeTrackingList(); + agentErrors ??= new ChangeTrackingList(); + + return new ArcAgentProfile( + desiredAgentVersion, + agentAutoUpgrade, + systemComponents.ToList(), + agentErrors.ToList(), + agentState, + additionalBinaryDataProperties: null); + } + + /// System extensions and its current versions installed on the cluster resource. + /// Type of the system extension. + /// Version of the system extension to be installed on the cluster resource. + /// Major Version of the system extension that is currently installed on the cluster resource. + /// Version of the system extension that is currently installed on the cluster resource. + /// A new instance for mocking. + public static SystemComponent SystemComponent(string @type = default, string userSpecifiedVersion = default, int? majorVersion = default, string currentVersion = default) + { + return new SystemComponent(@type, userSpecifiedVersion, majorVersion, currentVersion, additionalBinaryDataProperties: null); + } + + /// Agent Errors if any during agent or system component upgrade. + /// Agent error message. + /// Severity of the error message. + /// Agent component where error message occured. + /// The timestamp of error occured (UTC). + /// A new instance for mocking. + public static AgentError AgentError(string message = default, string severity = default, string component = default, DateTimeOffset? time = default) + { + return new AgentError(message, severity, component, time, additionalBinaryDataProperties: null); + } + + /// OIDC Issuer Profile specifies attributes for workload identity integration. + /// Whether to enable oidc issuer for workload identity integration. + /// The issuer url for hybrid clusters connected to Arc used for the workload identity feature. + /// The issuer url for public cloud clusters - AKS, EKS, GKE - used for the workload identity feature. + /// A new instance for mocking. + public static OidcIssuerProfile OidcIssuerProfile(bool? enabled = default, string issuerUri = default, string selfHostedIssuerUri = default) + { + return new OidcIssuerProfile(enabled, issuerUri, selfHostedIssuerUri, additionalBinaryDataProperties: null); + } + + /// Object containing updates for patch operations. + /// Resource tags. + /// Describes the connected cluster resource properties that can be updated during PATCH operation. + /// A new instance for mocking. + public static ConnectedClusterPatch ConnectedClusterPatch(IDictionary tags = default, ConnectedClusterPatchProperties properties = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new ConnectedClusterPatch(tags, properties, additionalBinaryDataProperties: null); + } + + /// The ListClusterUserCredentialProperties. + /// The mode of client authentication. + /// Boolean value to indicate whether the request is for client side proxy or not. + /// A new instance for mocking. + public static ListClusterUserCredentialProperties ListClusterUserCredentialProperties(AuthenticationMethod authenticationMethod = default, bool clientProxy = default) + { + return new ListClusterUserCredentialProperties(authenticationMethod, clientProxy, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// The list of credential result response. /// Contains the REP (rendezvous endpoint) and “Sender” access token. /// Base64-encoded Kubernetes configuration file. /// A new instance for mocking. - public static CredentialResults CredentialResults(HybridConnectionConfig hybridConnectionConfig = null, IEnumerable kubeconfigs = null) + public static CredentialResults CredentialResults(HybridConnectionConfig hybridConnectionConfig = default, IEnumerable kubeconfigs = default) { - kubeconfigs ??= new List(); + kubeconfigs ??= new ChangeTrackingList(); - return new CredentialResults(hybridConnectionConfig, kubeconfigs?.ToList(), serializedAdditionalRawData: null); + return new CredentialResults(hybridConnectionConfig, kubeconfigs.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Contains the REP (rendezvous endpoint) and “Sender” access token. /// Timestamp when this token will be expired. /// Name of the connection. /// Name of the relay. /// Sender access token. + /// TenantID of the relay. + /// Type of relay. /// A new instance for mocking. - public static HybridConnectionConfig HybridConnectionConfig(long? expirationTime = null, string hybridConnectionName = null, string relay = null, string token = null) + public static HybridConnectionConfig HybridConnectionConfig(long? expirationTime = default, string hybridConnectionName = default, string relay = default, string token = default, string relayTid = default, string relayType = default) { - return new HybridConnectionConfig(expirationTime, hybridConnectionName, relay, token, serializedAdditionalRawData: null); + return new HybridConnectionConfig( + expirationTime, + hybridConnectionName, + relay, + token, + relayTid, + relayType, + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// The credential result response. /// The name of the credential. /// Base64-encoded Kubernetes configuration file. /// A new instance for mocking. - public static CredentialResult CredentialResult(string name = null, byte[] value = null) + public static CredentialResult CredentialResult(string name = default, BinaryData value = default) { - return new CredentialResult(name, value, serializedAdditionalRawData: null); + return new CredentialResult(name, value, additionalBinaryDataProperties: null); } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterCollection.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterCollection.cs index 8d2fc39a2a04..1d88ea2771f5 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterCollection.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterCollection.cs @@ -8,90 +8,86 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Kubernetes { /// /// 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 GetConnectedClusters method from an instance of . + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetConnectedClusters method from an instance of the parent resource. /// public partial class ConnectedClusterCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _connectedClusterClientDiagnostics; - private readonly ConnectedClusterRestOperations _connectedClusterRestClient; + private readonly ConnectedCluster _connectedClusterRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of ConnectedClusterCollection for mocking. protected ConnectedClusterCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. + /// The identifier of the resource that is the target of operations. internal ConnectedClusterCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _connectedClusterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Kubernetes", ConnectedClusterResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(ConnectedClusterResource.ResourceType, out string connectedClusterApiVersion); - _connectedClusterRestClient = new ConnectedClusterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, connectedClusterApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _connectedClusterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Kubernetes", ConnectedClusterResource.ResourceType.Namespace, Diagnostics); + _connectedClusterRestClient = new ConnectedCluster(_connectedClusterClientDiagnostics, Pipeline, Endpoint, connectedClusterApiVersion ?? "2025-12-01-preview"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] 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)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } } - /// - /// API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Create - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM). /// 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 name of the Kubernetes cluster on which get is called. /// Parameters supplied to Create a Connected Cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string clusterName, ConnectedClusterData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.CreateOrUpdate"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _connectedClusterRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, data, cancellationToken).ConfigureAwait(false); - var operation = new KubernetesArmOperation(new ConnectedClusterOperationSource(Client), _connectedClusterClientDiagnostics, Pipeline, _connectedClusterRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateCreateOrReplaceRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, ConnectedClusterData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + KubernetesArmOperation operation = new KubernetesArmOperation( + new ConnectedClusterOperationSource(Client), + _connectedClusterClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -101,46 +97,39 @@ public virtual async Task> CreateOrUpdate } } - /// - /// API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Create - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// API to register a new Kubernetes cluster and create or replace a connected cluster tracked resource in Azure Resource Manager (ARM). /// 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 name of the Kubernetes cluster on which get is called. /// Parameters supplied to Create a Connected Cluster. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string clusterName, ConnectedClusterData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.CreateOrUpdate"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.CreateOrUpdate"); scope.Start(); try { - var response = _connectedClusterRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, clusterName, data, cancellationToken); - var operation = new KubernetesArmOperation(new ConnectedClusterOperationSource(Client), _connectedClusterClientDiagnostics, Pipeline, _connectedClusterRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateCreateOrReplaceRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, ConnectedClusterData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + KubernetesArmOperation operation = new KubernetesArmOperation( + new ConnectedClusterOperationSource(Client), + _connectedClusterClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -150,42 +139,30 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w } } - /// - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetAsync(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.Get"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.Get"); scope.Start(); try { - var response = await _connectedClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -195,42 +172,30 @@ public virtual async Task> GetAsync(string cl } } - /// - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Get(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.Get"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.Get"); scope.Start(); try { - var response = _connectedClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -240,100 +205,50 @@ public virtual Response Get(string clusterName, Cancel } } - /// - /// API to enumerate registered connected K8s clusters under a Resource Group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters - /// - /// - /// Operation Id - /// ConnectedCluster_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// API to enumerate registered connected K8s clusters under a Resource Group. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _connectedClusterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectedClusterRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConnectedClusterResource(Client, ConnectedClusterData.DeserializeConnectedClusterData(e)), _connectedClusterClientDiagnostics, Pipeline, "ConnectedClusterCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ConnectedClusterGetByResourceGroupAsyncCollectionResultOfT(_connectedClusterRestClient, Id.SubscriptionId, Id.ResourceGroupName, context), data => new ConnectedClusterResource(Client, data)); } - /// - /// API to enumerate registered connected K8s clusters under a Resource Group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters - /// - /// - /// Operation Id - /// ConnectedCluster_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// API to enumerate registered connected K8s clusters under a Resource Group. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _connectedClusterRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectedClusterRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConnectedClusterResource(Client, ConnectedClusterData.DeserializeConnectedClusterData(e)), _connectedClusterClientDiagnostics, Pipeline, "ConnectedClusterCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ConnectedClusterGetByResourceGroupCollectionResultOfT(_connectedClusterRestClient, Id.SubscriptionId, Id.ResourceGroupName, context), data => new ConnectedClusterResource(Client, data)); } - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Checks to see if the resource exists in azure. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> ExistsAsync(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.Exists"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.Exists"); scope.Start(); try { - var response = await _connectedClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -343,40 +258,26 @@ public virtual async Task> ExistsAsync(string clusterName, Cancel } } - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Checks to see if the resource exists in azure. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual Response Exists(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.Exists"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.Exists"); scope.Start(); try { - var response = _connectedClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -386,42 +287,30 @@ public virtual Response Exists(string clusterName, CancellationToken cance } } - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Tries to get details for this resource from the service. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.GetIfExists"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.GetIfExists"); scope.Start(); try { - var response = await _connectedClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -431,42 +320,30 @@ public virtual async Task> GetIfExist } } - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Tries to get details for this resource from the service. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. + /// is an empty string, and was expected to be non-empty. public virtual NullableResponse GetIfExists(string clusterName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.GetIfExists"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterCollection.GetIfExists"); scope.Start(); try { - var response = _connectedClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, clusterName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, clusterName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -486,6 +363,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterData.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterData.Serialization.cs index 54994671d522..b3423afdbb6f 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterData.Serialization.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterData.Serialization.cs @@ -8,19 +8,25 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Kubernetes.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Kubernetes { - public partial class ConnectedClusterData : IUtf8JsonSerializable, IJsonModel + /// Represents a connected cluster. + public partial class ConnectedClusterData : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ConnectedClusterData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -32,748 +38,185 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ConnectedClusterData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); writer.WritePropertyName("identity"u8); ((IJsonModel)Identity).Write(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - writer.WritePropertyName("agentPublicKeyCertificate"u8); - writer.WriteStringValue(AgentPublicKeyCertificate); - if (options.Format != "W" && Optional.IsDefined(KubernetesVersion)) - { - writer.WritePropertyName("kubernetesVersion"u8); - writer.WriteStringValue(KubernetesVersion); - } - if (options.Format != "W" && Optional.IsDefined(TotalNodeCount)) + if (Optional.IsDefined(Kind)) { - writer.WritePropertyName("totalNodeCount"u8); - writer.WriteNumberValue(TotalNodeCount.Value); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.Value.ToString()); } - if (options.Format != "W" && Optional.IsDefined(TotalCoreCount)) - { - writer.WritePropertyName("totalCoreCount"u8); - writer.WriteNumberValue(TotalCoreCount.Value); - } - if (options.Format != "W" && Optional.IsDefined(AgentVersion)) - { - writer.WritePropertyName("agentVersion"u8); - writer.WriteStringValue(AgentVersion); - } - if (Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (Optional.IsDefined(Distribution)) - { - writer.WritePropertyName("distribution"u8); - writer.WriteStringValue(Distribution); - } - if (Optional.IsDefined(Infrastructure)) - { - writer.WritePropertyName("infrastructure"u8); - writer.WriteStringValue(Infrastructure); - } - if (options.Format != "W" && Optional.IsDefined(Offering)) - { - writer.WritePropertyName("offering"u8); - writer.WriteStringValue(Offering); - } - if (options.Format != "W" && Optional.IsDefined(ManagedIdentityCertificateExpirationOn)) - { - writer.WritePropertyName("managedIdentityCertificateExpirationTime"u8); - writer.WriteStringValue(ManagedIdentityCertificateExpirationOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(LastConnectivityOn)) - { - writer.WritePropertyName("lastConnectivityTime"u8); - writer.WriteStringValue(LastConnectivityOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(ConnectivityStatus)) - { - writer.WritePropertyName("connectivityStatus"u8); - writer.WriteStringValue(ConnectivityStatus.Value.ToString()); - } - if (Optional.IsDefined(PrivateLinkState)) - { - writer.WritePropertyName("privateLinkState"u8); - writer.WriteStringValue(PrivateLinkState.Value.ToString()); - } - if (Optional.IsDefined(PrivateLinkScopeResourceId)) - { - writer.WritePropertyName("privateLinkScopeResourceId"u8); - writer.WriteStringValue(PrivateLinkScopeResourceId); - } - writer.WriteEndObject(); } - ConnectedClusterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ConnectedClusterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (ConnectedClusterData)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ResourceData JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ConnectedClusterData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeConnectedClusterData(document.RootElement, options); } - internal static ConnectedClusterData DeserializeConnectedClusterData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ConnectedClusterData DeserializeConnectedClusterData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - ManagedServiceIdentity identity = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string agentPublicKeyCertificate = default; - string kubernetesVersion = default; - int? totalNodeCount = default; - int? totalCoreCount = default; - string agentVersion = default; - ProvisioningState? provisioningState = default; - string distribution = default; - string infrastructure = default; - string offering = default; - DateTimeOffset? managedIdentityCertificateExpirationTime = default; - DateTimeOffset? lastConnectivityTime = default; - ConnectivityStatus? connectivityStatus = default; - PrivateLinkState? privateLinkState = default; - string privateLinkScopeResourceId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + ConnectedClusterProperties properties = default; + ManagedServiceIdentity identity = default; + ConnectedClusterKind? kind = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("identity"u8)) + if (prop.NameEquals("id"u8)) { - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), options, AzureResourceManagerKubernetesContext.Default); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"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()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKubernetesContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKubernetesContext.Default); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("agentPublicKeyCertificate"u8)) - { - agentPublicKeyCertificate = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("kubernetesVersion"u8)) - { - kubernetesVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("totalNodeCount"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - totalNodeCount = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("totalCoreCount"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - totalCoreCount = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("agentVersion"u8)) - { - agentVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new ProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("distribution"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - distribution = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("infrastructure"u8)) + else { - infrastructure = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("offering"u8)) - { - offering = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("managedIdentityCertificateExpirationTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - managedIdentityCertificateExpirationTime = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("lastConnectivityTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - lastConnectivityTime = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("connectivityStatus"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - connectivityStatus = new ConnectivityStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("privateLinkState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateLinkState = new PrivateLinkState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("privateLinkScopeResourceId"u8)) - { - privateLinkScopeResourceId = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; continue; } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ConnectedClusterData( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - identity, - agentPublicKeyCertificate, - kubernetesVersion, - totalNodeCount, - totalCoreCount, - agentVersion, - provisioningState, - distribution, - infrastructure, - offering, - managedIdentityCertificateExpirationTime, - lastConnectivityTime, - connectivityStatus, - privateLinkState, - privateLinkScopeResourceId, - serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) + if (prop.NameEquals("location"u8)) { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" identity: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Identity)) - { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AgentPublicKeyCertificate), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" agentPublicKeyCertificate: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AgentPublicKeyCertificate)) - { - builder.Append(" agentPublicKeyCertificate: "); - if (AgentPublicKeyCertificate.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AgentPublicKeyCertificate}'''"); - } - else - { - builder.AppendLine($"'{AgentPublicKeyCertificate}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubernetesVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kubernetesVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KubernetesVersion)) - { - builder.Append(" kubernetesVersion: "); - if (KubernetesVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{KubernetesVersion}'''"); - } - else - { - builder.AppendLine($"'{KubernetesVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TotalNodeCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" totalNodeCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TotalNodeCount)) - { - builder.Append(" totalNodeCount: "); - builder.AppendLine($"{TotalNodeCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TotalCoreCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" totalCoreCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TotalCoreCount)) - { - builder.Append(" totalCoreCount: "); - builder.AppendLine($"{TotalCoreCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AgentVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" agentVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AgentVersion)) - { - builder.Append(" agentVersion: "); - if (AgentVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AgentVersion}'''"); - } - else - { - builder.AppendLine($"'{AgentVersion}'"); - } + location = new AzureLocation(prop.Value.GetString()); + continue; } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) + if (prop.NameEquals("properties"u8)) { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + properties = ConnectedClusterProperties.DeserializeConnectedClusterProperties(prop.Value, options); + continue; } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Distribution), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" distribution: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Distribution)) + if (prop.NameEquals("identity"u8)) { - builder.Append(" distribution: "); - if (Distribution.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Distribution}'''"); - } - else - { - builder.AppendLine($"'{Distribution}'"); - } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerKubernetesContext.Default); + continue; } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Infrastructure), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" infrastructure: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Infrastructure)) + if (prop.NameEquals("kind"u8)) { - builder.Append(" infrastructure: "); - if (Infrastructure.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Infrastructure}'''"); - } - else + if (prop.Value.ValueKind == JsonValueKind.Null) { - builder.AppendLine($"'{Infrastructure}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Offering), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" offering: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Offering)) - { - builder.Append(" offering: "); - if (Offering.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Offering}'''"); - } - else - { - builder.AppendLine($"'{Offering}'"); + continue; } + kind = new ConnectedClusterKind(prop.Value.GetString()); + continue; } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedIdentityCertificateExpirationOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" managedIdentityCertificateExpirationTime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ManagedIdentityCertificateExpirationOn)) - { - builder.Append(" managedIdentityCertificateExpirationTime: "); - var formattedDateTimeString = TypeFormatters.ToString(ManagedIdentityCertificateExpirationOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastConnectivityOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" lastConnectivityTime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LastConnectivityOn)) - { - builder.Append(" lastConnectivityTime: "); - var formattedDateTimeString = TypeFormatters.ToString(LastConnectivityOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectivityStatus), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" connectivityStatus: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ConnectivityStatus)) - { - builder.Append(" connectivityStatus: "); - builder.AppendLine($"'{ConnectivityStatus.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateLinkState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PrivateLinkState)) - { - builder.Append(" privateLinkState: "); - builder.AppendLine($"'{PrivateLinkState.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateLinkScopeResourceId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkScopeResourceId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PrivateLinkScopeResourceId)) + if (options.Format != "W") { - builder.Append(" privateLinkScopeResourceId: "); - if (PrivateLinkScopeResourceId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PrivateLinkScopeResourceId}'''"); - } - else - { - builder.AppendLine($"'{PrivateLinkScopeResourceId}'"); - } + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - - builder.AppendLine(" }"); - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new ConnectedClusterData( + id, + name, + resourceType, + systemData, + additionalBinaryDataProperties, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + identity, + kind); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(ConnectedClusterData)} does not support writing '{options.Format}' format."); } } - ConnectedClusterData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ConnectedClusterData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (ConnectedClusterData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeConnectedClusterData(document.RootElement, options); } default: @@ -781,6 +224,27 @@ ConnectedClusterData IPersistableModel.Create(BinaryData d } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ConnectedClusterData connectedClusterData) + { + if (connectedClusterData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(connectedClusterData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static ConnectedClusterData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeConnectedClusterData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterData.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterData.cs index 2175d30f72d6..67601df1927a 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterData.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterData.cs @@ -13,150 +13,52 @@ namespace Azure.ResourceManager.Kubernetes { - /// - /// A class representing the ConnectedCluster data model. - /// Represents a connected cluster. - /// + /// Represents a connected cluster. public partial class ConnectedClusterData : TrackedResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. - /// The identity of the connected cluster. Current supported identity types: None, SystemAssigned. - /// Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. - /// or is null. - public ConnectedClusterData(AzureLocation location, ManagedServiceIdentity identity, string agentPublicKeyCertificate) : base(location) + /// The geo-location where the resource lives. + /// Describes the connected cluster resource properties. + /// The identity of the connected cluster. + /// or is null. + public ConnectedClusterData(AzureLocation location, ConnectedClusterProperties properties, ManagedServiceIdentity identity) : base(location) { + Argument.AssertNotNull(properties, nameof(properties)); Argument.AssertNotNull(identity, nameof(identity)); - Argument.AssertNotNull(agentPublicKeyCertificate, nameof(agentPublicKeyCertificate)); + Properties = properties; Identity = identity; - AgentPublicKeyCertificate = agentPublicKeyCertificate; } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The identity of the connected cluster. Current supported identity types: None, SystemAssigned. - /// Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. - /// The Kubernetes version of the connected cluster resource. - /// Number of nodes present in the connected cluster resource. - /// Number of CPU cores present in the connected cluster resource. - /// Version of the agent running on the connected cluster resource. - /// Provisioning state of the connected cluster resource. - /// The Kubernetes distribution running on this connected cluster. - /// The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on. - /// Connected cluster offering. - /// Expiration time of the managed identity certificate. - /// Time representing the last instance when heart beat was received from the cluster. - /// Represents the connectivity status of the connected cluster. - /// Property which describes the state of private link on a connected cluster resource. - /// The resource id of the private link scope this connected cluster is assigned to, if any. - /// Keeps track of any properties unknown to the library. - internal ConnectedClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, string agentPublicKeyCertificate, string kubernetesVersion, int? totalNodeCount, int? totalCoreCount, string agentVersion, ProvisioningState? provisioningState, string distribution, string infrastructure, string offering, DateTimeOffset? managedIdentityCertificateExpirationOn, DateTimeOffset? lastConnectivityOn, ConnectivityStatus? connectivityStatus, PrivateLinkState? privateLinkState, string privateLinkScopeResourceId, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. + /// Describes the connected cluster resource properties. + /// The identity of the connected cluster. + /// The kind of connected cluster. + internal ConnectedClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, ConnectedClusterProperties properties, ManagedServiceIdentity identity, ConnectedClusterKind? kind) : base(id, name, resourceType, systemData, tags, location) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; Identity = identity; - AgentPublicKeyCertificate = agentPublicKeyCertificate; - KubernetesVersion = kubernetesVersion; - TotalNodeCount = totalNodeCount; - TotalCoreCount = totalCoreCount; - AgentVersion = agentVersion; - ProvisioningState = provisioningState; - Distribution = distribution; - Infrastructure = infrastructure; - Offering = offering; - ManagedIdentityCertificateExpirationOn = managedIdentityCertificateExpirationOn; - LastConnectivityOn = lastConnectivityOn; - ConnectivityStatus = connectivityStatus; - PrivateLinkState = privateLinkState; - PrivateLinkScopeResourceId = privateLinkScopeResourceId; - _serializedAdditionalRawData = serializedAdditionalRawData; + Kind = kind; } - /// Initializes a new instance of for deserialization. - internal ConnectedClusterData() - { - } + /// Describes the connected cluster resource properties. + public ConnectedClusterProperties Properties { get; set; } - /// The identity of the connected cluster. Current supported identity types: None, SystemAssigned. - [WirePath("identity")] + /// The identity of the connected cluster. public ManagedServiceIdentity Identity { get; set; } - /// Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. - [WirePath("properties.agentPublicKeyCertificate")] - public string AgentPublicKeyCertificate { get; set; } - /// The Kubernetes version of the connected cluster resource. - [WirePath("properties.kubernetesVersion")] - public string KubernetesVersion { get; } - /// Number of nodes present in the connected cluster resource. - [WirePath("properties.totalNodeCount")] - public int? TotalNodeCount { get; } - /// Number of CPU cores present in the connected cluster resource. - [WirePath("properties.totalCoreCount")] - public int? TotalCoreCount { get; } - /// Version of the agent running on the connected cluster resource. - [WirePath("properties.agentVersion")] - public string AgentVersion { get; } - /// Provisioning state of the connected cluster resource. - [WirePath("properties.provisioningState")] - public ProvisioningState? ProvisioningState { get; set; } - /// The Kubernetes distribution running on this connected cluster. - [WirePath("properties.distribution")] - public string Distribution { get; set; } - /// The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on. - [WirePath("properties.infrastructure")] - public string Infrastructure { get; set; } - /// Connected cluster offering. - [WirePath("properties.offering")] - public string Offering { get; } - /// Expiration time of the managed identity certificate. - [WirePath("properties.managedIdentityCertificateExpirationTime")] - public DateTimeOffset? ManagedIdentityCertificateExpirationOn { get; } - /// Time representing the last instance when heart beat was received from the cluster. - [WirePath("properties.lastConnectivityTime")] - public DateTimeOffset? LastConnectivityOn { get; } - /// Represents the connectivity status of the connected cluster. - [WirePath("properties.connectivityStatus")] - public ConnectivityStatus? ConnectivityStatus { get; } - /// Property which describes the state of private link on a connected cluster resource. - [WirePath("properties.privateLinkState")] - public PrivateLinkState? PrivateLinkState { get; set; } - /// The resource id of the private link scope this connected cluster is assigned to, if any. - [WirePath("properties.privateLinkScopeResourceId")] - public string PrivateLinkScopeResourceId { get; set; } + + /// The kind of connected cluster. + public ConnectedClusterKind? Kind { get; set; } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..b0aea315e67d --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Kubernetes.Models; + +namespace Azure.ResourceManager.Kubernetes +{ + internal partial class ConnectedClusterGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly ConnectedCluster _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of ConnectedClusterGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ConnectedCluster client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ConnectedClusterGetByResourceGroupAsyncCollectionResultOfT(ConnectedCluster client, string subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of ConnectedClusterGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ConnectedClusterGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ConnectedClusterList result = ConnectedClusterList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ConnectedClusterCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetByResourceGroupCollectionResultOfT.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..694ebeed5d20 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Kubernetes.Models; + +namespace Azure.ResourceManager.Kubernetes +{ + internal partial class ConnectedClusterGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly ConnectedCluster _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of ConnectedClusterGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ConnectedCluster client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public ConnectedClusterGetByResourceGroupCollectionResultOfT(ConnectedCluster client, string subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of ConnectedClusterGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ConnectedClusterGetByResourceGroupCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ConnectedClusterList result = ConnectedClusterList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("ConnectedClusterCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..07bff6839eca --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetBySubscriptionAsyncCollectionResultOfT.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Kubernetes.Models; + +namespace Azure.ResourceManager.Kubernetes +{ + internal partial class ConnectedClusterGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly ConnectedCluster _client; + private readonly string _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of ConnectedClusterGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ConnectedCluster client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public ConnectedClusterGetBySubscriptionAsyncCollectionResultOfT(ConnectedCluster client, string subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of ConnectedClusterGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ConnectedClusterGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ConnectedClusterList result = ConnectedClusterList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKubernetesSubscriptionResource.GetConnectedClusters"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetBySubscriptionCollectionResultOfT.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..41dca34fd487 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterGetBySubscriptionCollectionResultOfT.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Kubernetes.Models; + +namespace Azure.ResourceManager.Kubernetes +{ + internal partial class ConnectedClusterGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly ConnectedCluster _client; + private readonly string _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of ConnectedClusterGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ConnectedCluster client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + public ConnectedClusterGetBySubscriptionCollectionResultOfT(ConnectedCluster client, string subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of ConnectedClusterGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ConnectedClusterGetBySubscriptionCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ConnectedClusterList result = ConnectedClusterList.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableKubernetesSubscriptionResource.GetConnectedClusters"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.Serialization.cs index a0de3fa6c753..a79e706311ff 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.Serialization.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.Kubernetes { + /// public partial class ConnectedClusterResource : IJsonModel { - private static ConnectedClusterData s_dataDeserializationInstance; - private static ConnectedClusterData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new ConnectedClusterData(); + + /// The writer to serialize the model to. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - ConnectedClusterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + /// The reader for deserializing the model. + /// The client options for reading and writing models. + ConnectedClusterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => DataDeserializationInstance.Create(ref reader, options); + /// The client options for reading and writing models. BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerKubernetesContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. ConnectedClusterData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerKubernetesContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => DataDeserializationInstance.GetFormatFromOptions(options); } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.cs index 77f6a3bf11d1..712be4b9d9e6 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ConnectedClusterResource.cs @@ -7,47 +7,37 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; using Azure.ResourceManager.Kubernetes.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Kubernetes { /// - /// A Class representing a ConnectedCluster 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 GetConnectedClusterResource method. - /// Otherwise you can get one from its parent resource using the GetConnectedCluster method. + /// A class representing a ConnectedCluster 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 GetResource method. + /// Otherwise you can get one from its parent resource using the GetConnectedClusters method. /// public partial class ConnectedClusterResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The clusterName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"; - return new ResourceIdentifier(resourceId); - } - private readonly ClientDiagnostics _connectedClusterClientDiagnostics; - private readonly ConnectedClusterRestOperations _connectedClusterRestClient; + private readonly ConnectedCluster _connectedClusterRestClient; private readonly ConnectedClusterData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Kubernetes/connectedClusters"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of ConnectedClusterResource for mocking. protected ConnectedClusterResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The resource that is the target of operations. internal ConnectedClusterResource(ArmClient client, ConnectedClusterData data) : this(client, data.Id) @@ -56,71 +46,72 @@ internal ConnectedClusterResource(ArmClient client, ConnectedClusterData data) : _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal ConnectedClusterResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _connectedClusterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Kubernetes", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string connectedClusterApiVersion); - _connectedClusterRestClient = new ConnectedClusterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, connectedClusterApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _connectedClusterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Kubernetes", ResourceType.Namespace, Diagnostics); + _connectedClusterRestClient = new ConnectedCluster(_connectedClusterClientDiagnostics, Pipeline, Endpoint, connectedClusterApiVersion ?? "2025-12-01-preview"); + ValidateResourceId(id); } /// 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 ConnectedClusterData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The clusterName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string clusterName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] 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)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } - /// - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Get"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Get"); scope.Start(); try { - var response = await _connectedClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -130,37 +121,25 @@ public virtual async Task> GetAsync(Cancellat } } - /// - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Get"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Get"); scope.Start(); try { - var response = _connectedClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -170,40 +149,30 @@ public virtual Response Get(CancellationToken cancella } } - /// - /// Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Delete - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// API to update certain properties of the connected cluster resource. + /// Parameters supplied to update Connected Cluster. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(ConnectedClusterPatch patch, CancellationToken cancellationToken = default) { - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Update"); scope.Start(); try { - var response = await _connectedClusterRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new KubernetesArmOperation(_connectedClusterClientDiagnostics, Pipeline, _connectedClusterRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ConnectedClusterPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -212,40 +181,30 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } } - /// - /// Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Delete - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// API to update certain properties of the connected cluster resource. + /// Parameters supplied to update Connected Cluster. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(ConnectedClusterPatch patch, CancellationToken cancellationToken = default) { - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Update"); scope.Start(); try { - var response = _connectedClusterRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new KubernetesArmOperation(_connectedClusterClientDiagnostics, Pipeline, _connectedClusterRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ConnectedClusterPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -254,40 +213,27 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } } - /// - /// API to update certain properties of the connected cluster resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Update - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Parameters supplied to update Connected Cluster. + /// Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + /// 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. - /// is null. - public virtual async Task> UpdateAsync(ConnectedClusterPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Update"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Delete"); scope.Start(); try { - var response = await _connectedClusterRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + KubernetesArmOperation operation = new KubernetesArmOperation(_connectedClusterClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -296,40 +242,27 @@ public virtual async Task> UpdateAsync(Connec } } - /// - /// API to update certain properties of the connected cluster resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Update - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Parameters supplied to update Connected Cluster. + /// Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). + /// 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. - /// is null. - public virtual Response Update(ConnectedClusterPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Update"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.Delete"); scope.Start(); try { - var response = _connectedClusterRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + KubernetesArmOperation operation = new KubernetesArmOperation(_connectedClusterClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -338,27 +271,7 @@ public virtual Response Update(ConnectedClusterPatch p } } - /// - /// Gets cluster user credentials of the connected cluster with a specified resource group and name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}/listClusterUserCredential - /// - /// - /// Operation Id - /// ConnectedCluster_ListClusterUserCredential - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Gets cluster user credentials of the connected cluster with a specified resource group and name. /// ListClusterUserCredential properties. /// The cancellation token to use. /// is null. @@ -366,11 +279,21 @@ public virtual async Task> GetClusterUserCredentialA { Argument.AssertNotNull(properties, nameof(properties)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.GetClusterUserCredential"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.GetClusterUserCredential"); scope.Start(); try { - var response = await _connectedClusterRestClient.ListClusterUserCredentialAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, properties, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetClusterUserCredentialRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ListClusterUserCredentialProperties.ToRequestContent(properties), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(CredentialResults.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -380,27 +303,7 @@ public virtual async Task> GetClusterUserCredentialA } } - /// - /// Gets cluster user credentials of the connected cluster with a specified resource group and name. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName}/listClusterUserCredential - /// - /// - /// Operation Id - /// ConnectedCluster_ListClusterUserCredential - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Gets cluster user credentials of the connected cluster with a specified resource group and name. /// ListClusterUserCredential properties. /// The cancellation token to use. /// is null. @@ -408,11 +311,21 @@ public virtual Response GetClusterUserCredential(ListClusterU { Argument.AssertNotNull(properties, nameof(properties)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.GetClusterUserCredential"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.GetClusterUserCredential"); scope.Start(); try { - var response = _connectedClusterRestClient.ListClusterUserCredential(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, properties, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetClusterUserCredentialRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ListClusterUserCredentialProperties.ToRequestContent(properties), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(CredentialResults.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -422,27 +335,7 @@ public virtual Response GetClusterUserCredential(ListClusterU } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -452,29 +345,35 @@ public virtual async Task> AddTagAsync(string Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.AddTag"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.AddTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _connectedClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ConnectedClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); + return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new ConnectedClusterPatch(); - foreach (var tag in current.Tags) + ConnectedClusterData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ConnectedClusterPatch patch = new ConnectedClusterPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -484,27 +383,7 @@ public virtual async Task> AddTagAsync(string } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -514,29 +393,35 @@ public virtual Response AddTag(string key, string valu Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.AddTag"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.AddTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _connectedClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new ConnectedClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); + return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new ConnectedClusterPatch(); - foreach (var tag in current.Tags) + ConnectedClusterData current = Get(cancellationToken: cancellationToken).Value.Data; + ConnectedClusterPatch patch = new ConnectedClusterPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -546,54 +431,40 @@ public virtual Response AddTag(string key, string valu } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// 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 = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.SetTags"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.SetTags"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken).ConfigureAwait(false); + Response 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 _connectedClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ConnectedClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); + return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new ConnectedClusterPatch(); + ConnectedClusterData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ConnectedClusterPatch patch = new ConnectedClusterPatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -603,54 +474,40 @@ public virtual async Task> SetTagsAsync(IDict } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.SetTags"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.SetTags"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); + GetTagResource().Delete(WaitUntil.Completed, cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _connectedClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new ConnectedClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); + return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new ConnectedClusterPatch(); + ConnectedClusterData current = Get(cancellationToken: cancellationToken).Value.Data; + ConnectedClusterPatch patch = new ConnectedClusterPatch(); patch.Tags.ReplaceWith(tags); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -660,27 +517,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -688,29 +525,35 @@ public virtual async Task> RemoveTagAsync(str { Argument.AssertNotNull(key, nameof(key)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.RemoveTag"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.RemoveTag"); scope.Start(); try { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + if (await CanUseTagResourceAsync(cancellationToken).ConfigureAwait(false)) { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + Response 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 _connectedClusterRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ConnectedClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); + return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new ConnectedClusterPatch(); - foreach (var tag in current.Tags) + ConnectedClusterData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + ConnectedClusterPatch patch = new ConnectedClusterPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; + Response result = await UpdateAsync(patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) @@ -720,27 +563,7 @@ public virtual async Task> RemoveTagAsync(str } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -748,29 +571,35 @@ public virtual Response RemoveTag(string key, Cancella { Argument.AssertNotNull(key, nameof(key)); - using var scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.RemoveTag"); + using DiagnosticScope scope = _connectedClusterClientDiagnostics.CreateScope("ConnectedClusterResource.RemoveTag"); scope.Start(); try { - if (CanUseTagResource(cancellationToken: cancellationToken)) + if (CanUseTagResource(cancellationToken)) { - var originalTags = GetTagResource().Get(cancellationToken); + Response originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _connectedClusterRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new ConnectedClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _connectedClusterRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(ConnectedClusterData.FromResponse(result), result); + return Response.FromValue(new ConnectedClusterResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new ConnectedClusterPatch(); - foreach (var tag in current.Tags) + ConnectedClusterData current = Get(cancellationToken: cancellationToken).Value.Data; + ConnectedClusterPatch patch = new ConnectedClusterPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(patch, cancellationToken: cancellationToken); - return result; + Response result = Update(patch, cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); } } catch (Exception e) diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/KubernetesExtensions.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/KubernetesExtensions.cs index fa0748b742b0..aecad4b3dbb3 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/KubernetesExtensions.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/KubernetesExtensions.cs @@ -8,7 +8,9 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; using Azure.ResourceManager.Kubernetes.Mocking; using Azure.ResourceManager.Resources; @@ -17,30 +19,26 @@ namespace Azure.ResourceManager.Kubernetes /// A class to add extension methods to Azure.ResourceManager.Kubernetes. public static partial class KubernetesExtensions { + /// private static MockableKubernetesArmClient GetMockableKubernetesArmClient(ArmClient client) { - return client.GetCachedClient(client0 => new MockableKubernetesArmClient(client0)); + return client.GetCachedClient(client0 => new MockableKubernetesArmClient(client0, ResourceIdentifier.Root)); } - private static MockableKubernetesResourceGroupResource GetMockableKubernetesResourceGroupResource(ArmResource resource) + /// + private static MockableKubernetesResourceGroupResource GetMockableKubernetesResourceGroupResource(ResourceGroupResource resourceGroupResource) { - return resource.GetCachedClient(client => new MockableKubernetesResourceGroupResource(client, resource.Id)); + return resourceGroupResource.GetCachedClient(client => new MockableKubernetesResourceGroupResource(client, resourceGroupResource.Id)); } - private static MockableKubernetesSubscriptionResource GetMockableKubernetesSubscriptionResource(ArmResource resource) + /// + private static MockableKubernetesSubscriptionResource GetMockableKubernetesSubscriptionResource(SubscriptionResource subscriptionResource) { - return resource.GetCachedClient(client => new MockableKubernetesSubscriptionResource(client, resource.Id)); + return subscriptionResource.GetCachedClient(client => new MockableKubernetesSubscriptionResource(client, subscriptionResource.Id)); } - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -51,16 +49,10 @@ public static ConnectedClusterResource GetConnectedClusterResource(this ArmClien return GetMockableKubernetesArmClient(client).GetConnectedClusterResource(id); } - /// - /// Gets a collection of ConnectedClusterResources in the ResourceGroupResource. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets a collection of ConnectedClusters in the . + /// The the method will execute against. /// is null. - /// An object representing collection of ConnectedClusterResources and their operations over a ConnectedClusterResource. + /// An object representing collection of ConnectedClusters and their operations over a ConnectedClusterResource. public static ConnectedClusterCollection GetConnectedClusters(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -68,36 +60,11 @@ public static ConnectedClusterCollection GetConnectedClusters(this ResourceGroup return GetMockableKubernetesResourceGroupResource(resourceGroupResource).GetConnectedClusters(); } - /// - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. + /// The the method will execute against. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static async Task> GetConnectedClusterAsync(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { @@ -106,36 +73,11 @@ public static async Task> GetConnectedCluster return await GetMockableKubernetesResourceGroupResource(resourceGroupResource).GetConnectedClusterAsync(clusterName, cancellationToken).ConfigureAwait(false); } - /// - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. + /// The the method will execute against. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// is null. [ForwardsClientCalls] public static Response GetConnectedCluster(this ResourceGroupResource resourceGroupResource, string clusterName, CancellationToken cancellationToken = default) { @@ -144,35 +86,11 @@ public static Response GetConnectedCluster(this Resour return GetMockableKubernetesResourceGroupResource(resourceGroupResource).GetConnectedCluster(clusterName, cancellationToken); } - /// - /// API to enumerate registered connected K8s clusters under a Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters - /// - /// - /// Operation Id - /// ConnectedCluster_ListBySubscription - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// API to enumerate registered connected K8s clusters under a Subscription. + /// The the method will execute against. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public static AsyncPageable GetConnectedClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); @@ -180,32 +98,8 @@ public static AsyncPageable GetConnectedClustersAsync( return GetMockableKubernetesSubscriptionResource(subscriptionResource).GetConnectedClustersAsync(cancellationToken); } - /// - /// API to enumerate registered connected K8s clusters under a Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters - /// - /// - /// Operation Id - /// ConnectedCluster_ListBySubscription - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// API to enumerate registered connected K8s clusters under a Subscription. + /// The the method will execute against. /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesArmClient.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesArmClient.cs index f55d40cfddca..1006c5718e41 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesArmClient.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesArmClient.cs @@ -6,38 +6,27 @@ #nullable disable using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Mocking { - /// A class to add extension methods to ArmClient. + /// A class to add extension methods to . public partial class MockableKubernetesArmClient : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableKubernetesArmClient for mocking. protected MockableKubernetesArmClient() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableKubernetesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) { } - internal MockableKubernetesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) - { - } - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// The resource ID of the resource to get. /// Returns a object. public virtual ConnectedClusterResource GetConnectedClusterResource(ResourceIdentifier id) diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesResourceGroupResource.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesResourceGroupResource.cs index b1b85ea09283..65526a987c6a 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesResourceGroupResource.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesResourceGroupResource.cs @@ -8,59 +8,37 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Kubernetes; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Kubernetes.Mocking { - /// A class to add extension methods to ResourceGroupResource. + /// A class to add extension methods to . public partial class MockableKubernetesResourceGroupResource : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableKubernetesResourceGroupResource for mocking. protected MockableKubernetesResourceGroupResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableKubernetesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of ConnectedClusterResources in the ResourceGroupResource. - /// An object representing collection of ConnectedClusterResources and their operations over a ConnectedClusterResource. + /// Gets a collection of ConnectedClusters in the . + /// An object representing collection of ConnectedClusters and their operations over a ConnectedClusterResource. public virtual ConnectedClusterCollection GetConnectedClusters() { return GetCachedClient(client => new ConnectedClusterCollection(client, Id)); } - /// - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. /// is null. @@ -68,30 +46,12 @@ public virtual ConnectedClusterCollection GetConnectedClusters() [ForwardsClientCalls] public virtual async Task> GetConnectedClusterAsync(string clusterName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + return await GetConnectedClusters().GetAsync(clusterName, cancellationToken).ConfigureAwait(false); } - /// - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Kubernetes/connectedClusters/{clusterName} - /// - /// - /// Operation Id - /// ConnectedCluster_Get - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. /// The name of the Kubernetes cluster on which get is called. /// The cancellation token to use. /// is null. @@ -99,6 +59,8 @@ public virtual async Task> GetConnectedCluste [ForwardsClientCalls] public virtual Response GetConnectedCluster(string clusterName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); + return GetConnectedClusters().Get(clusterName, cancellationToken); } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesSubscriptionResource.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesSubscriptionResource.cs index d1dd9025cce5..1bbcb79a3973 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesSubscriptionResource.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/MockableKubernetesSubscriptionResource.cs @@ -6,97 +6,59 @@ #nullable disable using System.Threading; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Kubernetes; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Kubernetes.Mocking { - /// A class to add extension methods to SubscriptionResource. + /// A class to add extension methods to . public partial class MockableKubernetesSubscriptionResource : ArmResource { private ClientDiagnostics _connectedClusterClientDiagnostics; - private ConnectedClusterRestOperations _connectedClusterRestClient; + private ConnectedCluster _connectedClusterRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableKubernetesSubscriptionResource for mocking. protected MockableKubernetesSubscriptionResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. internal MockableKubernetesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private ClientDiagnostics ConnectedClusterClientDiagnostics => _connectedClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Kubernetes", ConnectedClusterResource.ResourceType.Namespace, Diagnostics); - private ConnectedClusterRestOperations ConnectedClusterRestClient => _connectedClusterRestClient ??= new ConnectedClusterRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ConnectedClusterResource.ResourceType)); + private ClientDiagnostics ConnectedClusterClientDiagnostics => _connectedClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Kubernetes.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } + private ConnectedCluster ConnectedClusterRestClient => _connectedClusterRestClient ??= new ConnectedCluster(ConnectedClusterClientDiagnostics, Pipeline, Endpoint, "2025-12-01-preview"); - /// - /// API to enumerate registered connected K8s clusters under a Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters - /// - /// - /// Operation Id - /// ConnectedCluster_ListBySubscription - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// API to enumerate registered connected K8s clusters under a Subscription. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetConnectedClustersAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConnectedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConnectedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConnectedClusterResource(Client, ConnectedClusterData.DeserializeConnectedClusterData(e)), ConnectedClusterClientDiagnostics, Pipeline, "MockableKubernetesSubscriptionResource.GetConnectedClusters", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ConnectedClusterGetBySubscriptionAsyncCollectionResultOfT(ConnectedClusterRestClient, Id.SubscriptionId, context), data => new ConnectedClusterResource(Client, data)); } - /// - /// API to enumerate registered connected K8s clusters under a Subscription - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Kubernetes/connectedClusters - /// - /// - /// Operation Id - /// ConnectedCluster_ListBySubscription - /// - /// - /// Default Api Version - /// 2022-05-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// API to enumerate registered connected K8s clusters under a Subscription. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetConnectedClusters(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConnectedClusterRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConnectedClusterRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConnectedClusterResource(Client, ConnectedClusterData.DeserializeConnectedClusterData(e)), ConnectedClusterClientDiagnostics, Pipeline, "MockableKubernetesSubscriptionResource.GetConnectedClusters", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ConnectedClusterGetBySubscriptionCollectionResultOfT(ConnectedClusterRestClient, Id.SubscriptionId, context), data => new ConnectedClusterResource(Client, data)); } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Argument.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Argument.cs index 0348b34db418..7b55b7353af3 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Argument.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Argument.cs @@ -11,8 +11,10 @@ namespace Azure.ResourceManager.Kubernetes { - internal static class Argument + internal static partial class Argument { + /// The value. + /// The name. public static void AssertNotNull(T value, string name) { if (value is null) @@ -21,8 +23,10 @@ public static void AssertNotNull(T value, string name) } } + /// The value. + /// The name. public static void AssertNotNull(T? value, string name) - where T : struct + where T : struct { if (!value.HasValue) { @@ -30,6 +34,8 @@ public static void AssertNotNull(T? value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(IEnumerable value, string name) { if (value is null) @@ -51,6 +57,8 @@ public static void AssertNotNullOrEmpty(IEnumerable value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(string value, string name) { if (value is null) @@ -62,68 +70,5 @@ public static void AssertNotNullOrEmpty(string value, string name) throw new ArgumentException("Value cannot be an empty string.", name); } } - - public static void AssertNotNullOrWhiteSpace(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (string.IsNullOrWhiteSpace(value)) - { - throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); - } - } - - public static void AssertNotDefault(ref T value, string name) - where T : struct, IEquatable - { - if (value.Equals(default)) - { - throw new ArgumentException("Value cannot be empty.", name); - } - } - - public static void AssertInRange(T value, T minimum, T maximum, string name) - where T : notnull, IComparable - { - if (minimum.CompareTo(value) > 0) - { - throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); - } - if (maximum.CompareTo(value) < 0) - { - throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); - } - } - - public static void AssertEnumDefined(Type enumType, object value, string name) - { - if (!Enum.IsDefined(enumType, value)) - { - throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); - } - } - - public static T CheckNotNull(T value, string name) - where T : class - { - AssertNotNull(value, name); - return value; - } - - public static string CheckNotNullOrEmpty(string value, string name) - { - AssertNotNullOrEmpty(value, name); - return value; - } - - public static void AssertNull(T value, string name, string message = null) - { - if (value != null) - { - throw new ArgumentException(message ?? "Value must be null.", name); - } - } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/AsyncPageableWrapper.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/AsyncPageableWrapper.cs new file mode 100644 index 000000000000..3b150a6c730f --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/AsyncPageableWrapper.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; + +namespace Azure.ResourceManager.Kubernetes +{ + internal partial class AsyncPageableWrapper : AsyncPageable + { + /// The source async pageable value of type AsyncPageable<T>. + private AsyncPageable _source; + /// The converter function from T to U. + private Func _converter; + + /// Initializes a new instance of the AsyncPageableWrapper class. + /// The source async pageable value of type AsyncPageable<T>. + /// The converter function from T to U. + public AsyncPageableWrapper(AsyncPageable source, Func converter) + { + _source = source; + _converter = converter; + } + + /// Converts the pages from AsyncPageable to Page. + /// A continuation token from a previous response. + /// An optional hint to specify the desired size of each page. + /// An enumerable of pages containing converted items of type U. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + await foreach (Page page in _source.AsPages(continuationToken, pageSizeHint).ConfigureAwait(false)) + { + List convertedItems = new List(); + foreach (T item in page.Values) + { + convertedItems.Add(_converter.Invoke(item)); + } + yield return Page.FromValues(convertedItems, page.ContinuationToken, page.GetRawResponse()); + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/BicepSerializationHelpers.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/BicepSerializationHelpers.cs deleted file mode 100644 index 2228677a69f2..000000000000 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/BicepSerializationHelpers.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text; - -namespace Azure.ResourceManager.Kubernetes -{ - internal static class BicepSerializationHelpers - { - public static void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName) - { - string indent = new string(' ', spaces); - int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length; - int length = stringBuilder.Length; - bool inMultilineString = false; - - BinaryData data = ModelReaderWriter.Write(childObject, options, AzureResourceManagerKubernetesContext.Default); - string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < lines.Length; i++) - { - string line = lines[i]; - if (inMultilineString) - { - if (line.Contains("'''")) - { - inMultilineString = false; - } - stringBuilder.AppendLine(line); - continue; - } - if (line.Contains("'''")) - { - inMultilineString = true; - stringBuilder.AppendLine($"{indent}{line}"); - continue; - } - if (i == 0 && !indentFirstLine) - { - stringBuilder.AppendLine($"{line}"); - } - else - { - stringBuilder.AppendLine($"{indent}{line}"); - } - } - if (stringBuilder.Length == length + emptyObjectLength) - { - stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length; - } - } - } -} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ChangeTrackingDictionary.cs index 05508e02904f..4c9d3126235d 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -11,7 +11,8 @@ namespace Azure.ResourceManager.Kubernetes { - internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull { private IDictionary _innerDictionary; @@ -19,6 +20,7 @@ public ChangeTrackingDictionary() { } + /// The inner dictionary. public ChangeTrackingDictionary(IDictionary dictionary) { if (dictionary == null) @@ -28,6 +30,7 @@ public ChangeTrackingDictionary(IDictionary dictionary) _innerDictionary = new Dictionary(dictionary); } + /// The inner dictionary. public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) { if (dictionary == null) @@ -41,16 +44,22 @@ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerDictionary == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + /// Gets the Keys. public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + /// Gets the Values. public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + /// Gets or sets the value associated with the specified key. public TValue this[TKey key] { get @@ -67,8 +76,10 @@ public TValue this[TKey key] } } + /// Gets the Keys. IEnumerable IReadOnlyDictionary.Keys => Keys; + /// Gets the Values. IEnumerable IReadOnlyDictionary.Values => Values; public IEnumerator> GetEnumerator() @@ -89,6 +100,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(KeyValuePair item) { EnsureDictionary().Add(item); @@ -99,6 +111,7 @@ public void Clear() EnsureDictionary().Clear(); } + /// The item to search for. public bool Contains(KeyValuePair item) { if (IsUndefined) @@ -108,6 +121,8 @@ public bool Contains(KeyValuePair item) return EnsureDictionary().Contains(item); } + /// The array to copy. + /// The index. public void CopyTo(KeyValuePair[] array, int index) { if (IsUndefined) @@ -117,6 +132,7 @@ public void CopyTo(KeyValuePair[] array, int index) EnsureDictionary().CopyTo(array, index); } + /// The item to remove. public bool Remove(KeyValuePair item) { if (IsUndefined) @@ -126,11 +142,14 @@ public bool Remove(KeyValuePair item) return EnsureDictionary().Remove(item); } + /// The key. + /// The value to add. public void Add(TKey key, TValue value) { EnsureDictionary().Add(key, value); } + /// The key to search for. public bool ContainsKey(TKey key) { if (IsUndefined) @@ -140,6 +159,7 @@ public bool ContainsKey(TKey key) return EnsureDictionary().ContainsKey(key); } + /// The key. public bool Remove(TKey key) { if (IsUndefined) @@ -149,6 +169,8 @@ public bool Remove(TKey key) return EnsureDictionary().Remove(key); } + /// The key to search for. + /// The value. public bool TryGetValue(TKey key, out TValue value) { if (IsUndefined) diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ChangeTrackingList.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ChangeTrackingList.cs index 7e1e02a6d26a..e0a37b5129c5 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ChangeTrackingList.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Kubernetes { - internal class ChangeTrackingList : IList, IReadOnlyList + internal partial class ChangeTrackingList : IList, IReadOnlyList { private IList _innerList; @@ -20,6 +20,7 @@ public ChangeTrackingList() { } + /// The inner list. public ChangeTrackingList(IList innerList) { if (innerList != null) @@ -28,6 +29,7 @@ public ChangeTrackingList(IList innerList) } } + /// The inner list. public ChangeTrackingList(IReadOnlyList innerList) { if (innerList != null) @@ -36,12 +38,16 @@ public ChangeTrackingList(IReadOnlyList innerList) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerList == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureList().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + /// Gets or sets the value associated with the specified key. public T this[int index] { get @@ -85,6 +91,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(T item) { EnsureList().Add(item); @@ -95,6 +102,7 @@ public void Clear() EnsureList().Clear(); } + /// The item. public bool Contains(T item) { if (IsUndefined) @@ -104,6 +112,8 @@ public bool Contains(T item) return EnsureList().Contains(item); } + /// The array to copy to. + /// The array index. public void CopyTo(T[] array, int arrayIndex) { if (IsUndefined) @@ -113,6 +123,7 @@ public void CopyTo(T[] array, int arrayIndex) EnsureList().CopyTo(array, arrayIndex); } + /// The item. public bool Remove(T item) { if (IsUndefined) @@ -122,6 +133,7 @@ public bool Remove(T item) return EnsureList().Remove(item); } + /// The item. public int IndexOf(T item) { if (IsUndefined) @@ -131,11 +143,14 @@ public int IndexOf(T item) return EnsureList().IndexOf(item); } + /// The inner list. + /// The item. public void Insert(int index, T item) { EnsureList().Insert(index, item); } + /// The inner list. public void RemoveAt(int index) { if (IsUndefined) diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..68696dbc4182 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Kubernetes +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + pipeline.Send(message, userCancellationToken); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + + public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = pipeline.ProcessMessage(message, context); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..cb46a0240328 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Kubernetes +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..b3b491fe9903 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Kubernetes +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string propertySerializationName) + { + PropertyName = propertyName; + PropertySerializationName = propertySerializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string PropertySerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..3ef1a77d3b36 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Kubernetes +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..d54d6a3c5438 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Kubernetes +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ErrorResult.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..d69702663cd8 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; + +namespace Azure.ResourceManager.Kubernetes +{ + internal partial class ErrorResult : Response + { + private readonly Response _response; + private readonly RequestFailedException _exception; + + public ErrorResult(Response response, RequestFailedException exception) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + + /// + public override Response GetRawResponse() + { + return _response; + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ModelSerializationExtensions.cs index e5c856577efe..4e16b46bb99e 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/ModelSerializationExtensions.cs @@ -11,18 +11,16 @@ using System.Diagnostics; using System.Globalization; using System.Text.Json; -using System.Xml; -using Azure.Core; namespace Azure.ResourceManager.Kubernetes { - internal static class ModelSerializationExtensions + internal static partial class ModelSerializationExtensions { - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3"); - internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3"); - internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; public static object GetObject(this JsonElement element) { @@ -48,14 +46,14 @@ public static object GetObject(this JsonElement element) case JsonValueKind.Null: return null; case JsonValueKind.Object: - var dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var jsonProperty in element.EnumerateObject()) { dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); } return dictionary; case JsonValueKind.Array: - var list = new List(); + List list = new List(); foreach (var item in element.EnumerateArray()) { list.Add(item.GetObject()); @@ -93,7 +91,7 @@ public static char GetChar(this JsonElement element) { if (element.ValueKind == JsonValueKind.String) { - var text = element.GetString(); + string text = element.GetString(); if (text == null || text.Length != 1) { throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); @@ -107,14 +105,14 @@ public static char GetChar(this JsonElement element) } [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); } public static string GetRequiredString(this JsonElement element) { - var value = element.GetString(); + string value = element.GetString(); if (value == null) { throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); @@ -181,9 +179,6 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode case IJsonModel jsonModel: jsonModel.Write(writer, options ?? WireOptions); break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; case byte[] bytes: writer.WriteBase64StringValue(bytes); break; @@ -259,151 +254,5 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo { writer.WriteObjectValue(value, options); } - - internal static bool IsSentinelValue(BinaryData value) - { - ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; - ReadOnlySpan valueSpan = value.ToMemory().Span; - return sentinelSpan.SequenceEqual(valueSpan); - } - - internal static class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Optional.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Optional.cs index 6123d99215cd..1bd8ef748ba5 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Optional.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Kubernetes { - internal static class Optional + internal static partial class Optional { public static bool IsCollectionDefined(IEnumerable collection) { @@ -28,7 +28,7 @@ public static bool IsCollectionDefined(IReadOnlyDictionary(T? value) - where T : struct + where T : struct { return value.HasValue; } @@ -38,14 +38,14 @@ public static bool IsDefined(object value) return value != null; } - public static bool IsDefined(JsonElement value) + public static bool IsDefined(string value) { - return value.ValueKind != JsonValueKind.Undefined; + return value != null; } - public static bool IsDefined(string value) + public static bool IsDefined(JsonElement value) { - return value != null; + return value.ValueKind != JsonValueKind.Undefined; } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/PageableWrapper.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/PageableWrapper.cs new file mode 100644 index 000000000000..715d87a927de --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/PageableWrapper.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; + +namespace Azure.ResourceManager.Kubernetes +{ + internal partial class PageableWrapper : Pageable + { + /// The source pageable value of type Pageable<T>. + private Pageable _source; + /// The converter function from T to U. + private Func _converter; + + /// Initializes a new instance of the PageableWrapper class. + /// The source pageable value of type Pageable<T>. + /// The converter function from T to U. + public PageableWrapper(Pageable source, Func converter) + { + _source = source; + _converter = converter; + } + + /// Converts the pages from Pageable to Page. + /// A continuation token from a previous response. + /// An optional hint to specify the desired size of each page. + /// An enumerable of pages containing converted items of type U. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + foreach (Page page in _source.AsPages(continuationToken, pageSizeHint)) + { + List convertedItems = new List(); + foreach (T item in page.Values) + { + convertedItems.Add(_converter.Invoke(item)); + } + yield return Page.FromValues(convertedItems, page.ContinuationToken, page.GetRawResponse()); + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/RequestContextExtensions.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..d44cbd484518 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/RequestContextExtensions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure; + +namespace Azure.ResourceManager.Kubernetes +{ + internal static partial class RequestContextExtensions + { + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + public static ValueTuple Parse(this RequestContext context) + { + if (context == null) + { + return (CancellationToken.None, ErrorOptions.Default); + } + return (context.CancellationToken, context.ErrorOptions); + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/TypeFormatters.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..a177b1ea7612 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,153 @@ +// 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.Xml; + +namespace Azure.ResourceManager.Kubernetes +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Utf8JsonRequestContent.cs index 9f5bb5ae9a89..fa3d38a30b11 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Kubernetes { - internal class Utf8JsonRequestContent : RequestContent + internal partial class Utf8JsonRequestContent : RequestContent { private readonly MemoryStream _stream; private readonly RequestContent _content; @@ -25,20 +25,26 @@ public Utf8JsonRequestContent() JsonWriter = new Utf8JsonWriter(_stream); } + /// Gets the JsonWriter. public Utf8JsonWriter JsonWriter { get; } + /// The stream containing the data to be written. + /// The cancellation token to use. public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) { await JsonWriter.FlushAsync().ConfigureAwait(false); await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); } + /// The stream containing the data to be written. + /// The cancellation token to use. public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) { JsonWriter.Flush(); _content.WriteTo(stream, cancellationToken); } + /// public override bool TryComputeLength(out long length) { length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/WirePathAttribute.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/WirePathAttribute.cs deleted file mode 100644 index 822348fee8b0..000000000000 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Internal/WirePathAttribute.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Kubernetes -{ - [AttributeUsage(AttributeTargets.Property)] - internal class WirePathAttribute : Attribute - { - private string _wirePath; - - public WirePathAttribute(string wirePath) - { - _wirePath = wirePath; - } - - public override string ToString() - { - return _wirePath; - } - } -} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/ConnectedClusterOperationSource.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/ConnectedClusterOperationSource.cs index 7a228731db04..54211e69510f 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/ConnectedClusterOperationSource.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/ConnectedClusterOperationSource.cs @@ -5,32 +5,45 @@ #nullable disable -using System.ClientModel.Primitives; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; namespace Azure.ResourceManager.Kubernetes { - internal class ConnectedClusterOperationSource : IOperationSource + /// + internal partial class ConnectedClusterOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal ConnectedClusterOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// ConnectedClusterResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKubernetesContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + ConnectedClusterData data = ConnectedClusterData.DeserializeConnectedClusterData(document.RootElement, ModelSerializationExtensions.WireOptions); return new ConnectedClusterResource(_client, data); } + /// The response from the service. + /// The cancellation token to use. + /// async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerKubernetesContext.Default); - return await Task.FromResult(new ConnectedClusterResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + ConnectedClusterData data = ConnectedClusterData.DeserializeConnectedClusterData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new ConnectedClusterResource(_client, data); } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/KubernetesArmOperation.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/KubernetesArmOperation.cs index 9c1cf6023d4b..0ad86aa9b4a3 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/KubernetesArmOperation.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/KubernetesArmOperation.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.Kubernetes { -#pragma warning disable SA1649 // File name should match first type name - internal class KubernetesArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class KubernetesArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected KubernetesArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal KubernetesArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response); @@ -36,12 +37,20 @@ internal KubernetesArmOperation(Response response, RehydrationToken? rehydration _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal KubernetesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,48 +58,49 @@ internal KubernetesArmOperation(ClientDiagnostics clientDiagnostics, HttpPipelin _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "KubernetesArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + nextLinkOperation, + clientDiagnostics, + response, + "KubernetesArmOperation", + null, + new SequentialDelayStrategy()); } + /// Gets the Id. + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// Gets the HasCompleted. + public override bool HasCompleted => _operation.HasCompleted; + + /// The token to rehydrate a long-running operation. private string GetOperationId(RehydrationToken? rehydrationToken) { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerKubernetesContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); + return rehydrationToken?.Id; } - /// - public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// + /// public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - /// - public override bool HasCompleted => _operation.HasCompleted; - - /// + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); - /// + /// public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); - /// + /// public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/KubernetesArmOperationOfT.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/KubernetesArmOperationOfT.cs index 9c86ffe45cf1..7d30c2d69378 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/KubernetesArmOperationOfT.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/LongRunningOperation/KubernetesArmOperationOfT.cs @@ -6,18 +6,16 @@ #nullable disable using System; -using System.ClientModel.Primitives; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; namespace Azure.ResourceManager.Kubernetes { -#pragma warning disable SA1649 // File name should match first type name - internal class KubernetesArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class KubernetesArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected KubernetesArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal KubernetesArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); @@ -36,12 +37,21 @@ internal KubernetesArmOperation(Response response, RehydrationToken? rehydrat _operationId = GetOperationId(rehydrationToken); } + /// + /// The instance of . + /// The instance of . + /// The instance of . + /// The operation request. + /// The operation response. + /// The finalStateVia of the operation. + /// If should skip Api version override. + /// The Api version override value. internal KubernetesArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) { - var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); - if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + IOperation nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationImplementation) { - _nextLinkOperation = nextLinkOperationValue; + _nextLinkOperation = nextLinkOperationImplementation; _operationId = _nextLinkOperation.OperationId; } else @@ -49,54 +59,55 @@ internal KubernetesArmOperation(IOperationSource source, ClientDiagnostics cl _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "KubernetesArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + NextLinkOperationImplementation.Create(source, nextLinkOperation), + clientDiagnostics, + response, + "KubernetesArmOperation", + null, + new SequentialDelayStrategy()); } - private string GetOperationId(RehydrationToken? rehydrationToken) - { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerKubernetesContext.Default); - using var document = JsonDocument.Parse(data); - var lroDetails = document.RootElement; - return lroDetails.GetProperty("id").GetString(); - } - /// + /// Gets the Id. public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; - /// - public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; - - /// + /// Gets the Value. public override T Value => _operation.Value; - /// + /// Gets the HasValue. public override bool HasValue => _operation.HasValue; - /// + /// Gets the HasCompleted. public override bool HasCompleted => _operation.HasCompleted; - /// + /// The token to rehydrate a long-running operation. + private string GetOperationId(RehydrationToken? rehydrationToken) + { + return rehydrationToken?.Id; + } + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// public override Response GetRawResponse() => _operation.RawResponse; - /// + /// public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); - /// + /// public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); - /// + /// public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); - /// + /// public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); - /// + /// public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AadProfile.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AadProfile.Serialization.cs new file mode 100644 index 000000000000..10c47539dbf3 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AadProfile.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// AAD Profile specifies attributes for Azure Active Directory integration. + public partial class AadProfile : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AadProfile)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(EnableAzureRBAC)) + { + writer.WritePropertyName("enableAzureRBAC"u8); + writer.WriteBooleanValue(EnableAzureRBAC.Value); + } + if (Optional.IsCollectionDefined(AdminGroupObjectIDs)) + { + writer.WritePropertyName("adminGroupObjectIDs"u8); + writer.WriteStartArray(); + foreach (string item in AdminGroupObjectIDs) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(TenantID)) + { + writer.WritePropertyName("tenantID"u8); + writer.WriteStringValue(TenantID); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + AadProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AadProfile JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AadProfile)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAadProfile(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AadProfile DeserializeAadProfile(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enableAzureRBAC = default; + IList adminGroupObjectIDs = default; + string tenantID = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("enableAzureRBAC"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableAzureRBAC = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("adminGroupObjectIDs"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + adminGroupObjectIDs = array; + continue; + } + if (prop.NameEquals("tenantID"u8)) + { + tenantID = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new AadProfile(enableAzureRBAC, adminGroupObjectIDs ?? new ChangeTrackingList(), tenantID, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(AadProfile)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + AadProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AadProfile PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeAadProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AadProfile)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AadProfile.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AadProfile.cs new file mode 100644 index 000000000000..4bad6ec0fd4f --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AadProfile.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// AAD Profile specifies attributes for Azure Active Directory integration. + public partial class AadProfile + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public AadProfile() + { + AdminGroupObjectIDs = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Whether to enable Azure RBAC for Kubernetes authorization. + /// The list of AAD group object IDs that will have admin role of the cluster. + /// The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + /// Keeps track of any properties unknown to the library. + internal AadProfile(bool? enableAzureRBAC, IList adminGroupObjectIDs, string tenantID, IDictionary additionalBinaryDataProperties) + { + EnableAzureRBAC = enableAzureRBAC; + AdminGroupObjectIDs = adminGroupObjectIDs; + TenantID = tenantID; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Whether to enable Azure RBAC for Kubernetes authorization. + public bool? EnableAzureRBAC { get; set; } + + /// The list of AAD group object IDs that will have admin role of the cluster. + public IList AdminGroupObjectIDs { get; } + + /// The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + public string TenantID { get; set; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AgentError.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AgentError.Serialization.cs new file mode 100644 index 000000000000..6c74d18ef10b --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AgentError.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Agent Errors if any during agent or system component upgrade. + public partial class AgentError : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentError)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && Optional.IsDefined(Severity)) + { + writer.WritePropertyName("severity"u8); + writer.WriteStringValue(Severity); + } + if (options.Format != "W" && Optional.IsDefined(Component)) + { + writer.WritePropertyName("component"u8); + writer.WriteStringValue(Component); + } + if (options.Format != "W" && Optional.IsDefined(Time)) + { + writer.WritePropertyName("time"u8); + writer.WriteStringValue(Time.Value, "O"); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + AgentError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AgentError JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgentError)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgentError(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AgentError DeserializeAgentError(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string message = default; + string severity = default; + string component = default; + DateTimeOffset? time = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("message"u8)) + { + message = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("severity"u8)) + { + severity = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("component"u8)) + { + component = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("time"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + time = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new AgentError(message, severity, component, time, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(AgentError)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + AgentError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AgentError PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeAgentError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgentError)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AgentError.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AgentError.cs new file mode 100644 index 000000000000..11856d68bbe4 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AgentError.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Agent Errors if any during agent or system component upgrade. + public partial class AgentError + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public AgentError() + { + } + + /// Initializes a new instance of . + /// Agent error message. + /// Severity of the error message. + /// Agent component where error message occured. + /// The timestamp of error occured (UTC). + /// Keeps track of any properties unknown to the library. + internal AgentError(string message, string severity, string component, DateTimeOffset? time, IDictionary additionalBinaryDataProperties) + { + Message = message; + Severity = severity; + Component = component; + Time = time; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Agent error message. + public string Message { get; } + + /// Severity of the error message. + public string Severity { get; } + + /// Agent component where error message occured. + public string Component { get; } + + /// The timestamp of error occured (UTC). + public DateTimeOffset? Time { get; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentProfile.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentProfile.Serialization.cs new file mode 100644 index 000000000000..f09fc5e26d0b --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentProfile.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Defines the Arc Agent properties for the clusters. + public partial class ArcAgentProfile : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArcAgentProfile)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(DesiredAgentVersion)) + { + writer.WritePropertyName("desiredAgentVersion"u8); + writer.WriteStringValue(DesiredAgentVersion); + } + if (Optional.IsDefined(AgentAutoUpgrade)) + { + writer.WritePropertyName("agentAutoUpgrade"u8); + writer.WriteStringValue(AgentAutoUpgrade.Value.ToString()); + } + if (Optional.IsCollectionDefined(SystemComponents)) + { + writer.WritePropertyName("systemComponents"u8); + writer.WriteStartArray(); + foreach (SystemComponent item in SystemComponents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AgentErrors)) + { + writer.WritePropertyName("agentErrors"u8); + writer.WriteStartArray(); + foreach (AgentError item in AgentErrors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(AgentState)) + { + writer.WritePropertyName("agentState"u8); + writer.WriteStringValue(AgentState); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ArcAgentProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ArcAgentProfile JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArcAgentProfile)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArcAgentProfile(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ArcAgentProfile DeserializeArcAgentProfile(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string desiredAgentVersion = default; + AutoUpgradeOptions? agentAutoUpgrade = default; + IList systemComponents = default; + IList agentErrors = default; + string agentState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("desiredAgentVersion"u8)) + { + desiredAgentVersion = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("agentAutoUpgrade"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + agentAutoUpgrade = new AutoUpgradeOptions(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("systemComponents"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(SystemComponent.DeserializeSystemComponent(item, options)); + } + systemComponents = array; + continue; + } + if (prop.NameEquals("agentErrors"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(AgentError.DeserializeAgentError(item, options)); + } + agentErrors = array; + continue; + } + if (prop.NameEquals("agentState"u8)) + { + agentState = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ArcAgentProfile( + desiredAgentVersion, + agentAutoUpgrade, + systemComponents ?? new ChangeTrackingList(), + agentErrors ?? new ChangeTrackingList(), + agentState, + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(ArcAgentProfile)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ArcAgentProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ArcAgentProfile PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeArcAgentProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArcAgentProfile)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentProfile.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentProfile.cs new file mode 100644 index 000000000000..23a80cb82732 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentProfile.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Defines the Arc Agent properties for the clusters. + public partial class ArcAgentProfile + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ArcAgentProfile() + { + SystemComponents = new ChangeTrackingList(); + AgentErrors = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Version of the Arc agents to be installed on the cluster resource. + /// Indicates whether the Arc agents on the be upgraded automatically to the latest version. Defaults to Enabled. + /// List of system extensions that are installed on the cluster resource. + /// List of arc agentry and system components errors on the cluster resource. + /// Represents the current state of the Arc agentry and its dependent components. + /// Keeps track of any properties unknown to the library. + internal ArcAgentProfile(string desiredAgentVersion, AutoUpgradeOptions? agentAutoUpgrade, IList systemComponents, IList agentErrors, string agentState, IDictionary additionalBinaryDataProperties) + { + DesiredAgentVersion = desiredAgentVersion; + AgentAutoUpgrade = agentAutoUpgrade; + SystemComponents = systemComponents; + AgentErrors = agentErrors; + AgentState = agentState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Version of the Arc agents to be installed on the cluster resource. + public string DesiredAgentVersion { get; set; } + + /// Indicates whether the Arc agents on the be upgraded automatically to the latest version. Defaults to Enabled. + public AutoUpgradeOptions? AgentAutoUpgrade { get; set; } + + /// List of system extensions that are installed on the cluster resource. + public IList SystemComponents { get; } + + /// List of arc agentry and system components errors on the cluster resource. + public IList AgentErrors { get; } + + /// Represents the current state of the Arc agentry and its dependent components. + public string AgentState { get; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentryConfigurations.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentryConfigurations.Serialization.cs new file mode 100644 index 000000000000..843a9cb1211f --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentryConfigurations.Serialization.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// The ArcAgentryConfigurations. + public partial class ArcAgentryConfigurations : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArcAgentryConfigurations)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Feature)) + { + writer.WritePropertyName("feature"u8); + writer.WriteStringValue(Feature); + } + if (Optional.IsCollectionDefined(Settings)) + { + writer.WritePropertyName("settings"u8); + writer.WriteStartObject(); + foreach (var item in Settings) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(ProtectedSettings)) + { + writer.WritePropertyName("protectedSettings"u8); + writer.WriteStartObject(); + foreach (var item in ProtectedSettings) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ArcAgentryConfigurations IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ArcAgentryConfigurations JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArcAgentryConfigurations)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArcAgentryConfigurations(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ArcAgentryConfigurations DeserializeArcAgentryConfigurations(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string feature = default; + IDictionary settings = default; + IDictionary protectedSettings = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("feature"u8)) + { + feature = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("settings"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + settings = dictionary; + continue; + } + if (prop.NameEquals("protectedSettings"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + protectedSettings = dictionary; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ArcAgentryConfigurations(feature, settings ?? new ChangeTrackingDictionary(), protectedSettings ?? new ChangeTrackingDictionary(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(ArcAgentryConfigurations)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ArcAgentryConfigurations IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ArcAgentryConfigurations PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeArcAgentryConfigurations(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArcAgentryConfigurations)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentryConfigurations.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentryConfigurations.cs new file mode 100644 index 000000000000..413b0d5cd5a9 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ArcAgentryConfigurations.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// The ArcAgentryConfigurations. + public partial class ArcAgentryConfigurations + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ArcAgentryConfigurations() + { + Settings = new ChangeTrackingDictionary(); + ProtectedSettings = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Specifies the name of the feature for the configuration setting. + /// The configuration settings for the feature that do not contain any sensitive or secret information. + /// The configuration settings for the feature that contain any sensitive or secret information. + /// Keeps track of any properties unknown to the library. + internal ArcAgentryConfigurations(string feature, IDictionary settings, IDictionary protectedSettings, IDictionary additionalBinaryDataProperties) + { + Feature = feature; + Settings = settings; + ProtectedSettings = protectedSettings; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Specifies the name of the feature for the configuration setting. + public string Feature { get; set; } + + /// The configuration settings for the feature that do not contain any sensitive or secret information. + public IDictionary Settings { get; set; } + + /// The configuration settings for the feature that contain any sensitive or secret information. + public IDictionary ProtectedSettings { get; set; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AuthenticationMethod.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AuthenticationMethod.cs index fb52b161ff53..7a8939869e15 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AuthenticationMethod.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AuthenticationMethod.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.Kubernetes.Models public readonly partial struct AuthenticationMethod : IEquatable { private readonly string _value; + private const string TokenValue = "Token"; + private const string AADValue = "AAD"; /// Initializes a new instance of . + /// The value. /// is null. public AuthenticationMethod(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string TokenValue = "Token"; - private const string AADValue = "AAD"; + _value = value; + } - /// Token. + /// Gets the Token. public static AuthenticationMethod Token { get; } = new AuthenticationMethod(TokenValue); - /// AAD. + + /// Gets the AAD. public static AuthenticationMethod AAD { get; } = new AuthenticationMethod(AADValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(AuthenticationMethod left, AuthenticationMethod right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(AuthenticationMethod left, AuthenticationMethod right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator AuthenticationMethod(string value) => new AuthenticationMethod(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator AuthenticationMethod?(string value) => value == null ? null : new AuthenticationMethod(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is AuthenticationMethod other && Equals(other); - /// + + /// public bool Equals(AuthenticationMethod other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AutoUpgradeOptions.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AutoUpgradeOptions.cs new file mode 100644 index 000000000000..ef59206e0311 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AutoUpgradeOptions.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Indicates whether the Arc agents on the be upgraded automatically to the latest version. Defaults to Enabled. + public readonly partial struct AutoUpgradeOptions : IEquatable + { + private readonly string _value; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public AutoUpgradeOptions(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Enabled. + public static AutoUpgradeOptions Enabled { get; } = new AutoUpgradeOptions(EnabledValue); + + /// Gets the Disabled. + public static AutoUpgradeOptions Disabled { get; } = new AutoUpgradeOptions(DisabledValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(AutoUpgradeOptions left, AutoUpgradeOptions right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(AutoUpgradeOptions left, AutoUpgradeOptions right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator AutoUpgradeOptions(string value) => new AutoUpgradeOptions(value); + + /// Converts a string to a . + /// The value. + public static implicit operator AutoUpgradeOptions?(string value) => value == null ? null : new AutoUpgradeOptions(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AutoUpgradeOptions other && Equals(other); + + /// + public bool Equals(AutoUpgradeOptions other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AzureHybridBenefit.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AzureHybridBenefit.cs new file mode 100644 index 000000000000..8075f1672e52 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AzureHybridBenefit.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Indicates whether Azure Hybrid Benefit is opted in. + public readonly partial struct AzureHybridBenefit : IEquatable + { + private readonly string _value; + private const string TrueValue = "True"; + private const string FalseValue = "False"; + private const string NotApplicableValue = "NotApplicable"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public AzureHybridBenefit(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the True. + public static AzureHybridBenefit True { get; } = new AzureHybridBenefit(TrueValue); + + /// Gets the False. + public static AzureHybridBenefit False { get; } = new AzureHybridBenefit(FalseValue); + + /// Gets the NotApplicable. + public static AzureHybridBenefit NotApplicable { get; } = new AzureHybridBenefit(NotApplicableValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(AzureHybridBenefit left, AzureHybridBenefit right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(AzureHybridBenefit left, AzureHybridBenefit right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator AzureHybridBenefit(string value) => new AzureHybridBenefit(value); + + /// Converts a string to a . + /// The value. + public static implicit operator AzureHybridBenefit?(string value) => value == null ? null : new AzureHybridBenefit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureHybridBenefit other && Equals(other); + + /// + public bool Equals(AzureHybridBenefit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AzureResourceManagerKubernetesContext.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AzureResourceManagerKubernetesContext.cs index 08344770c944..353434302cd1 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AzureResourceManagerKubernetesContext.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/AzureResourceManagerKubernetesContext.cs @@ -13,19 +13,30 @@ namespace Azure.ResourceManager.Kubernetes { /// /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// For more information /// + [ModelReaderWriterBuildable(typeof(AadProfile))] + [ModelReaderWriterBuildable(typeof(AgentError))] + [ModelReaderWriterBuildable(typeof(ArcAgentProfile))] + [ModelReaderWriterBuildable(typeof(ArcAgentryConfigurations))] [ModelReaderWriterBuildable(typeof(ConnectedClusterData))] [ModelReaderWriterBuildable(typeof(ConnectedClusterList))] [ModelReaderWriterBuildable(typeof(ConnectedClusterPatch))] + [ModelReaderWriterBuildable(typeof(ConnectedClusterPatchProperties))] + [ModelReaderWriterBuildable(typeof(ConnectedClusterProperties))] [ModelReaderWriterBuildable(typeof(ConnectedClusterResource))] [ModelReaderWriterBuildable(typeof(CredentialResult))] [ModelReaderWriterBuildable(typeof(CredentialResults))] + [ModelReaderWriterBuildable(typeof(Gateway))] [ModelReaderWriterBuildable(typeof(HybridConnectionConfig))] [ModelReaderWriterBuildable(typeof(ListClusterUserCredentialProperties))] [ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))] - [ModelReaderWriterBuildable(typeof(ResponseError))] + [ModelReaderWriterBuildable(typeof(OidcIssuerProfile))] + [ModelReaderWriterBuildable(typeof(SecurityProfile))] + [ModelReaderWriterBuildable(typeof(SecurityProfileWorkloadIdentity))] + [ModelReaderWriterBuildable(typeof(SystemComponent))] [ModelReaderWriterBuildable(typeof(SystemData))] + [ModelReaderWriterBuildable(typeof(UserAssignedIdentity))] public partial class AzureResourceManagerKubernetesContext : ModelReaderWriterContext { } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterKind.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterKind.cs new file mode 100644 index 000000000000..a749c91edce6 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterKind.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Indicates the kind of Arc connected cluster based on host infrastructure. + public readonly partial struct ConnectedClusterKind : IEquatable + { + private readonly string _value; + private const string ProvisionedClusterValue = "ProvisionedCluster"; + private const string AWSValue = "AWS"; + /// Represents a connected cluster hosted on Google Cloud Platform (GCP). + private const string GCPValue = "GCP"; + + /// Initializes a new instance of . + /// The value. + /// is null. + public ConnectedClusterKind(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the ProvisionedCluster. + public static ConnectedClusterKind ProvisionedCluster { get; } = new ConnectedClusterKind(ProvisionedClusterValue); + + /// Gets the AWS. + public static ConnectedClusterKind AWS { get; } = new ConnectedClusterKind(AWSValue); + + /// Represents a connected cluster hosted on Google Cloud Platform (GCP). + public static ConnectedClusterKind GCP { get; } = new ConnectedClusterKind(GCPValue); + + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator ==(ConnectedClusterKind left, ConnectedClusterKind right) => left.Equals(right); + + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. + public static bool operator !=(ConnectedClusterKind left, ConnectedClusterKind right) => !left.Equals(right); + + /// Converts a string to a . + /// The value. + public static implicit operator ConnectedClusterKind(string value) => new ConnectedClusterKind(value); + + /// Converts a string to a . + /// The value. + public static implicit operator ConnectedClusterKind?(string value) => value == null ? null : new ConnectedClusterKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConnectedClusterKind other && Equals(other); + + /// + public bool Equals(ConnectedClusterKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + + /// + public override string ToString() => _value; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterList.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterList.Serialization.cs index 11ad26f3257c..025de0b4c0f6 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterList.Serialization.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterList.Serialization.cs @@ -8,17 +8,22 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { - internal partial class ConnectedClusterList : IUtf8JsonSerializable, IJsonModel + /// The paginated list of connected Clusters. + internal partial class ConnectedClusterList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ConnectedClusterList() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,36 +35,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ConnectedClusterList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (ConnectedClusterData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -68,145 +69,93 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ConnectedClusterList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ConnectedClusterList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ConnectedClusterList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ConnectedClusterList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeConnectedClusterList(document.RootElement, options); } - internal static ConnectedClusterList DeserializeConnectedClusterList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ConnectedClusterList DeserializeConnectedClusterList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ConnectedClusterData.DeserializeConnectedClusterData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ConnectedClusterList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ConnectedClusterList(value, nextLink, additionalBinaryDataProperties); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(ConnectedClusterList)} does not support writing '{options.Format}' format."); } } - ConnectedClusterList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ConnectedClusterList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ConnectedClusterList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeConnectedClusterList(document.RootElement, options); } default: @@ -214,6 +163,15 @@ ConnectedClusterList IPersistableModel.Create(BinaryData d } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ConnectedClusterList FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeConnectedClusterList(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterList.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterList.cs index 971ed307fa6b..5f50897e8b7d 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterList.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { /// The paginated list of connected Clusters. internal partial class ConnectedClusterList { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - internal ConnectedClusterList() + /// The ConnectedCluster items on this page. + internal ConnectedClusterList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// The list of connected clusters. - /// The link to fetch the next page of connected cluster. - /// Keeps track of any properties unknown to the library. - internal ConnectedClusterList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The ConnectedCluster items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ConnectedClusterList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// The list of connected clusters. - public IReadOnlyList Value { get; } - /// The link to fetch the next page of connected cluster. - public string NextLink { get; } + /// The ConnectedCluster items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatch.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatch.Serialization.cs index d4effa23a4fd..9f643b98c5c1 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatch.Serialization.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatch.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { - public partial class ConnectedClusterPatch : IUtf8JsonSerializable, IJsonModel + /// Object containing updates for patch operations. + public partial class ConnectedClusterPatch : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ConnectedClusterPatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -41,6 +42,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -48,24 +54,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Properties); -#else - using (JsonDocument document = JsonDocument.Parse(Properties, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -74,68 +73,81 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ConnectedClusterPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ConnectedClusterPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ConnectedClusterPatch JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ConnectedClusterPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeConnectedClusterPatch(document.RootElement, options); } - internal static ConnectedClusterPatch DeserializeConnectedClusterPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ConnectedClusterPatch DeserializeConnectedClusterPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = default; - BinaryData properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + ConnectedClusterPatchProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) + foreach (var prop0 in prop.Value.EnumerateObject()) { - dictionary.Add(property0.Name, property0.Value.GetString()); + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } } tags = dictionary; continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = BinaryData.FromString(property.Value.GetRawText()); + properties = ConnectedClusterPatchProperties.DeserializeConnectedClusterPatchProperties(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ConnectedClusterPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + return new ConnectedClusterPatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -145,15 +157,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio } } - ConnectedClusterPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ConnectedClusterPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ConnectedClusterPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeConnectedClusterPatch(document.RootElement, options); } default: @@ -161,6 +178,19 @@ ConnectedClusterPatch IPersistableModel.Create(BinaryData } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ConnectedClusterPatch patch) + { + if (patch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatch.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatch.cs index 24bb11d6dac9..c1810473739d 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatch.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatch.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { /// Object containing updates for patch operations. public partial class ConnectedClusterPatch { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public ConnectedClusterPatch() @@ -54,48 +26,18 @@ public ConnectedClusterPatch() /// Initializes a new instance of . /// Resource tags. /// Describes the connected cluster resource properties that can be updated during PATCH operation. - /// Keeps track of any properties unknown to the library. - internal ConnectedClusterPatch(IDictionary tags, BinaryData properties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ConnectedClusterPatch(IDictionary tags, ConnectedClusterPatchProperties properties, IDictionary additionalBinaryDataProperties) { Tags = tags; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Resource tags. - [WirePath("tags")] public IDictionary Tags { get; } - /// - /// Describes the connected cluster resource properties that can be updated during PATCH operation. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - [WirePath("properties")] - public BinaryData Properties { get; set; } + + /// Describes the connected cluster resource properties that can be updated during PATCH operation. + public ConnectedClusterPatchProperties Properties { get; set; } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatchProperties.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatchProperties.Serialization.cs new file mode 100644 index 000000000000..6ae3e0afe1ac --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatchProperties.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Properties which can be patched on the connected cluster resource. + public partial class ConnectedClusterPatchProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectedClusterPatchProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Distribution)) + { + writer.WritePropertyName("distribution"u8); + writer.WriteStringValue(Distribution); + } + if (Optional.IsDefined(DistributionVersion)) + { + writer.WritePropertyName("distributionVersion"u8); + writer.WriteStringValue(DistributionVersion); + } + if (Optional.IsDefined(AzureHybridBenefit)) + { + writer.WritePropertyName("azureHybridBenefit"u8); + writer.WriteStringValue(AzureHybridBenefit.Value.ToString()); + } + if (Optional.IsDefined(Gateway)) + { + writer.WritePropertyName("gateway"u8); + writer.WriteObjectValue(Gateway, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ConnectedClusterPatchProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ConnectedClusterPatchProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectedClusterPatchProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectedClusterPatchProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ConnectedClusterPatchProperties DeserializeConnectedClusterPatchProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string distribution = default; + string distributionVersion = default; + AzureHybridBenefit? azureHybridBenefit = default; + Gateway gateway = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("distribution"u8)) + { + distribution = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("distributionVersion"u8)) + { + distributionVersion = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("azureHybridBenefit"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureHybridBenefit = new AzureHybridBenefit(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("gateway"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gateway = Gateway.DeserializeGateway(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ConnectedClusterPatchProperties(distribution, distributionVersion, azureHybridBenefit, gateway, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(ConnectedClusterPatchProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ConnectedClusterPatchProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ConnectedClusterPatchProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeConnectedClusterPatchProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectedClusterPatchProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatchProperties.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatchProperties.cs new file mode 100644 index 000000000000..eeedaa02a160 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterPatchProperties.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Properties which can be patched on the connected cluster resource. + public partial class ConnectedClusterPatchProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ConnectedClusterPatchProperties() + { + } + + /// Initializes a new instance of . + /// Represents the distribution of the connected cluster. + /// Represents the Kubernetes distribution version on this connected cluster. + /// Indicates whether Azure Hybrid Benefit is opted in. + /// Indicates whether Gateway is enabled for the connected cluster resource. + /// Keeps track of any properties unknown to the library. + internal ConnectedClusterPatchProperties(string distribution, string distributionVersion, AzureHybridBenefit? azureHybridBenefit, Gateway gateway, IDictionary additionalBinaryDataProperties) + { + Distribution = distribution; + DistributionVersion = distributionVersion; + AzureHybridBenefit = azureHybridBenefit; + Gateway = gateway; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Represents the distribution of the connected cluster. + public string Distribution { get; set; } + + /// Represents the Kubernetes distribution version on this connected cluster. + public string DistributionVersion { get; set; } + + /// Indicates whether Azure Hybrid Benefit is opted in. + public AzureHybridBenefit? AzureHybridBenefit { get; set; } + + /// Indicates whether Gateway is enabled for the connected cluster resource. + internal Gateway Gateway { get; set; } + + /// Indicates whether the gateway for arc router connectivity is enabled. + public bool? GatewayEnabled + { + get + { + return Gateway is null ? default : Gateway.Enabled; + } + set + { + if (Gateway is null) + { + Gateway = new Gateway(); + } + Gateway.Enabled = value; + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterProperties.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterProperties.Serialization.cs new file mode 100644 index 000000000000..671f8551294c --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterProperties.Serialization.cs @@ -0,0 +1,503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Properties of the connected cluster. + public partial class ConnectedClusterProperties : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ConnectedClusterProperties() + { + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectedClusterProperties)} does not support writing '{format}' format."); + } + writer.WritePropertyName("agentPublicKeyCertificate"u8); + writer.WriteStringValue(AgentPublicKeyCertificate); + if (options.Format != "W" && Optional.IsDefined(KubernetesVersion)) + { + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + } + if (options.Format != "W" && Optional.IsDefined(TotalNodeCount)) + { + writer.WritePropertyName("totalNodeCount"u8); + writer.WriteNumberValue(TotalNodeCount.Value); + } + if (options.Format != "W" && Optional.IsDefined(TotalCoreCount)) + { + writer.WritePropertyName("totalCoreCount"u8); + writer.WriteNumberValue(TotalCoreCount.Value); + } + if (options.Format != "W" && Optional.IsDefined(AgentVersion)) + { + writer.WritePropertyName("agentVersion"u8); + writer.WriteStringValue(AgentVersion); + } + if (Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Distribution)) + { + writer.WritePropertyName("distribution"u8); + writer.WriteStringValue(Distribution); + } + if (Optional.IsDefined(DistributionVersion)) + { + writer.WritePropertyName("distributionVersion"u8); + writer.WriteStringValue(DistributionVersion); + } + if (Optional.IsDefined(Infrastructure)) + { + writer.WritePropertyName("infrastructure"u8); + writer.WriteStringValue(Infrastructure); + } + if (options.Format != "W" && Optional.IsDefined(Offering)) + { + writer.WritePropertyName("offering"u8); + writer.WriteStringValue(Offering); + } + if (options.Format != "W" && Optional.IsDefined(ManagedIdentityCertificateExpirationTime)) + { + writer.WritePropertyName("managedIdentityCertificateExpirationTime"u8); + writer.WriteStringValue(ManagedIdentityCertificateExpirationTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastConnectivityTime)) + { + writer.WritePropertyName("lastConnectivityTime"u8); + writer.WriteStringValue(LastConnectivityTime.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ConnectivityStatus)) + { + writer.WritePropertyName("connectivityStatus"u8); + writer.WriteStringValue(ConnectivityStatus.Value.ToString()); + } + if (Optional.IsDefined(PrivateLinkState)) + { + writer.WritePropertyName("privateLinkState"u8); + writer.WriteStringValue(PrivateLinkState.Value.ToString()); + } + if (Optional.IsDefined(PrivateLinkScopeResourceId)) + { + writer.WritePropertyName("privateLinkScopeResourceId"u8); + writer.WriteStringValue(PrivateLinkScopeResourceId); + } + if (Optional.IsDefined(AzureHybridBenefit)) + { + writer.WritePropertyName("azureHybridBenefit"u8); + writer.WriteStringValue(AzureHybridBenefit.Value.ToString()); + } + if (Optional.IsDefined(AadProfile)) + { + writer.WritePropertyName("aadProfile"u8); + writer.WriteObjectValue(AadProfile, options); + } + if (Optional.IsDefined(ArcAgentProfile)) + { + writer.WritePropertyName("arcAgentProfile"u8); + writer.WriteObjectValue(ArcAgentProfile, options); + } + if (Optional.IsDefined(SecurityProfile)) + { + writer.WritePropertyName("securityProfile"u8); + writer.WriteObjectValue(SecurityProfile, options); + } + if (Optional.IsDefined(OidcIssuerProfile)) + { + writer.WritePropertyName("oidcIssuerProfile"u8); + writer.WriteObjectValue(OidcIssuerProfile, options); + } + if (Optional.IsDefined(Gateway)) + { + writer.WritePropertyName("gateway"u8); + writer.WriteObjectValue(Gateway, options); + } + if (Optional.IsCollectionDefined(ArcAgentryConfigurations)) + { + writer.WritePropertyName("arcAgentryConfigurations"u8); + writer.WriteStartArray(); + foreach (ArcAgentryConfigurations item in ArcAgentryConfigurations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(MiscellaneousProperties)) + { + writer.WritePropertyName("miscellaneousProperties"u8); + writer.WriteStartObject(); + foreach (var item in MiscellaneousProperties) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ConnectedClusterProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ConnectedClusterProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectedClusterProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectedClusterProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ConnectedClusterProperties DeserializeConnectedClusterProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string agentPublicKeyCertificate = default; + string kubernetesVersion = default; + int? totalNodeCount = default; + int? totalCoreCount = default; + string agentVersion = default; + ProvisioningState? provisioningState = default; + string distribution = default; + string distributionVersion = default; + string infrastructure = default; + string offering = default; + DateTimeOffset? managedIdentityCertificateExpirationTime = default; + DateTimeOffset? lastConnectivityTime = default; + ConnectivityStatus? connectivityStatus = default; + PrivateLinkState? privateLinkState = default; + string privateLinkScopeResourceId = default; + AzureHybridBenefit? azureHybridBenefit = default; + AadProfile aadProfile = default; + ArcAgentProfile arcAgentProfile = default; + SecurityProfile securityProfile = default; + OidcIssuerProfile oidcIssuerProfile = default; + Gateway gateway = default; + IList arcAgentryConfigurations = default; + IReadOnlyDictionary miscellaneousProperties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("agentPublicKeyCertificate"u8)) + { + agentPublicKeyCertificate = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("kubernetesVersion"u8)) + { + kubernetesVersion = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("totalNodeCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + totalNodeCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("totalCoreCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + totalCoreCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("agentVersion"u8)) + { + agentVersion = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("distribution"u8)) + { + distribution = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("distributionVersion"u8)) + { + distributionVersion = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("infrastructure"u8)) + { + infrastructure = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("offering"u8)) + { + offering = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("managedIdentityCertificateExpirationTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedIdentityCertificateExpirationTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("lastConnectivityTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastConnectivityTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("connectivityStatus"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectivityStatus = new ConnectivityStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("privateLinkState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateLinkState = new PrivateLinkState(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("privateLinkScopeResourceId"u8)) + { + privateLinkScopeResourceId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("azureHybridBenefit"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureHybridBenefit = new AzureHybridBenefit(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("aadProfile"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + aadProfile = AadProfile.DeserializeAadProfile(prop.Value, options); + continue; + } + if (prop.NameEquals("arcAgentProfile"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + arcAgentProfile = ArcAgentProfile.DeserializeArcAgentProfile(prop.Value, options); + continue; + } + if (prop.NameEquals("securityProfile"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityProfile = SecurityProfile.DeserializeSecurityProfile(prop.Value, options); + continue; + } + if (prop.NameEquals("oidcIssuerProfile"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + oidcIssuerProfile = OidcIssuerProfile.DeserializeOidcIssuerProfile(prop.Value, options); + continue; + } + if (prop.NameEquals("gateway"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + gateway = null; + continue; + } + gateway = Gateway.DeserializeGateway(prop.Value, options); + continue; + } + if (prop.NameEquals("arcAgentryConfigurations"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(Models.ArcAgentryConfigurations.DeserializeArcAgentryConfigurations(item, options)); + } + arcAgentryConfigurations = array; + continue; + } + if (prop.NameEquals("miscellaneousProperties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + miscellaneousProperties = dictionary; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ConnectedClusterProperties( + agentPublicKeyCertificate, + kubernetesVersion, + totalNodeCount, + totalCoreCount, + agentVersion, + provisioningState, + distribution, + distributionVersion, + infrastructure, + offering, + managedIdentityCertificateExpirationTime, + lastConnectivityTime, + connectivityStatus, + privateLinkState, + privateLinkScopeResourceId, + azureHybridBenefit, + aadProfile, + arcAgentProfile, + securityProfile, + oidcIssuerProfile, + gateway, + arcAgentryConfigurations ?? new ChangeTrackingList(), + miscellaneousProperties ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(ConnectedClusterProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ConnectedClusterProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ConnectedClusterProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeConnectedClusterProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectedClusterProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterProperties.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterProperties.cs new file mode 100644 index 000000000000..22a81088ba8d --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectedClusterProperties.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Properties of the connected cluster. + public partial class ConnectedClusterProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. + /// is null. + public ConnectedClusterProperties(string agentPublicKeyCertificate) + { + Argument.AssertNotNull(agentPublicKeyCertificate, nameof(agentPublicKeyCertificate)); + + AgentPublicKeyCertificate = agentPublicKeyCertificate; + ArcAgentryConfigurations = new ChangeTrackingList(); + MiscellaneousProperties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. + /// The Kubernetes version of the connected cluster resource. + /// Number of nodes present in the connected cluster resource. + /// Number of CPU cores present in the connected cluster resource. + /// Version of the agent running on the connected cluster resource. + /// Provisioning state of the connected cluster resource. + /// The Kubernetes distribution running on this connected cluster. + /// The Kubernetes distribution version on this connected cluster. + /// The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on. + /// Connected cluster offering. + /// Expiration time of the managed identity certificate. + /// Time representing the last instance when heart beat was received from the cluster. + /// Represents the connectivity status of the connected cluster. + /// Property which describes the state of private link on a connected cluster resource. + /// This is populated only if privateLinkState is enabled. The resource id of the private link scope this connected cluster is assigned to, if any. + /// Indicates whether Azure Hybrid Benefit is opted in. + /// AAD profile for the connected cluster. + /// Arc agentry configuration for the provisioned cluster. + /// Security profile for the connected cluster. + /// Open ID Connect (OIDC) Issuer Profile for the connected cluster. + /// Details of the gateway used by the Arc router for connectivity. + /// Configuration settings for customizing the behavior of the connected cluster. + /// More properties related to the Connected Cluster. + /// Keeps track of any properties unknown to the library. + internal ConnectedClusterProperties(string agentPublicKeyCertificate, string kubernetesVersion, int? totalNodeCount, int? totalCoreCount, string agentVersion, ProvisioningState? provisioningState, string distribution, string distributionVersion, string infrastructure, string offering, DateTimeOffset? managedIdentityCertificateExpirationTime, DateTimeOffset? lastConnectivityTime, ConnectivityStatus? connectivityStatus, PrivateLinkState? privateLinkState, string privateLinkScopeResourceId, AzureHybridBenefit? azureHybridBenefit, AadProfile aadProfile, ArcAgentProfile arcAgentProfile, SecurityProfile securityProfile, OidcIssuerProfile oidcIssuerProfile, Gateway gateway, IList arcAgentryConfigurations, IReadOnlyDictionary miscellaneousProperties, IDictionary additionalBinaryDataProperties) + { + AgentPublicKeyCertificate = agentPublicKeyCertificate; + KubernetesVersion = kubernetesVersion; + TotalNodeCount = totalNodeCount; + TotalCoreCount = totalCoreCount; + AgentVersion = agentVersion; + ProvisioningState = provisioningState; + Distribution = distribution; + DistributionVersion = distributionVersion; + Infrastructure = infrastructure; + Offering = offering; + ManagedIdentityCertificateExpirationTime = managedIdentityCertificateExpirationTime; + LastConnectivityTime = lastConnectivityTime; + ConnectivityStatus = connectivityStatus; + PrivateLinkState = privateLinkState; + PrivateLinkScopeResourceId = privateLinkScopeResourceId; + AzureHybridBenefit = azureHybridBenefit; + AadProfile = aadProfile; + ArcAgentProfile = arcAgentProfile; + SecurityProfile = securityProfile; + OidcIssuerProfile = oidcIssuerProfile; + Gateway = gateway; + ArcAgentryConfigurations = arcAgentryConfigurations; + MiscellaneousProperties = miscellaneousProperties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Base64 encoded public certificate used by the agent to do the initial handshake to the backend services in Azure. + public string AgentPublicKeyCertificate { get; set; } + + /// The Kubernetes version of the connected cluster resource. + public string KubernetesVersion { get; } + + /// Number of nodes present in the connected cluster resource. + public int? TotalNodeCount { get; } + + /// Number of CPU cores present in the connected cluster resource. + public int? TotalCoreCount { get; } + + /// Version of the agent running on the connected cluster resource. + public string AgentVersion { get; } + + /// Provisioning state of the connected cluster resource. + public ProvisioningState? ProvisioningState { get; set; } + + /// The Kubernetes distribution running on this connected cluster. + public string Distribution { get; set; } + + /// The Kubernetes distribution version on this connected cluster. + public string DistributionVersion { get; set; } + + /// The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on. + public string Infrastructure { get; set; } + + /// Connected cluster offering. + public string Offering { get; } + + /// Expiration time of the managed identity certificate. + public DateTimeOffset? ManagedIdentityCertificateExpirationTime { get; } + + /// Time representing the last instance when heart beat was received from the cluster. + public DateTimeOffset? LastConnectivityTime { get; } + + /// Represents the connectivity status of the connected cluster. + public ConnectivityStatus? ConnectivityStatus { get; } + + /// Property which describes the state of private link on a connected cluster resource. + public PrivateLinkState? PrivateLinkState { get; set; } + + /// This is populated only if privateLinkState is enabled. The resource id of the private link scope this connected cluster is assigned to, if any. + public string PrivateLinkScopeResourceId { get; set; } + + /// Indicates whether Azure Hybrid Benefit is opted in. + public AzureHybridBenefit? AzureHybridBenefit { get; set; } + + /// AAD profile for the connected cluster. + public AadProfile AadProfile { get; set; } + + /// Arc agentry configuration for the provisioned cluster. + public ArcAgentProfile ArcAgentProfile { get; set; } + + /// Security profile for the connected cluster. + internal SecurityProfile SecurityProfile { get; set; } + + /// Open ID Connect (OIDC) Issuer Profile for the connected cluster. + public OidcIssuerProfile OidcIssuerProfile { get; set; } + + /// Details of the gateway used by the Arc router for connectivity. + internal Gateway Gateway { get; set; } + + /// Configuration settings for customizing the behavior of the connected cluster. + public IList ArcAgentryConfigurations { get; set; } + + /// More properties related to the Connected Cluster. + public IReadOnlyDictionary MiscellaneousProperties { get; } + + /// The workload identity feature webhook. + public SecurityProfileWorkloadIdentity SecurityWorkloadIdentity + { + get + { + return SecurityProfile is null ? default : SecurityProfile.WorkloadIdentity; + } + set + { + if (SecurityProfile is null) + { + SecurityProfile = new SecurityProfile(); + } + SecurityProfile.WorkloadIdentity = value; + } + } + + /// Indicates whether the gateway for arc router connectivity is enabled. + public bool? GatewayEnabled + { + get + { + return Gateway is null ? default : Gateway.Enabled; + } + set + { + if (Gateway is null) + { + Gateway = new Gateway(); + } + Gateway.Enabled = value; + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectivityStatus.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectivityStatus.cs index 656136a08ecc..8c12efe23d41 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectivityStatus.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ConnectivityStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { @@ -14,44 +15,67 @@ namespace Azure.ResourceManager.Kubernetes.Models public readonly partial struct ConnectivityStatus : IEquatable { private readonly string _value; + private const string ConnectingValue = "Connecting"; + private const string ConnectedValue = "Connected"; + private const string OfflineValue = "Offline"; + private const string ExpiredValue = "Expired"; + private const string AgentNotInstalledValue = "AgentNotInstalled"; /// Initializes a new instance of . + /// The value. /// is null. public ConnectivityStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string ConnectingValue = "Connecting"; - private const string ConnectedValue = "Connected"; - private const string OfflineValue = "Offline"; - private const string ExpiredValue = "Expired"; + _value = value; + } - /// Connecting. + /// Gets the Connecting. public static ConnectivityStatus Connecting { get; } = new ConnectivityStatus(ConnectingValue); - /// Connected. + + /// Gets the Connected. public static ConnectivityStatus Connected { get; } = new ConnectivityStatus(ConnectedValue); - /// Offline. + + /// Gets the Offline. public static ConnectivityStatus Offline { get; } = new ConnectivityStatus(OfflineValue); - /// Expired. + + /// Gets the Expired. public static ConnectivityStatus Expired { get; } = new ConnectivityStatus(ExpiredValue); + + /// Gets the AgentNotInstalled. + public static ConnectivityStatus AgentNotInstalled { get; } = new ConnectivityStatus(AgentNotInstalledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ConnectivityStatus left, ConnectivityStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ConnectivityStatus left, ConnectivityStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ConnectivityStatus(string value) => new ConnectivityStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ConnectivityStatus?(string value) => value == null ? null : new ConnectivityStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ConnectivityStatus other && Equals(other); - /// + + /// public bool Equals(ConnectivityStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResult.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResult.Serialization.cs index d34f0cb321f4..dd1002ac31c2 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResult.Serialization.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResult.Serialization.cs @@ -8,16 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { - public partial class CredentialResult : IUtf8JsonSerializable, IJsonModel + /// The credential result response. + public partial class CredentialResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CredentialResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -43,17 +42,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(Value)) { writer.WritePropertyName("value"u8); - writer.WriteBase64StringValue(Value, "D"); + writer.WriteBase64StringValue(Value.ToArray(), "D"); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -62,132 +61,88 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CredentialResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + CredentialResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CredentialResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CredentialResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeCredentialResult(document.RootElement, options); } - internal static CredentialResult DeserializeCredentialResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CredentialResult DeserializeCredentialResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; - byte[] value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + BinaryData value = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - value = property.Value.GetBytesFromBase64("D"); + value = BinaryData.FromBytes(prop.Value.GetBytesFromBase64("D")); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new CredentialResult(name, value, serializedAdditionalRawData); + return new CredentialResult(name, value, additionalBinaryDataProperties); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Value)) - { - builder.Append(" value: "); - builder.AppendLine($"'{Value.ToString()}'"); - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(CredentialResult)} does not support writing '{options.Format}' format."); } } - CredentialResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + CredentialResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CredentialResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeCredentialResult(document.RootElement, options); } default: @@ -195,6 +150,7 @@ CredentialResult IPersistableModel.Create(BinaryData data, Mod } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResult.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResult.cs index 583f6c5bdbb8..5ee0f9fe30f1 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResult.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResult.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.Kubernetes.Models /// The credential result response. public partial class CredentialResult { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal CredentialResult() @@ -53,19 +24,33 @@ internal CredentialResult() /// Initializes a new instance of . /// The name of the credential. /// Base64-encoded Kubernetes configuration file. - /// Keeps track of any properties unknown to the library. - internal CredentialResult(string name, byte[] value, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal CredentialResult(string name, BinaryData value, IDictionary additionalBinaryDataProperties) { Name = name; Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The name of the credential. - [WirePath("name")] public string Name { get; } - /// Base64-encoded Kubernetes configuration file. - [WirePath("value")] - public byte[] Value { get; } + + /// + /// Base64-encoded Kubernetes configuration file. + /// + /// To assign a byte[] to this property use . + /// The byte[] will be serialized to a Base64 encoded string. + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromBytes(new byte[] { 1, 2, 3 }). + /// Creates a payload of "AQID". + /// + /// + /// + /// + public BinaryData Value { get; } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResults.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResults.Serialization.cs index cdec1755b7ce..81d39b6ae686 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResults.Serialization.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResults.Serialization.cs @@ -8,17 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { - public partial class CredentialResults : IUtf8JsonSerializable, IJsonModel + /// The list of credential result response. + public partial class CredentialResults : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CredentialResults)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(HybridConnectionConfig)) { writer.WritePropertyName("hybridConnectionConfig"u8); @@ -45,21 +44,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("kubeconfigs"u8); writer.WriteStartArray(); - foreach (var item in Kubeconfigs) + foreach (CredentialResult item in Kubeconfigs) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -68,49 +67,53 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CredentialResults IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + CredentialResults IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CredentialResults JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(CredentialResults)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeCredentialResults(document.RootElement, options); } - internal static CredentialResults DeserializeCredentialResults(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CredentialResults DeserializeCredentialResults(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } HybridConnectionConfig hybridConnectionConfig = default; IReadOnlyList kubeconfigs = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("hybridConnectionConfig"u8)) + if (prop.NameEquals("hybridConnectionConfig"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - hybridConnectionConfig = HybridConnectionConfig.DeserializeHybridConnectionConfig(property.Value, options); + hybridConnectionConfig = HybridConnectionConfig.DeserializeHybridConnectionConfig(prop.Value, options); continue; } - if (property.NameEquals("kubeconfigs"u8)) + if (prop.NameEquals("kubeconfigs"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(CredentialResult.DeserializeCredentialResult(item, options)); } @@ -119,90 +122,42 @@ internal static CredentialResults DeserializeCredentialResults(JsonElement eleme } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new CredentialResults(hybridConnectionConfig, kubeconfigs ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new CredentialResults(hybridConnectionConfig, kubeconfigs ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HybridConnectionConfig), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hybridConnectionConfig: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HybridConnectionConfig)) - { - builder.Append(" hybridConnectionConfig: "); - BicepSerializationHelpers.AppendChildObject(builder, HybridConnectionConfig, options, 2, false, " hybridConnectionConfig: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kubeconfigs), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kubeconfigs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Kubeconfigs)) - { - if (Kubeconfigs.Any()) - { - builder.Append(" kubeconfigs: "); - builder.AppendLine("["); - foreach (var item in Kubeconfigs) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " kubeconfigs: "); - } - builder.AppendLine(" ]"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(CredentialResults)} does not support writing '{options.Format}' format."); } } - CredentialResults IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + CredentialResults IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CredentialResults PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeCredentialResults(document.RootElement, options); } default: @@ -210,6 +165,15 @@ CredentialResults IPersistableModel.Create(BinaryData data, M } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static CredentialResults FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeCredentialResults(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResults.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResults.cs index 59c2c1a67c72..51d2306cb381 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResults.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/CredentialResults.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { /// The list of credential result response. public partial class CredentialResults { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal CredentialResults() @@ -54,19 +26,18 @@ internal CredentialResults() /// Initializes a new instance of . /// Contains the REP (rendezvous endpoint) and “Sender” access token. /// Base64-encoded Kubernetes configuration file. - /// Keeps track of any properties unknown to the library. - internal CredentialResults(HybridConnectionConfig hybridConnectionConfig, IReadOnlyList kubeconfigs, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal CredentialResults(HybridConnectionConfig hybridConnectionConfig, IReadOnlyList kubeconfigs, IDictionary additionalBinaryDataProperties) { HybridConnectionConfig = hybridConnectionConfig; Kubeconfigs = kubeconfigs; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Contains the REP (rendezvous endpoint) and “Sender” access token. - [WirePath("hybridConnectionConfig")] public HybridConnectionConfig HybridConnectionConfig { get; } + /// Base64-encoded Kubernetes configuration file. - [WirePath("kubeconfigs")] public IReadOnlyList Kubeconfigs { get; } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/Gateway.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/Gateway.Serialization.cs new file mode 100644 index 000000000000..67d105921654 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/Gateway.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// The Gateway. + internal partial class Gateway : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Gateway)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + Gateway IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual Gateway JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Gateway)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGateway(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static Gateway DeserializeGateway(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("enabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new Gateway(enabled, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(Gateway)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + Gateway IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual Gateway PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeGateway(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Gateway)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/Gateway.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/Gateway.cs new file mode 100644 index 000000000000..f463bf7981e7 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/Gateway.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// The Gateway. + internal partial class Gateway + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public Gateway() + { + } + + /// Initializes a new instance of . + /// Indicates whether the gateway for arc router connectivity is enabled. + /// Keeps track of any properties unknown to the library. + internal Gateway(bool? enabled, IDictionary additionalBinaryDataProperties) + { + Enabled = enabled; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Indicates whether the gateway for arc router connectivity is enabled. + public bool? Enabled { get; set; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/HybridConnectionConfig.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/HybridConnectionConfig.Serialization.cs index 5c9657ea6717..7d8ea661f9b1 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/HybridConnectionConfig.Serialization.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/HybridConnectionConfig.Serialization.cs @@ -8,16 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { - public partial class HybridConnectionConfig : IUtf8JsonSerializable, IJsonModel + /// Contains the REP (rendezvous endpoint) and “Sender” access token. + public partial class HybridConnectionConfig : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -29,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(HybridConnectionConfig)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ExpirationTime)) { writer.WritePropertyName("expirationTime"u8); @@ -55,15 +54,25 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("token"u8); writer.WriteStringValue(Token); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && Optional.IsDefined(RelayTid)) { - foreach (var item in _serializedAdditionalRawData) + writer.WritePropertyName("relayTid"u8); + writer.WriteStringValue(RelayTid); + } + if (options.Format != "W" && Optional.IsDefined(RelayType)) + { + writer.WritePropertyName("relayType"u8); + writer.WriteStringValue(RelayType); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -72,22 +81,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - HybridConnectionConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + HybridConnectionConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual HybridConnectionConfig JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(HybridConnectionConfig)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeHybridConnectionConfig(document.RootElement, options); } - internal static HybridConnectionConfig DeserializeHybridConnectionConfig(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static HybridConnectionConfig DeserializeHybridConnectionConfig(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -96,166 +110,90 @@ internal static HybridConnectionConfig DeserializeHybridConnectionConfig(JsonEle string hybridConnectionName = default; string relay = default; string token = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + string relayTid = default; + string relayType = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("expirationTime"u8)) + if (prop.NameEquals("expirationTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - expirationTime = property.Value.GetInt64(); + expirationTime = prop.Value.GetInt64(); continue; } - if (property.NameEquals("hybridConnectionName"u8)) + if (prop.NameEquals("hybridConnectionName"u8)) { - hybridConnectionName = property.Value.GetString(); + hybridConnectionName = prop.Value.GetString(); continue; } - if (property.NameEquals("relay"u8)) + if (prop.NameEquals("relay"u8)) { - relay = property.Value.GetString(); + relay = prop.Value.GetString(); continue; } - if (property.NameEquals("token"u8)) + if (prop.NameEquals("token"u8)) { - token = property.Value.GetString(); + token = prop.Value.GetString(); continue; } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new HybridConnectionConfig(expirationTime, hybridConnectionName, relay, token, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExpirationTime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" expirationTime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ExpirationTime)) + if (prop.NameEquals("relayTid"u8)) { - builder.Append(" expirationTime: "); - builder.AppendLine($"'{ExpirationTime.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HybridConnectionName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hybridConnectionName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HybridConnectionName)) - { - builder.Append(" hybridConnectionName: "); - if (HybridConnectionName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{HybridConnectionName}'''"); - } - else - { - builder.AppendLine($"'{HybridConnectionName}'"); - } + relayTid = prop.Value.GetString(); + continue; } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Relay), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" relay: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Relay)) + if (prop.NameEquals("relayType"u8)) { - builder.Append(" relay: "); - if (Relay.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Relay}'''"); - } - else - { - builder.AppendLine($"'{Relay}'"); - } + relayType = prop.Value.GetString(); + continue; } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Token), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" token: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Token)) + if (options.Format != "W") { - builder.Append(" token: "); - if (Token.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Token}'''"); - } - else - { - builder.AppendLine($"'{Token}'"); - } + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new HybridConnectionConfig( + expirationTime, + hybridConnectionName, + relay, + token, + relayTid, + relayType, + additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(HybridConnectionConfig)} does not support writing '{options.Format}' format."); } } - HybridConnectionConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + HybridConnectionConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual HybridConnectionConfig PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeHybridConnectionConfig(document.RootElement, options); } default: @@ -263,6 +201,7 @@ HybridConnectionConfig IPersistableModel.Create(BinaryDa } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/HybridConnectionConfig.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/HybridConnectionConfig.cs index a2ff7b27eab0..cbc6067da0ff 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/HybridConnectionConfig.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/HybridConnectionConfig.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.Kubernetes.Models /// Contains the REP (rendezvous endpoint) and “Sender” access token. public partial class HybridConnectionConfig { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal HybridConnectionConfig() @@ -55,27 +26,36 @@ internal HybridConnectionConfig() /// Name of the connection. /// Name of the relay. /// Sender access token. - /// Keeps track of any properties unknown to the library. - internal HybridConnectionConfig(long? expirationTime, string hybridConnectionName, string relay, string token, IDictionary serializedAdditionalRawData) + /// TenantID of the relay. + /// Type of relay. + /// Keeps track of any properties unknown to the library. + internal HybridConnectionConfig(long? expirationTime, string hybridConnectionName, string relay, string token, string relayTid, string relayType, IDictionary additionalBinaryDataProperties) { ExpirationTime = expirationTime; HybridConnectionName = hybridConnectionName; Relay = relay; Token = token; - _serializedAdditionalRawData = serializedAdditionalRawData; + RelayTid = relayTid; + RelayType = relayType; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Timestamp when this token will be expired. - [WirePath("expirationTime")] public long? ExpirationTime { get; } + /// Name of the connection. - [WirePath("hybridConnectionName")] public string HybridConnectionName { get; } + /// Name of the relay. - [WirePath("relay")] public string Relay { get; } + /// Sender access token. - [WirePath("token")] public string Token { get; } + + /// TenantID of the relay. + public string RelayTid { get; } + + /// Type of relay. + public string RelayType { get; } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ListClusterUserCredentialProperties.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ListClusterUserCredentialProperties.Serialization.cs index 383d269f0fba..364ebc3bee04 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ListClusterUserCredentialProperties.Serialization.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ListClusterUserCredentialProperties.Serialization.cs @@ -10,13 +10,20 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { - public partial class ListClusterUserCredentialProperties : IUtf8JsonSerializable, IJsonModel + /// The ListClusterUserCredentialProperties. + public partial class ListClusterUserCredentialProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ListClusterUserCredentialProperties() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,25 +35,24 @@ void IJsonModel.Write(Utf8JsonWriter writer /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ListClusterUserCredentialProperties)} does not support writing '{format}' format."); } - writer.WritePropertyName("authenticationMethod"u8); writer.WriteStringValue(AuthenticationMethod.ToString()); writer.WritePropertyName("clientProxy"u8); writer.WriteBooleanValue(ClientProxy); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -55,55 +61,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ListClusterUserCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ListClusterUserCredentialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ListClusterUserCredentialProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ListClusterUserCredentialProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeListClusterUserCredentialProperties(document.RootElement, options); } - internal static ListClusterUserCredentialProperties DeserializeListClusterUserCredentialProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ListClusterUserCredentialProperties DeserializeListClusterUserCredentialProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } AuthenticationMethod authenticationMethod = default; bool clientProxy = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("authenticationMethod"u8)) + if (prop.NameEquals("authenticationMethod"u8)) { - authenticationMethod = new AuthenticationMethod(property.Value.GetString()); + authenticationMethod = new AuthenticationMethod(prop.Value.GetString()); continue; } - if (property.NameEquals("clientProxy"u8)) + if (prop.NameEquals("clientProxy"u8)) { - clientProxy = property.Value.GetBoolean(); + clientProxy = prop.Value.GetBoolean(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ListClusterUserCredentialProperties(authenticationMethod, clientProxy, serializedAdditionalRawData); + return new ListClusterUserCredentialProperties(authenticationMethod, clientProxy, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -113,15 +125,20 @@ BinaryData IPersistableModel.Write(ModelRea } } - ListClusterUserCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The data to parse. + /// The client options for reading and writing models. + ListClusterUserCredentialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ListClusterUserCredentialProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeListClusterUserCredentialProperties(document.RootElement, options); } default: @@ -129,6 +146,19 @@ ListClusterUserCredentialProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(ListClusterUserCredentialProperties listClusterUserCredentialProperties) + { + if (listClusterUserCredentialProperties == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(listClusterUserCredentialProperties, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ListClusterUserCredentialProperties.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ListClusterUserCredentialProperties.cs index b71ab44f24cc..e37d1123c0c6 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ListClusterUserCredentialProperties.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ListClusterUserCredentialProperties.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.Kubernetes.Models /// The ListClusterUserCredentialProperties. public partial class ListClusterUserCredentialProperties { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// The mode of client authentication. @@ -57,24 +28,18 @@ public ListClusterUserCredentialProperties(AuthenticationMethod authenticationMe /// Initializes a new instance of . /// The mode of client authentication. /// Boolean value to indicate whether the request is for client side proxy or not. - /// Keeps track of any properties unknown to the library. - internal ListClusterUserCredentialProperties(AuthenticationMethod authenticationMethod, bool clientProxy, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ListClusterUserCredentialProperties(AuthenticationMethod authenticationMethod, bool clientProxy, IDictionary additionalBinaryDataProperties) { AuthenticationMethod = authenticationMethod; ClientProxy = clientProxy; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ListClusterUserCredentialProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The mode of client authentication. - [WirePath("authenticationMethod")] public AuthenticationMethod AuthenticationMethod { get; } + /// Boolean value to indicate whether the request is for client side proxy or not. - [WirePath("clientProxy")] public bool ClientProxy { get; } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/OidcIssuerProfile.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/OidcIssuerProfile.Serialization.cs new file mode 100644 index 000000000000..2356dedda021 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/OidcIssuerProfile.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// OIDC Issuer Profile specifies attributes for workload identity integration. + public partial class OidcIssuerProfile : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OidcIssuerProfile)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && Optional.IsDefined(IssuerUri)) + { + writer.WritePropertyName("issuerUrl"u8); + writer.WriteStringValue(IssuerUri); + } + if (Optional.IsDefined(SelfHostedIssuerUri)) + { + writer.WritePropertyName("selfHostedIssuerUrl"u8); + writer.WriteStringValue(SelfHostedIssuerUri); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + OidcIssuerProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual OidcIssuerProfile JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OidcIssuerProfile)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOidcIssuerProfile(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static OidcIssuerProfile DeserializeOidcIssuerProfile(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + string issuerUri = default; + string selfHostedIssuerUri = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("enabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("issuerUrl"u8)) + { + issuerUri = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("selfHostedIssuerUrl"u8)) + { + selfHostedIssuerUri = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new OidcIssuerProfile(enabled, issuerUri, selfHostedIssuerUri, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(OidcIssuerProfile)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + OidcIssuerProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual OidcIssuerProfile PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeOidcIssuerProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OidcIssuerProfile)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/OidcIssuerProfile.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/OidcIssuerProfile.cs new file mode 100644 index 000000000000..3058769f6e21 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/OidcIssuerProfile.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// OIDC Issuer Profile specifies attributes for workload identity integration. + public partial class OidcIssuerProfile + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public OidcIssuerProfile() + { + } + + /// Initializes a new instance of . + /// Whether to enable oidc issuer for workload identity integration. + /// The issuer url for hybrid clusters connected to Arc used for the workload identity feature. + /// The issuer url for public cloud clusters - AKS, EKS, GKE - used for the workload identity feature. + /// Keeps track of any properties unknown to the library. + internal OidcIssuerProfile(bool? enabled, string issuerUri, string selfHostedIssuerUri, IDictionary additionalBinaryDataProperties) + { + Enabled = enabled; + IssuerUri = issuerUri; + SelfHostedIssuerUri = selfHostedIssuerUri; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Whether to enable oidc issuer for workload identity integration. + public bool? Enabled { get; set; } + + /// The issuer url for hybrid clusters connected to Arc used for the workload identity feature. + public string IssuerUri { get; } + + /// The issuer url for public cloud clusters - AKS, EKS, GKE - used for the workload identity feature. + public string SelfHostedIssuerUri { get; set; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/PrivateLinkState.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/PrivateLinkState.cs index a6621ed54fb4..31714419655b 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/PrivateLinkState.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/PrivateLinkState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.Kubernetes.Models public readonly partial struct PrivateLinkState : IEquatable { private readonly string _value; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; /// Initializes a new instance of . + /// The value. /// is null. public PrivateLinkState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; + _value = value; + } - /// Enabled. + /// Gets the Enabled. public static PrivateLinkState Enabled { get; } = new PrivateLinkState(EnabledValue); - /// Disabled. + + /// Gets the Disabled. public static PrivateLinkState Disabled { get; } = new PrivateLinkState(DisabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(PrivateLinkState left, PrivateLinkState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(PrivateLinkState left, PrivateLinkState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator PrivateLinkState(string value) => new PrivateLinkState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator PrivateLinkState?(string value) => value == null ? null : new PrivateLinkState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is PrivateLinkState other && Equals(other); - /// + + /// public bool Equals(PrivateLinkState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ProvisioningState.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ProvisioningState.cs index 2b8294d432cb..08ce8826431d 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ProvisioningState.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/ProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.Kubernetes; namespace Azure.ResourceManager.Kubernetes.Models { @@ -14,14 +15,6 @@ namespace Azure.ResourceManager.Kubernetes.Models public readonly partial struct ProvisioningState : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string SucceededValue = "Succeeded"; private const string FailedValue = "Failed"; private const string CanceledValue = "Canceled"; @@ -30,37 +23,67 @@ public ProvisioningState(string value) private const string DeletingValue = "Deleting"; private const string AcceptedValue = "Accepted"; - /// Succeeded. + /// Initializes a new instance of . + /// The value. + /// is null. + public ProvisioningState(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Succeeded. public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); - /// Failed. + + /// Gets the Failed. public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); - /// Canceled. + + /// Gets the Canceled. public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); - /// Provisioning. + + /// Gets the Provisioning. public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); - /// Updating. + + /// Gets the Updating. public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); - /// Deleting. + + /// Gets the Deleting. public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); - /// Accepted. + + /// Gets the Accepted. public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ProvisioningState?(string value) => value == null ? null : new ProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); - /// + + /// public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - /// + /// [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// + + /// public override string ToString() => _value; } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfile.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfile.Serialization.cs new file mode 100644 index 000000000000..902258dd6871 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfile.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Security Profile specifies attributes for cluster security features. + internal partial class SecurityProfile : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecurityProfile)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(WorkloadIdentity)) + { + writer.WritePropertyName("workloadIdentity"u8); + writer.WriteObjectValue(WorkloadIdentity, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SecurityProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecurityProfile JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecurityProfile)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityProfile(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecurityProfile DeserializeSecurityProfile(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SecurityProfileWorkloadIdentity workloadIdentity = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("workloadIdentity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + workloadIdentity = SecurityProfileWorkloadIdentity.DeserializeSecurityProfileWorkloadIdentity(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SecurityProfile(workloadIdentity, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(SecurityProfile)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SecurityProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecurityProfile PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSecurityProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecurityProfile)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfile.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfile.cs new file mode 100644 index 000000000000..0cbde0ee7c9f --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfile.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// Security Profile specifies attributes for cluster security features. + internal partial class SecurityProfile + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SecurityProfile() + { + } + + /// Initializes a new instance of . + /// The workload identity feature webhook. + /// Keeps track of any properties unknown to the library. + internal SecurityProfile(SecurityProfileWorkloadIdentity workloadIdentity, IDictionary additionalBinaryDataProperties) + { + WorkloadIdentity = workloadIdentity; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The workload identity feature webhook. + internal SecurityProfileWorkloadIdentity WorkloadIdentity { get; set; } + + /// Whether to enable or disable the workload identity Webhook. + public bool? WorkloadIdentityEnabled + { + get + { + return WorkloadIdentity is null ? default : WorkloadIdentity.Enabled; + } + set + { + if (WorkloadIdentity is null) + { + WorkloadIdentity = new SecurityProfileWorkloadIdentity(); + } + WorkloadIdentity.Enabled = value; + } + } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfileWorkloadIdentity.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfileWorkloadIdentity.Serialization.cs new file mode 100644 index 000000000000..b58d9d61a289 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfileWorkloadIdentity.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// The workload identity feature webhook. + public partial class SecurityProfileWorkloadIdentity : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecurityProfileWorkloadIdentity)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SecurityProfileWorkloadIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecurityProfileWorkloadIdentity JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecurityProfileWorkloadIdentity)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecurityProfileWorkloadIdentity(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecurityProfileWorkloadIdentity DeserializeSecurityProfileWorkloadIdentity(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("enabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SecurityProfileWorkloadIdentity(enabled, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(SecurityProfileWorkloadIdentity)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SecurityProfileWorkloadIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecurityProfileWorkloadIdentity PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSecurityProfileWorkloadIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecurityProfileWorkloadIdentity)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfileWorkloadIdentity.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfileWorkloadIdentity.cs new file mode 100644 index 000000000000..a3bd7a5efc1b --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SecurityProfileWorkloadIdentity.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// The workload identity feature webhook. + public partial class SecurityProfileWorkloadIdentity + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SecurityProfileWorkloadIdentity() + { + } + + /// Initializes a new instance of . + /// Whether to enable or disable the workload identity Webhook. + /// Keeps track of any properties unknown to the library. + internal SecurityProfileWorkloadIdentity(bool? enabled, IDictionary additionalBinaryDataProperties) + { + Enabled = enabled; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Whether to enable or disable the workload identity Webhook. + public bool? Enabled { get; set; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SystemComponent.Serialization.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SystemComponent.Serialization.cs new file mode 100644 index 000000000000..6381e2154d74 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SystemComponent.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.Kubernetes; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// System extensions and its current versions installed on the cluster resource. + public partial class SystemComponent : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SystemComponent)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (Optional.IsDefined(UserSpecifiedVersion)) + { + writer.WritePropertyName("userSpecifiedVersion"u8); + writer.WriteStringValue(UserSpecifiedVersion); + } + if (Optional.IsDefined(MajorVersion)) + { + writer.WritePropertyName("majorVersion"u8); + writer.WriteNumberValue(MajorVersion.Value); + } + if (options.Format != "W" && Optional.IsDefined(CurrentVersion)) + { + writer.WritePropertyName("currentVersion"u8); + writer.WriteStringValue(CurrentVersion); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + SystemComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SystemComponent JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SystemComponent)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSystemComponent(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SystemComponent DeserializeSystemComponent(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string @type = default; + string userSpecifiedVersion = default; + int? majorVersion = default; + string currentVersion = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("type"u8)) + { + @type = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("userSpecifiedVersion"u8)) + { + userSpecifiedVersion = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("majorVersion"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + majorVersion = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("currentVersion"u8)) + { + currentVersion = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SystemComponent(@type, userSpecifiedVersion, majorVersion, currentVersion, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerKubernetesContext.Default); + default: + throw new FormatException($"The model {nameof(SystemComponent)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SystemComponent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SystemComponent PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data)) + { + return DeserializeSystemComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SystemComponent)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SystemComponent.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SystemComponent.cs new file mode 100644 index 000000000000..1c4d892e9cf5 --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Models/SystemComponent.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Kubernetes.Models +{ + /// System extensions and its current versions installed on the cluster resource. + public partial class SystemComponent + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SystemComponent() + { + } + + /// Initializes a new instance of . + /// Type of the system extension. + /// Version of the system extension to be installed on the cluster resource. + /// Major Version of the system extension that is currently installed on the cluster resource. + /// Version of the system extension that is currently installed on the cluster resource. + /// Keeps track of any properties unknown to the library. + internal SystemComponent(string @type, string userSpecifiedVersion, int? majorVersion, string currentVersion, IDictionary additionalBinaryDataProperties) + { + Type = @type; + UserSpecifiedVersion = userSpecifiedVersion; + MajorVersion = majorVersion; + CurrentVersion = currentVersion; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Type of the system extension. + public string Type { get; set; } + + /// Version of the system extension to be installed on the cluster resource. + public string UserSpecifiedVersion { get; set; } + + /// Major Version of the system extension that is currently installed on the cluster resource. + public int? MajorVersion { get; set; } + + /// Version of the system extension that is currently installed on the cluster resource. + public string CurrentVersion { get; } + } +} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ProviderConstants.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ProviderConstants.cs index fd4963d74cfd..3747d8bb8ff2 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ProviderConstants.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/ProviderConstants.cs @@ -9,8 +9,9 @@ namespace Azure.ResourceManager.Kubernetes { - internal static class ProviderConstants + internal static partial class ProviderConstants { + /// Gets the DefaultProviderNamespace. public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/RestOperations/ConnectedClusterRestOperations.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/RestOperations/ConnectedClusterRestOperations.cs index e3bca955d794..bfc3be445af9 100644 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/RestOperations/ConnectedClusterRestOperations.cs +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/RestOperations/ConnectedClusterRestOperations.cs @@ -6,830 +6,198 @@ #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.Kubernetes.Models; namespace Azure.ResourceManager.Kubernetes { - internal partial class ConnectedClusterRestOperations + internal partial class ConnectedCluster { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of ConnectedClusterRestOperations. - /// 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 ConnectedClusterRestOperations(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 ?? "2022-05-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string clusterName, ConnectedClusterData data) - { - 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.Kubernetes/connectedClusters/", false); - uri.AppendPath(clusterName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string clusterName, ConnectedClusterData data) + /// Initializes a new instance of ConnectedCluster for mocking. + protected ConnectedCluster() { - 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.Kubernetes/connectedClusters/", false); - uri.AppendPath(clusterName, 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, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; } - /// API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// Parameters supplied to Create a Connected Cluster. - /// 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 clusterName, ConnectedClusterData data, CancellationToken cancellationToken = default) + /// Initializes a new instance of ConnectedCluster. + /// The ClientDiagnostics is used to provide tracing support for the client library. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + /// + internal ConnectedCluster(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, clusterName, 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); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM). - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// Parameters supplied to Create a Connected Cluster. - /// 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 clusterName, ConnectedClusterData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, clusterName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string clusterName, ConnectedClusterPatch 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.Kubernetes/connectedClusters/", false); - uri.AppendPath(clusterName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string clusterName, ConnectedClusterPatch patch) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string clusterName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Kubernetes/connectedClusters/", false); uri.AppendPath(clusterName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// API to update certain properties of the connected cluster resource. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// Parameters supplied to update Connected Cluster. - /// 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 clusterName, ConnectedClusterPatch patch, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrReplaceRequest(string subscriptionId, string resourceGroupName, string clusterName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, clusterName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ConnectedClusterData.DeserializeConnectedClusterData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// API to update certain properties of the connected cluster resource. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// Parameters supplied to update Connected Cluster. - /// 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 clusterName, ConnectedClusterPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, clusterName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ConnectedClusterData.DeserializeConnectedClusterData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string clusterName) - { - 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.Kubernetes/connectedClusters/", false); - uri.AppendPath(clusterName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string clusterName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Kubernetes/connectedClusters/", false); uri.AppendPath(clusterName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// 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 clusterName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, clusterName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ConnectedClusterData.DeserializeConnectedClusterData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ConnectedClusterData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Returns the properties of the specified connected cluster, including name, identity, properties, and additional cluster details. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// 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 clusterName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, clusterName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ConnectedClusterData.DeserializeConnectedClusterData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ConnectedClusterData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string clusterName) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string clusterName, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder 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.Kubernetes/connectedClusters/", false); - uri.AppendPath(clusterName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string clusterName) - { - 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("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Kubernetes/connectedClusters/", false); uri.AppendPath(clusterName, true); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// 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 clusterName, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string clusterName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, clusterName); - 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); - } - } - - /// Delete a connected cluster, removing the tracked resource in Azure Resource Manager (ARM). - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// 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 clusterName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, clusterName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListClusterUserCredentialRequestUri(string subscriptionId, string resourceGroupName, string clusterName, ListClusterUserCredentialProperties properties) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Kubernetes/connectedClusters/", false); uri.AppendPath(clusterName, true); - uri.AppendPath("/listClusterUserCredential", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListClusterUserCredentialRequest(string subscriptionId, string resourceGroupName, string clusterName, ListClusterUserCredentialProperties properties) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - 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.Kubernetes/connectedClusters/", false); - uri.AppendPath(clusterName, true); - uri.AppendPath("/listClusterUserCredential", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(properties, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); + request.Method = RequestMethod.Delete; return message; } - /// Gets cluster user credentials of the connected cluster with a specified resource group and name. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// ListClusterUserCredential properties. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListClusterUserCredentialAsync(string subscriptionId, string resourceGroupName, string clusterName, ListClusterUserCredentialProperties properties, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetByResourceGroupRequest(string subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - Argument.AssertNotNull(properties, nameof(properties)); - - using var message = CreateListClusterUserCredentialRequest(subscriptionId, resourceGroupName, clusterName, properties); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CredentialResults value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = CredentialResults.DeserializeCredentialResults(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets cluster user credentials of the connected cluster with a specified resource group and name. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the Kubernetes cluster on which get is called. - /// ListClusterUserCredential properties. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListClusterUserCredential(string subscriptionId, string resourceGroupName, string clusterName, ListClusterUserCredentialProperties properties, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(clusterName, nameof(clusterName)); - Argument.AssertNotNull(properties, nameof(properties)); - - using var message = CreateListClusterUserCredentialRequest(subscriptionId, resourceGroupName, clusterName, properties); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CredentialResults value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = CredentialResults.DeserializeCredentialResults(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder 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.Kubernetes/connectedClusters", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) - { - 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("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Kubernetes/connectedClusters", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// API to enumerate registered connected K8s clusters under a Resource Group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// 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, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ConnectedClusterList.DeserializeConnectedClusterList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// API to enumerate registered connected K8s clusters under a Resource Group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// 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, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetByResourceGroupRequest(Uri nextPage, string subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ConnectedClusterList.DeserializeConnectedClusterList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Kubernetes/connectedClusters", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + internal HttpMessage CreateGetBySubscriptionRequest(string subscriptionId, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.Kubernetes/connectedClusters", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// API to enumerate registered connected K8s clusters under a Subscription. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ConnectedClusterList.DeserializeConnectedClusterList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// API to enumerate registered connected K8s clusters under a Subscription. - /// The ID of the target subscription. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ConnectedClusterList.DeserializeConnectedClusterList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, string subscriptionId, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// API to enumerate registered connected K8s clusters under a Resource Group. - /// 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 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, 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); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ConnectedClusterList.DeserializeConnectedClusterList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// API to enumerate registered connected K8s clusters under a Resource Group. - /// 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 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, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetClusterUserCredentialRequest(string subscriptionId, string resourceGroupName, string clusterName, RequestContent content, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ConnectedClusterList.DeserializeConnectedClusterList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Kubernetes/connectedClusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/listClusterUserCredential", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - - /// API to enumerate registered connected K8s clusters under a Subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// 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, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ConnectedClusterList.DeserializeConnectedClusterList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// API to enumerate registered connected K8s clusters under a Subscription. - /// The URL to the next page of results. - /// The ID of the target subscription. - /// 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, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ConnectedClusterList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ConnectedClusterList.DeserializeConnectedClusterList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/autorest.md b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/autorest.md deleted file mode 100644 index 9fad72bdec7f..000000000000 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/autorest.md +++ /dev/null @@ -1,54 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml - -azure-arm: true -csharp: true -library-name: Kubernetes -namespace: Azure.ResourceManager.Kubernetes -require: https://github.com/Azure/azure-rest-api-specs/blob/7d5d1db0c45d6fe0934c97b6a6f9bb34112d42d1/specification/hybridkubernetes/resource-manager/readme.md -tag: package-2022-05-01-preview -output-folder: $(this-folder)/Generated -clear-output-folder: true -sample-gen: - output-folder: $(this-folder)/../tests/Generated - clear-output-folder: true -skip-csproj: true -modelerfour: - flatten-payloads: false -use-model-reader-writer: true -enable-bicep-serialization: true - -format-by-name-rules: - 'tenantId': 'uuid' - 'ETag': 'etag' - 'location': 'azure-location' - '*Uri': 'Uri' - '*Uris': 'Uri' - -acronym-mapping: - CPU: Cpu - CPUs: Cpus - Os: OS - Ip: IP - Ips: IPs|ips - ID: Id - IDs: Ids - VM: Vm - VMs: Vms - Vmos: VmOS - VMScaleSet: VmScaleSet - DNS: Dns - VPN: Vpn - NAT: Nat - WAN: Wan - Ipv4: IPv4|ipv4 - Ipv6: IPv6|ipv6 - Ipsec: IPsec|ipsec - SSO: Sso - URI: Uri - Etag: ETag|etag - -``` diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tests/Generated/Samples/Sample_ConnectedClusterCollection.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tests/Generated/Samples/Sample_ConnectedClusterCollection.cs deleted file mode 100644 index 99dbcf98ef73..000000000000 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tests/Generated/Samples/Sample_ConnectedClusterCollection.cs +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.Kubernetes.Models; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources; -using NUnit.Framework; - -namespace Azure.ResourceManager.Kubernetes.Samples -{ - public partial class Sample_ConnectedClusterCollection - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateClusterExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/CreateClusterExample.json - // this example is just showing the usage of "ConnectedCluster_Create" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this ConnectedClusterResource - ConnectedClusterCollection collection = resourceGroupResource.GetConnectedClusters(); - - // invoke the operation - string clusterName = "testCluster"; - ConnectedClusterData data = new ConnectedClusterData(new AzureLocation("East US"), new ManagedServiceIdentity("SystemAssigned"), "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO") - { - Tags = { }, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, data); - ConnectedClusterResource result = lro.Value; - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ConnectedClusterData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateClusterPrivateLinkExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/CreateClusterPrivateLinkExample.json - // this example is just showing the usage of "ConnectedCluster_Create" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this ConnectedClusterResource - ConnectedClusterCollection collection = resourceGroupResource.GetConnectedClusters(); - - // invoke the operation - string clusterName = "testClusterPvtLink"; - ConnectedClusterData data = new ConnectedClusterData(new AzureLocation("East US"), new ManagedServiceIdentity("SystemAssigned"), "MIICYzCCAcygAwIBAgIBADANBgkqhkiG9w0BAQUFADAuMQswCQYDVQQGEwJVUzEMMAoGA1UEChMDSUJNMREwDwYDVQQLEwhMb2NhbCBDQTAeFw05OTEyMjIwNTAwMDBaFw0wMDEyMjMwNDU5NTlaMC4xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xETAPBgNVBAsTCExvY2FsIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2bZEo7xGaX2/0GHkrNFZvlxBou9v1Jmt/PDiTMPve8r9FeJAQ0QdvFST/0JPQYD20rH0bimdDLgNdNynmyRoS2S/IInfpmf69iyc2G0TPyRvmHIiOZbdCd+YBHQi1adkj17NDcWj6S14tVurFX73zx0sNoMS79q3tuXKrDsxeuwIDAQABo4GQMIGNMEsGCVUdDwGG+EIBDQQ+EzxHZW5lcmF0ZWQgYnkgdGhlIFNlY3VyZVdheSBTZWN1cml0eSBTZXJ2ZXIgZm9yIE9TLzM5MCAoUkFDRikwDgYDVR0PAQH/BAQDAgAGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ3+ocRyCTJw067dLSwr/nalx6YMMA0GCSqGSIb3DQEBBQUAA4GBAMaQzt+zaj1GU77yzlr8iiMBXgdQrwsZZWJo5exnAucJAEYQZmOfyLiM D6oYq+ZnfvM0n8G/Y79q8nhwvuxpYOnRSAXFp6xSkrIOeZtJMY1h00LKp/JX3Ng1svZ2agE126JHsQ0bhzN5TKsYfbwfTwfjdWAGy6Vf1nYi/rO+ryMO") - { - PrivateLinkState = PrivateLinkState.Enabled, - PrivateLinkScopeResourceId = "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName", - Tags = { }, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, data); - ConnectedClusterResource result = lro.Value; - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ConnectedClusterData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_GetClusterExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/GetClusterExample.json - // this example is just showing the usage of "ConnectedCluster_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this ConnectedClusterResource - ConnectedClusterCollection collection = resourceGroupResource.GetConnectedClusters(); - - // invoke the operation - string clusterName = "testCluster"; - ConnectedClusterResource result = await collection.GetAsync(clusterName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ConnectedClusterData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetAll_GetClustersExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/GetClustersByResourceGroupExample.json - // this example is just showing the usage of "ConnectedCluster_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this ConnectedClusterResource - ConnectedClusterCollection collection = resourceGroupResource.GetConnectedClusters(); - - // invoke the operation and iterate over the result - await foreach (ConnectedClusterResource item in collection.GetAllAsync()) - { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ConnectedClusterData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Exists_GetClusterExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/GetClusterExample.json - // this example is just showing the usage of "ConnectedCluster_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this ConnectedClusterResource - ConnectedClusterCollection collection = resourceGroupResource.GetConnectedClusters(); - - // invoke the operation - string clusterName = "testCluster"; - bool result = await collection.ExistsAsync(clusterName); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_GetClusterExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/GetClusterExample.json - // this example is just showing the usage of "ConnectedCluster_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this ConnectedClusterResource - ConnectedClusterCollection collection = resourceGroupResource.GetConnectedClusters(); - - // invoke the operation - string clusterName = "testCluster"; - NullableResponse response = await collection.GetIfExistsAsync(clusterName); - ConnectedClusterResource result = response.HasValue ? response.Value : null; - - if (result == null) - { - Console.WriteLine("Succeeded with null as result"); - } - else - { - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ConnectedClusterData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } - } -} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tests/Generated/Samples/Sample_ConnectedClusterResource.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tests/Generated/Samples/Sample_ConnectedClusterResource.cs deleted file mode 100644 index fec288bb08cb..000000000000 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tests/Generated/Samples/Sample_ConnectedClusterResource.cs +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.Kubernetes.Models; -using NUnit.Framework; - -namespace Azure.ResourceManager.Kubernetes.Samples -{ - public partial class Sample_ConnectedClusterResource - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_GetClusterExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/GetClusterExample.json - // this example is just showing the usage of "ConnectedCluster_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ConnectedClusterResource created on azure - // for more information of creating ConnectedClusterResource, please refer to the document of ConnectedClusterResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - string clusterName = "testCluster"; - ResourceIdentifier connectedClusterResourceId = ConnectedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); - ConnectedClusterResource connectedCluster = client.GetConnectedClusterResource(connectedClusterResourceId); - - // invoke the operation - ConnectedClusterResource result = await connectedCluster.GetAsync(); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ConnectedClusterData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Delete_DeleteClusterExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/DeleteClusterExample.json - // this example is just showing the usage of "ConnectedCluster_Delete" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ConnectedClusterResource created on azure - // for more information of creating ConnectedClusterResource, please refer to the document of ConnectedClusterResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - string clusterName = "testCluster"; - ResourceIdentifier connectedClusterResourceId = ConnectedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); - ConnectedClusterResource connectedCluster = client.GetConnectedClusterResource(connectedClusterResourceId); - - // invoke the operation - await connectedCluster.DeleteAsync(WaitUntil.Completed); - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Update_UpdateClusterExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/UpdateClusterExample.json - // this example is just showing the usage of "ConnectedCluster_Update" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ConnectedClusterResource created on azure - // for more information of creating ConnectedClusterResource, please refer to the document of ConnectedClusterResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - string clusterName = "testCluster"; - ResourceIdentifier connectedClusterResourceId = ConnectedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); - ConnectedClusterResource connectedCluster = client.GetConnectedClusterResource(connectedClusterResourceId); - - // invoke the operation - ConnectedClusterPatch patch = new ConnectedClusterPatch - { - Tags = -{ -["tag1"] = "value1", -["tag2"] = "value2" -}, - }; - ConnectedClusterResource result = await connectedCluster.UpdateAsync(patch); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ConnectedClusterData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetClusterUserCredential_ListClusterUserCredentialCSPExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/ConnectedClustersListClusterCredentialResultHPAAD.json - // this example is just showing the usage of "ConnectedCluster_ListClusterUserCredential" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ConnectedClusterResource created on azure - // for more information of creating ConnectedClusterResource, please refer to the document of ConnectedClusterResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - string clusterName = "testCluster"; - ResourceIdentifier connectedClusterResourceId = ConnectedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); - ConnectedClusterResource connectedCluster = client.GetConnectedClusterResource(connectedClusterResourceId); - - // invoke the operation - ListClusterUserCredentialProperties properties = new ListClusterUserCredentialProperties(AuthenticationMethod.AAD, false); - CredentialResults result = await connectedCluster.GetClusterUserCredentialAsync(properties); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetClusterUserCredential_ListClusterUserCredentialExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/ConnectedClustersListClusterCredentialResultCSPAAD.json - // this example is just showing the usage of "ConnectedCluster_ListClusterUserCredential" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ConnectedClusterResource created on azure - // for more information of creating ConnectedClusterResource, please refer to the document of ConnectedClusterResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - string clusterName = "testCluster"; - ResourceIdentifier connectedClusterResourceId = ConnectedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); - ConnectedClusterResource connectedCluster = client.GetConnectedClusterResource(connectedClusterResourceId); - - // invoke the operation - ListClusterUserCredentialProperties properties = new ListClusterUserCredentialProperties(AuthenticationMethod.AAD, true); - CredentialResults result = await connectedCluster.GetClusterUserCredentialAsync(properties); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetClusterUserCredential_ListClusterUserCredentialNonAadCSPExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/ConnectedClustersListClusterCredentialResultHPToken.json - // this example is just showing the usage of "ConnectedCluster_ListClusterUserCredential" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ConnectedClusterResource created on azure - // for more information of creating ConnectedClusterResource, please refer to the document of ConnectedClusterResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - string clusterName = "testCluster"; - ResourceIdentifier connectedClusterResourceId = ConnectedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); - ConnectedClusterResource connectedCluster = client.GetConnectedClusterResource(connectedClusterResourceId); - - // invoke the operation - ListClusterUserCredentialProperties properties = new ListClusterUserCredentialProperties(AuthenticationMethod.Token, false); - CredentialResults result = await connectedCluster.GetClusterUserCredentialAsync(properties); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetClusterUserCredential_ListClusterUserCredentialNonAadExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/ConnectedClustersListClusterCredentialResultCSPToken.json - // this example is just showing the usage of "ConnectedCluster_ListClusterUserCredential" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ConnectedClusterResource created on azure - // for more information of creating ConnectedClusterResource, please refer to the document of ConnectedClusterResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - string resourceGroupName = "k8sc-rg"; - string clusterName = "testCluster"; - ResourceIdentifier connectedClusterResourceId = ConnectedClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, clusterName); - ConnectedClusterResource connectedCluster = client.GetConnectedClusterResource(connectedClusterResourceId); - - // invoke the operation - ListClusterUserCredentialProperties properties = new ListClusterUserCredentialProperties(AuthenticationMethod.Token, true); - CredentialResults result = await connectedCluster.GetClusterUserCredentialAsync(properties); - - Console.WriteLine($"Succeeded: {result}"); - } - } -} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs deleted file mode 100644 index c340cb11dc82..000000000000 --- a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.Resources; -using NUnit.Framework; - -namespace Azure.ResourceManager.Kubernetes.Samples -{ - public partial class Sample_SubscriptionResourceExtensions - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetConnectedClusters_GetClustersExample() - { - // Generated from example definition: specification/hybridkubernetes/resource-manager/Microsoft.Kubernetes/preview/2022-05-01-preview/examples/GetClustersBySubscriptionExample.json - // this example is just showing the usage of "ConnectedCluster_ListBySubscription" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "1bfbb5d0-917e-4346-9026-1d3b344417f5"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // invoke the operation and iterate over the result - await foreach (ConnectedClusterResource item in subscriptionResource.GetConnectedClustersAsync()) - { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - ConnectedClusterData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine("Succeeded"); - } - } -} diff --git a/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tsp-location.yaml b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tsp-location.yaml new file mode 100644 index 000000000000..f3b0e181e78a --- /dev/null +++ b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/hybridkubernetes/HybridKubernetes.Management +commit: 9c14bb377b747f8e2f55a9fabb6e296847ae48ca +repo: Azure/azure-rest-api-specs +emitterPackageJsonPath: eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json