From 5c2fe7e1ba8f3673c861428c6b639c2d944f2c50 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 16 Dec 2024 02:31:16 +0000 Subject: [PATCH] CodeGen from PR 31874 in Azure/azure-rest-api-specs Merge 198bea37f7a2bbc17c8d98df0b217bbb450613e3 into 58740206b853320974ef5e4864f7be8120b15a27 --- sdk/advisor/ci.mgmt.yml | 37 + sdk/agrifood/ci.mgmt.yml | 37 + sdk/alertsmanagement/ci.mgmt.yml | 37 + sdk/analysisservices/ci.mgmt.yml | 37 + sdk/apicenter/ci.mgmt.yml | 37 + sdk/apimanagement/ci.mgmt.yml | 37 + sdk/appcomplianceautomation/ci.mgmt.yml | 37 + sdk/appconfiguration/ci.mgmt.yml | 37 + sdk/applicationinsights/ci.mgmt.yml | 37 + sdk/appplatform/ci.mgmt.yml | 37 + sdk/arc-scvmm/ci.mgmt.yml | 37 + sdk/astronomer/ci.mgmt.yml | 37 + sdk/attestation/ci.mgmt.yml | 37 + sdk/authorization/ci.mgmt.yml | 37 + sdk/automanage/ci.mgmt.yml | 37 + sdk/automation/ci.mgmt.yml | 37 + sdk/avs/ci.mgmt.yml | 37 + sdk/azurelargeinstance/ci.mgmt.yml | 37 + sdk/azurestackhci/ci.mgmt.yml | 37 + sdk/batch/ci.mgmt.yml | 37 + sdk/billing/ci.mgmt.yml | 37 + sdk/billingbenefits/ci.mgmt.yml | 37 + sdk/blueprint/ci.mgmt.yml | 37 + sdk/botservice/ci.mgmt.yml | 37 + sdk/cdn/ci.mgmt.yml | 37 + sdk/changeanalysis/ci.mgmt.yml | 37 + sdk/chaos/ci.mgmt.yml | 37 + sdk/cognitiveservices/ci.mgmt.yml | 37 + sdk/communication/ci.mgmt.yml | 37 + sdk/compute/ci.mgmt.yml | 37 + sdk/computefleet/ci.mgmt.yml | 37 + sdk/computeschedule/ci.mgmt.yml | 37 + sdk/confidentialledger/ci.mgmt.yml | 37 + sdk/confluent/ci.mgmt.yml | 37 + sdk/connectedvmwarevsphere/ci.mgmt.yml | 37 + sdk/consumption/ci.mgmt.yml | 37 + sdk/containerapps/ci.mgmt.yml | 37 + sdk/containerinstance/ci.mgmt.yml | 37 + sdk/containerorchestratorruntime/ci.mgmt.yml | 37 + sdk/containerregistry/ci.mgmt.yml | 37 + sdk/containerservice/ci.mgmt.yml | 37 + sdk/cosmosdb/ci.mgmt.yml | 37 + sdk/cosmosdbforpostgresql/ci.mgmt.yml | 37 + sdk/costmanagement/ci.mgmt.yml | 37 + sdk/customer-insights/ci.mgmt.yml | 37 + sdk/databox/ci.mgmt.yml | 37 + sdk/databoxedge/ci.mgmt.yml | 37 + sdk/datadog/ci.mgmt.yml | 37 + sdk/datafactory/ci.mgmt.yml | 37 + sdk/datalake-analytics/ci.mgmt.yml | 37 + sdk/datalake-store/ci.mgmt.yml | 37 + sdk/datamigration/ci.mgmt.yml | 37 + sdk/dataprotection/ci.mgmt.yml | 37 + sdk/datashare/ci.mgmt.yml | 37 + sdk/defendereasm/ci.mgmt.yml | 37 + sdk/desktopvirtualization/ci.mgmt.yml | 37 + sdk/devcenter/ci.mgmt.yml | 37 + sdk/deviceprovisioningservices/ci.mgmt.yml | 37 + sdk/deviceregistry/ci.mgmt.yml | 37 + sdk/deviceupdate/ci.mgmt.yml | 37 + sdk/devopsinfrastructure/ci.mgmt.yml | 37 + sdk/devspaces/ci.mgmt.yml | 37 + sdk/devtestlabs/ci.mgmt.yml | 37 + sdk/digitaltwins/ci.mgmt.yml | 37 + sdk/dns/ci.mgmt.yml | 37 + sdk/dnsresolver/ci.mgmt.yml | 37 + .../Azure.ResourceManager.DurableTask.sln | 56 ++ .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../README.md | 86 ++ ...zure.ResourceManager.DurableTask.net8.0.cs | 229 +++++ ...ourceManager.DurableTask.netstandard2.0.cs | 229 +++++ .../Samples/Sample_SchedulerCollection.cs | 201 ++++ .../Samples/Sample_SchedulerResource.cs | 117 +++ .../Sample_SubscriptionResourceExtensions.cs | 50 + .../Samples/Sample_TaskHubCollection.cs | 200 ++++ .../Samples/Sample_TaskHubResource.cs | 113 +++ .../Azure.ResourceManager.DurableTask.csproj | 10 + .../Generated/ArmDurableTaskModelFactory.cs | 93 ++ .../Extensions/DurableTaskExtensions.cs | 238 +++++ .../MockableDurableTaskArmClient.cs | 61 ++ ...ockableDurableTaskResourceGroupResource.cs | 105 ++ ...MockableDurableTaskSubscriptionResource.cs | 102 ++ .../src/Generated/Internal/Argument.cs | 129 +++ .../Internal/ChangeTrackingDictionary.cs | 167 ++++ .../Generated/Internal/ChangeTrackingList.cs | 153 +++ .../Internal/ModelSerializationExtensions.cs | 398 ++++++++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 ++ .../DurableTaskArmOperation.cs | 94 ++ .../DurableTaskArmOperationOfT.cs | 100 ++ .../SchedulerOperationSource.cs | 38 + .../TaskHubOperationSource.cs | 38 + .../src/Generated/Models/ProvisioningState.cs | 66 ++ .../src/Generated/Models/RedundancyState.cs | 51 + .../SchedulerListResult.Serialization.cs | 151 +++ .../Generated/Models/SchedulerListResult.cs | 80 ++ .../SchedulerProperties.Serialization.cs | 170 ++++ .../Generated/Models/SchedulerProperties.cs | 91 ++ .../Models/SchedulerSku.Serialization.cs | 156 +++ .../src/Generated/Models/SchedulerSku.cs | 83 ++ .../Models/TaskHubListResult.Serialization.cs | 151 +++ .../src/Generated/Models/TaskHubListResult.cs | 80 ++ .../Models/TaskHubProperties.Serialization.cs | 148 +++ .../src/Generated/Models/TaskHubProperties.cs | 69 ++ .../src/Generated/ProviderConstants.cs | 16 + .../SchedulersRestOperations.cs | 723 ++++++++++++++ .../RestOperations/TaskHubsRestOperations.cs | 513 ++++++++++ .../src/Generated/SchedulerCollection.cs | 494 ++++++++++ .../Generated/SchedulerData.Serialization.cs | 178 ++++ .../src/Generated/SchedulerData.cs | 83 ++ .../SchedulerResource.Serialization.cs | 26 + .../src/Generated/SchedulerResource.cs | 775 +++++++++++++++ .../src/Generated/TaskHubCollection.cs | 493 ++++++++++ .../Generated/TaskHubData.Serialization.cs | 155 +++ .../src/Generated/TaskHubData.cs | 75 ++ .../TaskHubResource.Serialization.cs | 26 + .../src/Generated/TaskHubResource.cs | 347 +++++++ .../src/Properties/AssemblyInfo.cs | 11 + ...e.ResourceManager.DurableTask.Tests.csproj | 12 + .../tsp-location.yaml | 4 + sdk/durabletask/ci.mgmt.yml | 48 + sdk/dynatrace/ci.mgmt.yml | 37 + sdk/edgeorder/ci.mgmt.yml | 37 + sdk/edgezones/ci.mgmt.yml | 37 + sdk/elastic/ci.mgmt.yml | 37 + sdk/elasticsan/ci.mgmt.yml | 37 + sdk/eventgrid/ci.mgmt.yml | 37 + sdk/eventhub/ci.mgmt.yml | 37 + sdk/extendedlocation/ci.mgmt.yml | 37 + sdk/fabric/ci.mgmt.yml | 37 + sdk/fleet/ci.mgmt.yml | 37 + sdk/fluidrelay/ci.mgmt.yml | 37 + sdk/frontdoor/ci.mgmt.yml | 37 + sdk/grafana/ci.mgmt.yml | 37 + sdk/graphservices/ci.mgmt.yml | 37 + sdk/guestconfiguration/ci.mgmt.yml | 37 + sdk/hardwaresecuritymodules/ci.mgmt.yml | 37 + sdk/hdinsight/ci.mgmt.yml | 37 + sdk/hdinsightcontainers/ci.mgmt.yml | 37 + sdk/healthbot/ci.mgmt.yml | 37 + sdk/healthcareapis/ci.mgmt.yml | 37 + sdk/healthdataaiservices/ci.mgmt.yml | 37 + sdk/hybridaks/ci.mgmt.yml | 37 + sdk/hybridcompute/ci.mgmt.yml | 37 + sdk/hybridconnectivity/ci.mgmt.yml | 37 + sdk/hybridkubernetes/ci.mgmt.yml | 37 + sdk/hybridnetwork/ci.mgmt.yml | 37 + sdk/informaticadatamanagement/ci.mgmt.yml | 37 + sdk/iot/ci.mgmt.yml | 37 + sdk/iotcentral/ci.mgmt.yml | 37 + sdk/iothub/ci.mgmt.yml | 37 + .../Azure.ResourceManager.IoTOperations.sln | 56 ++ .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../README.md | 86 ++ .../Sample_BrokerAuthenticationResource.cs | 209 ++++ ..._BrokerAuthenticationResourceCollection.cs | 301 ++++++ .../Sample_BrokerAuthorizationResource.cs | 266 +++++ ...e_BrokerAuthorizationResourceCollection.cs | 361 +++++++ .../Samples/Sample_BrokerListenerResource.cs | 249 +++++ ...Sample_BrokerListenerResourceCollection.cs | 344 +++++++ .../Samples/Sample_BrokerResource.cs | 377 ++++++++ .../Sample_BrokerResourceCollection.cs | 473 +++++++++ .../Sample_DataflowEndpointResource.cs | 642 +++++++++++++ ...mple_DataflowEndpointResourceCollection.cs | 756 +++++++++++++++ .../Samples/Sample_DataflowProfileResource.cs | 199 ++++ ...ample_DataflowProfileResourceCollection.cs | 292 ++++++ .../Samples/Sample_DataflowResource.cs | 476 +++++++++ .../Sample_DataflowResourceCollection.cs | 580 +++++++++++ .../Samples/Sample_InstanceResource.cs | 114 +++ .../Sample_InstanceResourceCollection.cs | 205 ++++ .../Sample_SubscriptionResourceExtensions.cs | 50 + ...Azure.ResourceManager.IoTOperations.csproj | 10 + .../Generated/ArmIoTOperationsModelFactory.cs | 299 ++++++ ...kerAuthenticationResource.Serialization.cs | 26 + .../Generated/BrokerAuthenticationResource.cs | 348 +++++++ .../BrokerAuthenticationResourceCollection.cs | 493 ++++++++++ ...uthenticationResourceData.Serialization.cs | 164 ++++ .../BrokerAuthenticationResourceData.cs | 89 ++ ...okerAuthorizationResource.Serialization.cs | 26 + .../Generated/BrokerAuthorizationResource.cs | 348 +++++++ .../BrokerAuthorizationResourceCollection.cs | 493 ++++++++++ ...AuthorizationResourceData.Serialization.cs | 164 ++++ .../BrokerAuthorizationResourceData.cs | 89 ++ .../BrokerListenerResource.Serialization.cs | 26 + .../src/Generated/BrokerListenerResource.cs | 348 +++++++ .../BrokerListenerResourceCollection.cs | 493 ++++++++++ ...rokerListenerResourceData.Serialization.cs | 164 ++++ .../Generated/BrokerListenerResourceData.cs | 89 ++ .../Generated/BrokerResource.Serialization.cs | 26 + .../src/Generated/BrokerResource.cs | 554 +++++++++++ .../src/Generated/BrokerResourceCollection.cs | 493 ++++++++++ .../BrokerResourceData.Serialization.cs | 164 ++++ .../src/Generated/BrokerResourceData.cs | 89 ++ .../DataflowEndpointResource.Serialization.cs | 26 + .../src/Generated/DataflowEndpointResource.cs | 347 +++++++ .../DataflowEndpointResourceCollection.cs | 493 ++++++++++ ...aflowEndpointResourceData.Serialization.cs | 164 ++++ .../Generated/DataflowEndpointResourceData.cs | 89 ++ .../DataflowProfileResource.Serialization.cs | 26 + .../src/Generated/DataflowProfileResource.cs | 416 ++++++++ .../DataflowProfileResourceCollection.cs | 493 ++++++++++ ...taflowProfileResourceData.Serialization.cs | 164 ++++ .../Generated/DataflowProfileResourceData.cs | 89 ++ .../DataflowResource.Serialization.cs | 26 + .../src/Generated/DataflowResource.cs | 348 +++++++ .../Generated/DataflowResourceCollection.cs | 493 ++++++++++ .../DataflowResourceData.Serialization.cs | 164 ++++ .../src/Generated/DataflowResourceData.cs | 89 ++ .../Extensions/IoTOperationsExtensions.cs | 352 +++++++ .../MockableIoTOperationsArmClient.cs | 133 +++ ...kableIoTOperationsResourceGroupResource.cs | 105 ++ ...ckableIoTOperationsSubscriptionResource.cs | 102 ++ .../InstanceResource.Serialization.cs | 26 + .../src/Generated/InstanceResource.cs | 906 ++++++++++++++++++ .../Generated/InstanceResourceCollection.cs | 494 ++++++++++ .../InstanceResourceData.Serialization.cs | 205 ++++ .../src/Generated/InstanceResourceData.cs | 96 ++ .../src/Generated/Internal/Argument.cs | 129 +++ .../Internal/ChangeTrackingDictionary.cs | 167 ++++ .../Generated/Internal/ChangeTrackingList.cs | 153 +++ .../Internal/ModelSerializationExtensions.cs | 398 ++++++++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 ++ ...erAuthenticationResourceOperationSource.cs | 38 + ...kerAuthorizationResourceOperationSource.cs | 38 + .../BrokerListenerResourceOperationSource.cs | 38 + .../BrokerResourceOperationSource.cs | 38 + ...DataflowEndpointResourceOperationSource.cs | 38 + .../DataflowProfileResourceOperationSource.cs | 38 + .../DataflowResourceOperationSource.cs | 38 + .../InstanceResourceOperationSource.cs | 38 + .../IoTOperationsArmOperation.cs | 94 ++ .../IoTOperationsArmOperationOfT.cs | 100 ++ .../Models/AdvancedSettings.Serialization.cs | 163 ++++ .../src/Generated/Models/AdvancedSettings.cs | 73 ++ .../AuthorizationConfig.Serialization.cs | 158 +++ .../Generated/Models/AuthorizationConfig.cs | 70 ++ .../Models/AuthorizationRule.Serialization.cs | 169 ++++ .../src/Generated/Models/AuthorizationRule.cs | 88 ++ .../Models/BackendChain.Serialization.cs | 149 +++ .../src/Generated/Models/BackendChain.cs | 82 ++ .../BatchingConfiguration.Serialization.cs | 148 +++ .../Generated/Models/BatchingConfiguration.cs | 69 ++ .../Models/BrokerAuthenticationMethod.cs | 54 ++ ...rAuthenticationProperties.Serialization.cs | 151 +++ .../Models/BrokerAuthenticationProperties.cs | 80 ++ ...icationResourceListResult.Serialization.cs | 151 +++ .../BrokerAuthenticationResourceListResult.cs | 80 ++ ...erAuthenticatorCustomAuth.Serialization.cs | 126 +++ .../Models/BrokerAuthenticatorCustomAuth.cs | 81 ++ ...AuthenticatorMethodCustom.Serialization.cs | 178 ++++ .../Models/BrokerAuthenticatorMethodCustom.cs | 95 ++ ...kerAuthenticatorMethodSat.Serialization.cs | 136 +++ .../Models/BrokerAuthenticatorMethodSat.cs | 76 ++ ...erAuthenticatorMethodX509.Serialization.cs | 155 +++ .../Models/BrokerAuthenticatorMethodX509.cs | 70 ++ ...catorMethodX509Attributes.Serialization.cs | 145 +++ ...BrokerAuthenticatorMethodX509Attributes.cs | 82 ++ ...rokerAuthenticatorMethods.Serialization.cs | 171 ++++ .../Models/BrokerAuthenticatorMethods.cs | 91 ++ ...erAuthorizationProperties.Serialization.cs | 141 +++ .../Models/BrokerAuthorizationProperties.cs | 79 ++ ...izationResourceListResult.Serialization.cs | 151 +++ .../BrokerAuthorizationResourceListResult.cs | 80 ++ .../Models/BrokerDiagnostics.Serialization.cs | 178 ++++ .../src/Generated/Models/BrokerDiagnostics.cs | 101 ++ .../BrokerListenerProperties.Serialization.cs | 177 ++++ .../Models/BrokerListenerProperties.cs | 88 ++ ...istenerResourceListResult.Serialization.cs | 151 +++ .../BrokerListenerResourceListResult.cs | 80 ++ .../Generated/Models/BrokerMemoryProfile.cs | 57 ++ .../Models/BrokerProperties.Serialization.cs | 231 +++++ .../src/Generated/Models/BrokerProperties.cs | 101 ++ .../Generated/Models/BrokerProtocolType.cs | 51 + .../Models/BrokerResourceDefinitionMethod.cs | 54 ++ .../BrokerResourceListResult.Serialization.cs | 151 +++ .../Models/BrokerResourceListResult.cs | 80 ++ .../BrokerResourceRule.Serialization.cs | 176 ++++ .../Generated/Models/BrokerResourceRule.cs | 82 ++ .../Models/Cardinality.Serialization.cs | 134 +++ .../src/Generated/Models/Cardinality.cs | 82 ++ .../CertManagerCertOptions.Serialization.cs | 142 +++ .../Models/CertManagerCertOptions.cs | 89 ++ ...ertManagerCertificateSpec.Serialization.cs | 196 ++++ .../Models/CertManagerCertificateSpec.cs | 95 ++ .../Generated/Models/CertManagerIssuerKind.cs | 51 + .../CertManagerIssuerRef.Serialization.cs | 142 +++ .../Generated/Models/CertManagerIssuerRef.cs | 88 ++ .../CertManagerPrivateKey.Serialization.cs | 134 +++ .../Generated/Models/CertManagerPrivateKey.cs | 78 ++ .../Models/ClientConfig.Serialization.cs | 215 +++++ .../src/Generated/Models/ClientConfig.cs | 85 ++ .../Models/CloudEventAttributeType.cs | 51 + .../Models/DataExplorerAuthMethod.cs | 51 + .../Models/DataLakeStorageAuthMethod.cs | 54 ++ ...ltInTransformationDataset.Serialization.cs | 183 ++++ .../DataflowBuiltInTransformationDataset.cs | 95 ++ ...iltInTransformationFilter.Serialization.cs | 170 ++++ .../DataflowBuiltInTransformationFilter.cs | 91 ++ ...wBuiltInTransformationMap.Serialization.cs | 187 ++++ .../DataflowBuiltInTransformationMap.cs | 95 ++ ...tInTransformationSettings.Serialization.cs | 225 +++++ .../DataflowBuiltInTransformationSettings.cs | 84 ++ ...tinationOperationSettings.Serialization.cs | 134 +++ .../DataflowDestinationOperationSettings.cs | 82 ++ ...AuthenticationAccessToken.Serialization.cs | 126 +++ ...taflowEndpointAuthenticationAccessToken.cs | 75 ++ ...ndpointAuthenticationSasl.Serialization.cs | 134 +++ .../DataflowEndpointAuthenticationSasl.cs | 81 ++ .../DataflowEndpointAuthenticationSaslType.cs | 54 ++ ...cationServiceAccountToken.Serialization.cs | 126 +++ ...dpointAuthenticationServiceAccountToken.cs | 75 ++ ...emAssignedManagedIdentity.Serialization.cs | 129 +++ ...enticationSystemAssignedManagedIdentity.cs | 65 ++ ...erAssignedManagedIdentity.Serialization.cs | 145 +++ ...thenticationUserAssignedManagedIdentity.cs | 86 ++ ...ndpointAuthenticationX509.Serialization.cs | 126 +++ .../DataflowEndpointAuthenticationX509.cs | 75 ++ ...aflowEndpointDataExplorer.Serialization.cs | 157 +++ .../Models/DataflowEndpointDataExplorer.cs | 93 ++ ...ataExplorerAuthentication.Serialization.cs | 156 +++ ...aflowEndpointDataExplorerAuthentication.cs | 92 ++ ...owEndpointDataLakeStorage.Serialization.cs | 149 +++ .../Models/DataflowEndpointDataLakeStorage.cs | 86 ++ ...LakeStorageAuthentication.Serialization.cs | 171 ++++ ...owEndpointDataLakeStorageAuthentication.cs | 103 ++ ...flowEndpointFabricOneLake.Serialization.cs | 171 ++++ .../Models/DataflowEndpointFabricOneLake.cs | 99 ++ ...bricOneLakeAuthentication.Serialization.cs | 156 +++ ...flowEndpointFabricOneLakeAuthentication.cs | 92 ++ ...ndpointFabricOneLakeNames.Serialization.cs | 134 +++ .../DataflowEndpointFabricOneLakeNames.cs | 82 ++ .../Models/DataflowEndpointFabricPathType.cs | 51 + .../DataflowEndpointKafka.Serialization.cs | 261 +++++ .../Generated/Models/DataflowEndpointKafka.cs | 114 +++ .../Models/DataflowEndpointKafkaAck.cs | 54 ++ ...dpointKafkaAuthentication.Serialization.cs | 192 ++++ .../DataflowEndpointKafkaAuthentication.cs | 106 ++ ...flowEndpointKafkaBatching.Serialization.cs | 178 ++++ .../Models/DataflowEndpointKafkaBatching.cs | 77 ++ .../DataflowEndpointKafkaCompression.cs | 57 ++ .../DataflowEndpointKafkaPartitionStrategy.cs | 57 ++ ...aflowEndpointLocalStorage.Serialization.cs | 126 +++ .../Models/DataflowEndpointLocalStorage.cs | 75 ++ .../DataflowEndpointMqtt.Serialization.cs | 280 ++++++ .../Generated/Models/DataflowEndpointMqtt.cs | 115 +++ ...ndpointMqttAuthentication.Serialization.cs | 192 ++++ .../DataflowEndpointMqttAuthentication.cs | 113 +++ ...ataflowEndpointProperties.Serialization.cs | 240 +++++ .../Models/DataflowEndpointProperties.cs | 107 +++ ...ndpointResourceListResult.Serialization.cs | 151 +++ .../DataflowEndpointResourceListResult.cs | 80 ++ .../Generated/Models/DataflowMappingType.cs | 60 ++ .../Models/DataflowOperation.Serialization.cs | 188 ++++ .../src/Generated/Models/DataflowOperation.cs | 88 ++ ...DataflowProfileProperties.Serialization.cs | 163 ++++ .../Models/DataflowProfileProperties.cs | 73 ++ ...ProfileResourceListResult.Serialization.cs | 151 +++ .../DataflowProfileResourceListResult.cs | 80 ++ .../DataflowProperties.Serialization.cs | 166 ++++ .../Generated/Models/DataflowProperties.cs | 84 ++ ...ataflowResourceListResult.Serialization.cs | 151 +++ .../Models/DataflowResourceListResult.cs | 80 ++ ...owSourceOperationSettings.Serialization.cs | 187 ++++ .../Models/DataflowSourceOperationSettings.cs | 95 ++ .../Models/DiagnosticsLogs.Serialization.cs | 129 +++ .../src/Generated/Models/DiagnosticsLogs.cs | 65 ++ .../DiskBackedMessageBuffer.Serialization.cs | 156 +++ .../Models/DiskBackedMessageBuffer.cs | 83 ++ .../src/Generated/Models/EndpointType.cs | 63 ++ .../Models/ExtendedLocation.Serialization.cs | 134 +++ .../src/Generated/Models/ExtendedLocation.cs | 81 ++ .../Generated/Models/ExtendedLocationType.cs | 48 + .../Models/FabricOneLakeAuthMethod.cs | 51 + .../src/Generated/Models/FilterType.cs | 48 + .../Models/Frontend.Serialization.cs | 141 +++ .../src/Generated/Models/Frontend.cs | 76 ++ .../GenerateResourceLimits.Serialization.cs | 133 +++ .../Models/GenerateResourceLimits.cs | 65 ++ .../InstanceProperties.Serialization.cs | 163 ++++ .../Generated/Models/InstanceProperties.cs | 94 ++ ...nstanceResourceListResult.Serialization.cs | 151 +++ .../Models/InstanceResourceListResult.cs | 80 ++ .../InstanceResourcePatch.Serialization.cs | 162 ++++ .../Generated/Models/InstanceResourcePatch.cs | 71 ++ .../src/Generated/Models/KafkaAuthMethod.cs | 60 ++ .../KubernetesReference.Serialization.cs | 156 +++ .../Generated/Models/KubernetesReference.cs | 90 ++ .../Models/ListenerPort.Serialization.cs | 200 ++++ .../src/Generated/Models/ListenerPort.cs | 92 ++ .../LocalKubernetesReference.Serialization.cs | 145 +++ .../Models/LocalKubernetesReference.cs | 86 ++ .../Generated/Models/Metrics.Serialization.cs | 133 +++ .../src/Generated/Models/Metrics.cs | 65 ++ .../src/Generated/Models/MqttAuthMethod.cs | 60 ++ .../src/Generated/Models/MqttRetainType.cs | 51 + .../src/Generated/Models/OperationType.cs | 54 ++ .../src/Generated/Models/OperationalMode.cs | 51 + .../src/Generated/Models/OperatorValue.cs | 57 ++ .../PrincipalDefinition.Serialization.cs | 216 +++++ .../Generated/Models/PrincipalDefinition.cs | 76 ++ .../Generated/Models/PrivateKeyAlgorithm.cs | 66 ++ .../Models/PrivateKeyRotationPolicy.cs | 51 + .../ProfileDiagnostics.Serialization.cs | 148 +++ .../Generated/Models/ProfileDiagnostics.cs | 92 ++ .../src/Generated/Models/ProvisioningState.cs | 66 ++ .../Models/SanForCert.Serialization.cs | 154 +++ .../src/Generated/Models/SanForCert.cs | 83 ++ .../Models/SchemaRegistryRef.Serialization.cs | 126 +++ .../src/Generated/Models/SchemaRegistryRef.cs | 76 ++ .../Models/SelfCheck.Serialization.cs | 163 ++++ .../src/Generated/Models/SelfCheck.cs | 73 ++ .../Models/SelfTracing.Serialization.cs | 148 +++ .../src/Generated/Models/SelfTracing.cs | 69 ++ .../src/Generated/Models/ServiceType.cs | 54 ++ .../Models/SourceSerializationFormat.cs | 48 + .../StateStoreResourceDefinitionMethod.cs | 54 ++ .../Models/StateStoreResourceKeyType.cs | 54 ++ .../StateStoreResourceRule.Serialization.cs | 152 +++ .../Models/StateStoreResourceRule.cs | 88 ++ .../Models/SubscriberMessageDropStrategy.cs | 51 + .../SubscriberQueueLimit.Serialization.cs | 148 +++ .../Generated/Models/SubscriberQueueLimit.cs | 69 ++ .../Models/TlsCertMethod.Serialization.cs | 156 +++ .../src/Generated/Models/TlsCertMethod.cs | 86 ++ .../src/Generated/Models/TlsCertMethodMode.cs | 51 + .../Models/TlsProperties.Serialization.cs | 144 +++ .../src/Generated/Models/TlsProperties.cs | 69 ++ .../Generated/Models/Traces.Serialization.cs | 178 ++++ .../src/Generated/Models/Traces.cs | 77 ++ .../TransformationSerializationFormat.cs | 54 ++ ...ClaimResourceRequirements.Serialization.cs | 170 ++++ .../Models/VolumeClaimResourceRequirements.cs | 71 ++ .../Models/VolumeClaimSpec.Serialization.cs | 245 +++++ .../src/Generated/Models/VolumeClaimSpec.cs | 94 ++ .../VolumeClaimSpecSelector.Serialization.cs | 169 ++++ .../Models/VolumeClaimSpecSelector.cs | 71 ++ ...cSelectorMatchExpressions.Serialization.cs | 159 +++ ...VolumeClaimSpecSelectorMatchExpressions.cs | 86 ++ .../X509ManualCertificate.Serialization.cs | 126 +++ .../Generated/Models/X509ManualCertificate.cs | 75 ++ .../src/Generated/ProviderConstants.cs | 16 + .../BrokerAuthenticationRestOperations.cs | 549 +++++++++++ .../BrokerAuthorizationRestOperations.cs | 549 +++++++++++ .../BrokerListenerRestOperations.cs | 549 +++++++++++ .../RestOperations/BrokerRestOperations.cs | 513 ++++++++++ .../DataflowEndpointRestOperations.cs | 513 ++++++++++ .../DataflowProfileRestOperations.cs | 513 ++++++++++ .../RestOperations/DataflowRestOperations.cs | 549 +++++++++++ .../RestOperations/InstanceRestOperations.cs | 731 ++++++++++++++ .../src/Properties/AssemblyInfo.cs | 11 + ...ResourceManager.IoTOperations.Tests.csproj | 12 + .../tsp-location.yaml | 4 + sdk/iotoperations/ci.mgmt.yml | 36 + sdk/keyvault/ci.mgmt.yml | 37 + sdk/kubernetesconfiguration/ci.mgmt.yml | 37 + sdk/kusto/ci.mgmt.yml | 37 + sdk/labservices/ci.mgmt.yml | 37 + sdk/loadtestservice/ci.mgmt.yml | 37 + sdk/logic/ci.mgmt.yml | 37 + sdk/machinelearningcompute/ci.mgmt.yml | 37 + sdk/machinelearningservices/ci.mgmt.yml | 37 + sdk/maintenance/ci.mgmt.yml | 37 + sdk/managednetwork/ci.mgmt.yml | 37 + sdk/managednetworkfabric/ci.mgmt.yml | 37 + sdk/managedserviceidentity/ci.mgmt.yml | 37 + sdk/managedservices/ci.mgmt.yml | 37 + sdk/managementpartner/ci.mgmt.yml | 37 + sdk/maps/ci.mgmt.yml | 37 + sdk/marketplace/ci.mgmt.yml | 37 + sdk/marketplaceordering/ci.mgmt.yml | 37 + sdk/mediaservices/ci.mgmt.yml | 37 + sdk/migrationdiscoverysap/ci.mgmt.yml | 37 + sdk/mixedreality/ci.mgmt.yml | 37 + sdk/mobilenetwork/ci.mgmt.yml | 37 + sdk/mongocluster/ci.mgmt.yml | 37 + sdk/monitor/ci.mgmt.yml | 37 + sdk/mysql/ci.mgmt.yml | 37 + sdk/neonpostgres/ci.mgmt.yml | 37 + sdk/netapp/ci.mgmt.yml | 37 + sdk/network/ci.mgmt.yml | 37 + sdk/networkanalytics/ci.mgmt.yml | 37 + sdk/networkcloud/ci.mgmt.yml | 37 + sdk/networkfunction/ci.mgmt.yml | 37 + sdk/newrelicobservability/ci.mgmt.yml | 37 + sdk/nginx/ci.mgmt.yml | 37 + sdk/notificationhubs/ci.mgmt.yml | 37 + sdk/openenergyplatform/ci.mgmt.yml | 37 + sdk/operationalinsights/ci.mgmt.yml | 37 + sdk/oracle/ci.mgmt.yml | 37 + sdk/orbital/ci.mgmt.yml | 37 + sdk/paloaltonetworks.ngfw/ci.mgmt.yml | 37 + sdk/peering/ci.mgmt.yml | 37 + ...esourceManager.PlaywrightTesting.net8.0.cs | 334 +++++-- ...anager.PlaywrightTesting.netstandard2.0.cs | 334 +++++-- ...mple_PlaywrightTestingAccountCollection.cs | 151 +-- ...PlaywrightTestingAccountQuotaCollection.cs | 161 ++++ ...e_PlaywrightTestingAccountQuotaResource.cs | 50 + ...Sample_PlaywrightTestingAccountResource.cs | 55 +- ...Sample_PlaywrightTestingQuotaCollection.cs | 36 +- .../Sample_PlaywrightTestingQuotaResource.cs | 10 +- .../Sample_SubscriptionResourceExtensions.cs | 25 +- .../ArmPlaywrightTestingModelFactory.cs | 131 ++- .../MockablePlaywrightTestingArmClient.cs | 12 + ...ePlaywrightTestingResourceGroupResource.cs | 32 +- ...lePlaywrightTestingSubscriptionResource.cs | 129 ++- .../Extensions/PlaywrightTestingExtensions.cs | 176 +++- .../AccountQuotaListResult.Serialization.cs | 151 +++ .../Models/AccountQuotaListResult.cs | 80 ++ .../AccountUpdateProperties.Serialization.cs | 178 ++++ .../Models/AccountUpdateProperties.cs | 77 ++ .../src/Generated/Models/EnablementStatus.cs | 51 - .../src/Generated/Models/FreeTrialState.cs | 51 - ...countFreeTrialProperties.Serialization.cs} | 66 +- ...rightTestingAccountFreeTrialProperties.cs} | 30 +- ...wrightTestingAccountPatch.Serialization.cs | 57 +- .../Models/PlaywrightTestingAccountPatch.cs | 18 +- ...tTestingAccountProperties.Serialization.cs | 215 +++++ .../PlaywrightTestingAccountProperties.cs | 85 ++ ...ingAccountQuotaProperties.Serialization.cs | 148 +++ ...PlaywrightTestingAccountQuotaProperties.cs | 69 ++ .../PlaywrightTestingEnablementStatus.cs | 51 + ...estingFreeTrialProperties.Serialization.cs | 140 +++ .../PlaywrightTestingFreeTrialProperties.cs | 78 ++ .../Models/PlaywrightTestingFreeTrialState.cs | 57 ++ ...ngNameAvailabilityContent.Serialization.cs | 140 +++ ...laywrightTestingNameAvailabilityContent.cs | 69 ++ ...ingNameAvailabilityResult.Serialization.cs | 159 +++ ...PlaywrightTestingNameAvailabilityResult.cs | 73 ++ .../PlaywrightTestingNameUnavailableReason.cs | 51 + .../Models/PlaywrightTestingOfferingType.cs | 57 ++ .../PlaywrightTestingProvisioningState.cs | 7 +- .../Models/PlaywrightTestingQuotaName.cs | 5 +- ...ghtTestingQuotaProperties.Serialization.cs | 163 ++++ .../PlaywrightTestingQuotaProperties.cs | 73 ++ .../PlaywrightTestingAccountCollection.cs | 156 +-- ...ywrightTestingAccountData.Serialization.cs | 107 +-- .../Generated/PlaywrightTestingAccountData.cs | 28 +- ...PlaywrightTestingAccountQuotaCollection.cs | 372 +++++++ ...htTestingAccountQuotaData.Serialization.cs | 155 +++ .../PlaywrightTestingAccountQuotaData.cs | 75 ++ ...stingAccountQuotaResource.Serialization.cs | 26 + .../PlaywrightTestingAccountQuotaResource.cs | 172 ++++ .../PlaywrightTestingAccountResource.cs | 143 ++- .../PlaywrightTestingQuotaCollection.cs | 98 +- ...laywrightTestingQuotaData.Serialization.cs | 59 +- .../Generated/PlaywrightTestingQuotaData.cs | 18 +- .../PlaywrightTestingQuotaResource.cs | 26 +- .../AccountQuotasRestOperations.cs | 319 ++++++ .../RestOperations/AccountsRestOperations.cs | 498 ++++++---- .../RestOperations/QuotasRestOperations.cs | 128 +-- .../src/autorest.md | 63 -- .../tsp-location.yaml | 4 + sdk/playwrighttesting/ci.mgmt.yml | 37 + sdk/policyinsights/ci.mgmt.yml | 37 + sdk/postgresql/ci.mgmt.yml | 37 + sdk/powerbidedicated/ci.mgmt.yml | 37 + sdk/privatedns/ci.mgmt.yml | 37 + sdk/providerhub/ci.mgmt.yml | 37 + sdk/purview/ci.mgmt.yml | 37 + sdk/quantum/ci.mgmt.yml | 37 + sdk/qumulo/ci.mgmt.yml | 37 + sdk/quota/ci.mgmt.yml | 37 + sdk/recoveryservices-backup/ci.mgmt.yml | 37 + .../ci.mgmt.yml | 37 + sdk/recoveryservices-siterecovery/ci.mgmt.yml | 37 + sdk/recoveryservices/ci.mgmt.yml | 37 + sdk/redis/ci.mgmt.yml | 37 + sdk/redisenterprise/ci.mgmt.yml | 37 + sdk/relay/ci.mgmt.yml | 37 + sdk/reservations/ci.mgmt.yml | 37 + sdk/resourceconnector/ci.mgmt.yml | 37 + sdk/resourcegraph/ci.mgmt.yml | 37 + sdk/resourcehealth/ci.mgmt.yml | 37 + sdk/resourcemanager/ci.mgmt.yml | 4 + sdk/resourcemover/ci.mgmt.yml | 37 + sdk/resources/ci.mgmt.yml | 37 + sdk/search/ci.mgmt.yml | 37 + sdk/securitycenter/ci.mgmt.yml | 37 + sdk/securitydevops/ci.mgmt.yml | 37 + sdk/securityinsights/ci.mgmt.yml | 37 + sdk/selfhelp/ci.mgmt.yml | 37 + sdk/servicebus/ci.mgmt.yml | 37 + sdk/servicefabric/ci.mgmt.yml | 37 + sdk/servicefabricmanagedclusters/ci.mgmt.yml | 37 + sdk/servicelinker/ci.mgmt.yml | 37 + sdk/servicenetworking/ci.mgmt.yml | 37 + sdk/signalr/ci.mgmt.yml | 37 + sdk/sphere/ci.mgmt.yml | 37 + sdk/springappdiscovery/ci.mgmt.yml | 37 + sdk/sqlmanagement/ci.mgmt.yml | 37 + sdk/sqlvirtualmachine/ci.mgmt.yml | 37 + sdk/standbypool/ci.mgmt.yml | 37 + sdk/storage/ci.mgmt.yml | 37 + sdk/storageactions/ci.mgmt.yml | 37 + sdk/storagecache/ci.mgmt.yml | 37 + sdk/storagemover/ci.mgmt.yml | 37 + sdk/storagepool/ci.mgmt.yml | 37 + sdk/storagesync/ci.mgmt.yml | 37 + sdk/streamanalytics/ci.mgmt.yml | 37 + sdk/subscription/ci.mgmt.yml | 37 + sdk/support/ci.mgmt.yml | 37 + sdk/synapse/ci.mgmt.yml | 37 + sdk/terraform/ci.mgmt.yml | 37 + sdk/trafficmanager/ci.mgmt.yml | 37 + sdk/trustedsigning/ci.mgmt.yml | 37 + sdk/voiceservices/ci.mgmt.yml | 37 + sdk/webpubsub/ci.mgmt.yml | 37 + sdk/websites/ci.mgmt.yml | 37 + sdk/workloadmonitor/ci.mgmt.yml | 37 + sdk/workloads/ci.mgmt.yml | 37 + 613 files changed, 66762 insertions(+), 1386 deletions(-) create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/Azure.ResourceManager.DurableTask.sln create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/CHANGELOG.md create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/Directory.Build.props create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/README.md create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.net8.0.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.netstandard2.0.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerCollection.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubCollection.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Azure.ResourceManager.DurableTask.csproj create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ArmDurableTaskModelFactory.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/DurableTaskExtensions.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskArmClient.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskResourceGroupResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskSubscriptionResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Argument.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Optional.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperation.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperationOfT.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/SchedulerOperationSource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/TaskHubOperationSource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/RedundancyState.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ProviderConstants.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/SchedulersRestOperations.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/TaskHubsRestOperations.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerCollection.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubCollection.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.Serialization.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/src/Properties/AssemblyInfo.cs create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/tests/Azure.ResourceManager.DurableTask.Tests.csproj create mode 100644 sdk/durabletask/Azure.ResourceManager.DurableTask/tsp-location.yaml create mode 100644 sdk/durabletask/ci.mgmt.yml create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/Azure.ResourceManager.IoTOperations.sln create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/CHANGELOG.md create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/Directory.Build.props create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/README.md create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthenticationResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthenticationResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthorizationResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthorizationResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerListenerResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerListenerResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowEndpointResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowEndpointResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowProfileResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowProfileResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_InstanceResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_InstanceResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Azure.ResourceManager.IoTOperations.csproj create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/ArmIoTOperationsModelFactory.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResource.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceData.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceData.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResource.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceData.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceData.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResource.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceData.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceData.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResource.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceData.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceData.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResource.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceData.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceData.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResource.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceData.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceData.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResource.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceData.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceData.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/IoTOperationsExtensions.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsArmClient.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsResourceGroupResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsSubscriptionResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResource.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceCollection.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceData.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceData.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Argument.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Optional.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerAuthenticationResourceOperationSource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerAuthorizationResourceOperationSource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerListenerResourceOperationSource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerResourceOperationSource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowEndpointResourceOperationSource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowProfileResourceOperationSource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowResourceOperationSource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/InstanceResourceOperationSource.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/IoTOperationsArmOperation.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/IoTOperationsArmOperationOfT.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AdvancedSettings.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AdvancedSettings.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationConfig.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationConfig.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationRule.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationRule.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BackendChain.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BackendChain.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BatchingConfiguration.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BatchingConfiguration.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationMethod.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationProperties.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationProperties.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationResourceListResult.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationResourceListResult.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorCustomAuth.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorCustomAuth.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodCustom.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodCustom.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodSat.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodSat.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509Attributes.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509Attributes.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethods.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethods.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationProperties.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationProperties.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationResourceListResult.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationResourceListResult.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerDiagnostics.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerDiagnostics.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerProperties.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerProperties.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerResourceListResult.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerResourceListResult.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerMemoryProfile.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProperties.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProperties.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProtocolType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceDefinitionMethod.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceListResult.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceListResult.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceRule.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceRule.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Cardinality.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Cardinality.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertOptions.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertOptions.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertificateSpec.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertificateSpec.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerKind.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerRef.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerRef.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerPrivateKey.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerPrivateKey.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ClientConfig.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ClientConfig.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CloudEventAttributeType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataExplorerAuthMethod.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataLakeStorageAuthMethod.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationDataset.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationDataset.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationFilter.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationFilter.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationMap.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationMap.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationSettings.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationSettings.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowDestinationOperationSettings.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowDestinationOperationSettings.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationAccessToken.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationAccessToken.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSasl.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSasl.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSaslType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationServiceAccountToken.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationServiceAccountToken.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSystemAssignedManagedIdentity.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSystemAssignedManagedIdentity.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationUserAssignedManagedIdentity.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationUserAssignedManagedIdentity.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationX509.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationX509.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorer.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorer.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorerAuthentication.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorerAuthentication.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorage.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorage.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorageAuthentication.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorageAuthentication.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLake.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLake.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeAuthentication.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeAuthentication.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeNames.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeNames.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricPathType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafka.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafka.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAck.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAuthentication.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAuthentication.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaBatching.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaBatching.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaCompression.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaPartitionStrategy.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointLocalStorage.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointLocalStorage.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqtt.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqtt.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqttAuthentication.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqttAuthentication.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointProperties.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointProperties.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointResourceListResult.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointResourceListResult.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowMappingType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowOperation.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowOperation.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileProperties.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileProperties.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileResourceListResult.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileResourceListResult.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProperties.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProperties.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowResourceListResult.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowResourceListResult.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowSourceOperationSettings.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowSourceOperationSettings.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiagnosticsLogs.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiagnosticsLogs.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiskBackedMessageBuffer.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiskBackedMessageBuffer.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/EndpointType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocation.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocation.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocationType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/FabricOneLakeAuthMethod.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/FilterType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Frontend.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Frontend.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/GenerateResourceLimits.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/GenerateResourceLimits.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceProperties.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceProperties.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourceListResult.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourceListResult.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourcePatch.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourcePatch.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KafkaAuthMethod.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KubernetesReference.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KubernetesReference.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ListenerPort.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ListenerPort.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/LocalKubernetesReference.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/LocalKubernetesReference.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Metrics.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Metrics.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/MqttAuthMethod.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/MqttRetainType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperationType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperationalMode.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperatorValue.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrincipalDefinition.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrincipalDefinition.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrivateKeyAlgorithm.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrivateKeyRotationPolicy.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProfileDiagnostics.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProfileDiagnostics.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SanForCert.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SanForCert.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SchemaRegistryRef.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SchemaRegistryRef.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfCheck.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfCheck.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfTracing.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfTracing.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ServiceType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SourceSerializationFormat.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceDefinitionMethod.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceKeyType.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceRule.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceRule.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberMessageDropStrategy.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberQueueLimit.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberQueueLimit.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethod.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethod.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethodMode.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsProperties.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsProperties.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Traces.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Traces.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TransformationSerializationFormat.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimResourceRequirements.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimResourceRequirements.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpec.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpec.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelector.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelector.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelectorMatchExpressions.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelectorMatchExpressions.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/X509ManualCertificate.Serialization.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/X509ManualCertificate.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/ProviderConstants.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerAuthenticationRestOperations.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerAuthorizationRestOperations.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerListenerRestOperations.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerRestOperations.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowEndpointRestOperations.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowProfileRestOperations.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowRestOperations.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/InstanceRestOperations.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Properties/AssemblyInfo.cs create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/tests/Azure.ResourceManager.IoTOperations.Tests.csproj create mode 100644 sdk/iotoperations/Azure.ResourceManager.IoTOperations/tsp-location.yaml create mode 100644 sdk/iotoperations/ci.mgmt.yml create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountQuotaCollection.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountQuotaResource.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountQuotaListResult.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountQuotaListResult.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountUpdateProperties.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountUpdateProperties.cs delete mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/EnablementStatus.cs delete mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialState.cs rename sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/{FreeTrialProperties.Serialization.cs => PlaywrightTestingAccountFreeTrialProperties.Serialization.cs} (65%) rename sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/{FreeTrialProperties.cs => PlaywrightTestingAccountFreeTrialProperties.cs} (71%) create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountProperties.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountProperties.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountQuotaProperties.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountQuotaProperties.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingEnablementStatus.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialProperties.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialProperties.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialState.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityContent.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityContent.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityResult.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityResult.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameUnavailableReason.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingOfferingType.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaProperties.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaProperties.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaCollection.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaData.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaData.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaResource.Serialization.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaResource.cs create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/AccountQuotasRestOperations.cs delete mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/autorest.md create mode 100644 sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/tsp-location.yaml diff --git a/sdk/advisor/ci.mgmt.yml b/sdk/advisor/ci.mgmt.yml index 6b9f8d6952e6..3d6314442f76 100644 --- a/sdk/advisor/ci.mgmt.yml +++ b/sdk/advisor/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/advisor/ci.mgmt.yml - sdk/advisor/Azure.ResourceManager.Advisor/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/advisor/ci.mgmt.yml + - sdk/advisor/Azure.ResourceManager.Advisor/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/advisor/ci.mgmt.yml + - sdk/advisor/Azure.ResourceManager.Advisor/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/advisor/ci.mgmt.yml + - sdk/advisor/Azure.ResourceManager.Advisor/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/agrifood/ci.mgmt.yml b/sdk/agrifood/ci.mgmt.yml index ee27d71f9495..29269714b716 100644 --- a/sdk/agrifood/ci.mgmt.yml +++ b/sdk/agrifood/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/agrifood/ci.mgmt.yml - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/agrifood/ci.mgmt.yml + - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/agrifood/ci.mgmt.yml + - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/agrifood/ci.mgmt.yml + - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/alertsmanagement/ci.mgmt.yml b/sdk/alertsmanagement/ci.mgmt.yml index f33a90fffe5c..3a74128225db 100644 --- a/sdk/alertsmanagement/ci.mgmt.yml +++ b/sdk/alertsmanagement/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/alertsmanagement/ci.mgmt.yml - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/alertsmanagement/ci.mgmt.yml + - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/alertsmanagement/ci.mgmt.yml + - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/alertsmanagement/ci.mgmt.yml + - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/analysisservices/ci.mgmt.yml b/sdk/analysisservices/ci.mgmt.yml index 33729b962d88..94a549b0bc61 100644 --- a/sdk/analysisservices/ci.mgmt.yml +++ b/sdk/analysisservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/analysisservices/ci.mgmt.yml - sdk/analysisservices/Azure.ResourceManager.Analysis/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/analysisservices/ci.mgmt.yml + - sdk/analysisservices/Azure.ResourceManager.Analysis/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/analysisservices/ci.mgmt.yml + - sdk/analysisservices/Azure.ResourceManager.Analysis/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/analysisservices/ci.mgmt.yml + - sdk/analysisservices/Azure.ResourceManager.Analysis/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/apicenter/ci.mgmt.yml b/sdk/apicenter/ci.mgmt.yml index 41c037327e33..9fc0cafaaa6d 100644 --- a/sdk/apicenter/ci.mgmt.yml +++ b/sdk/apicenter/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/apicenter/ci.mgmt.yml - sdk/apicenter/Azure.ResourceManager.ApiCenter/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/apicenter/ci.mgmt.yml + - sdk/apicenter/Azure.ResourceManager.ApiCenter/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/apicenter/ci.mgmt.yml + - sdk/apicenter/Azure.ResourceManager.ApiCenter/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/apicenter/ci.mgmt.yml + - sdk/apicenter/Azure.ResourceManager.ApiCenter/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/apimanagement/ci.mgmt.yml b/sdk/apimanagement/ci.mgmt.yml index b72c80a2e0e6..24995c865882 100644 --- a/sdk/apimanagement/ci.mgmt.yml +++ b/sdk/apimanagement/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/apimanagement/ci.mgmt.yml - sdk/apimanagement/Azure.ResourceManager.ApiManagement/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/apimanagement/ci.mgmt.yml + - sdk/apimanagement/Azure.ResourceManager.ApiManagement/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/apimanagement/ci.mgmt.yml + - sdk/apimanagement/Azure.ResourceManager.ApiManagement/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/apimanagement/ci.mgmt.yml + - sdk/apimanagement/Azure.ResourceManager.ApiManagement/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/appcomplianceautomation/ci.mgmt.yml b/sdk/appcomplianceautomation/ci.mgmt.yml index d8a31e0139a8..5faf19c88359 100644 --- a/sdk/appcomplianceautomation/ci.mgmt.yml +++ b/sdk/appcomplianceautomation/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/appcomplianceautomation/ci.mgmt.yml - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appcomplianceautomation/ci.mgmt.yml + - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appcomplianceautomation/ci.mgmt.yml + - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appcomplianceautomation/ci.mgmt.yml + - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/appconfiguration/ci.mgmt.yml b/sdk/appconfiguration/ci.mgmt.yml index a883eaefcd59..990197424900 100644 --- a/sdk/appconfiguration/ci.mgmt.yml +++ b/sdk/appconfiguration/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/appconfiguration/ci.mgmt.yml - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appconfiguration/ci.mgmt.yml + - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appconfiguration/ci.mgmt.yml + - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appconfiguration/ci.mgmt.yml + - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/ + # These comments should stay. extends: diff --git a/sdk/applicationinsights/ci.mgmt.yml b/sdk/applicationinsights/ci.mgmt.yml index af82b66e6952..7b5abb41b05b 100644 --- a/sdk/applicationinsights/ci.mgmt.yml +++ b/sdk/applicationinsights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/applicationinsights/ci.mgmt.yml - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/applicationinsights/ci.mgmt.yml + - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/applicationinsights/ci.mgmt.yml + - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/applicationinsights/ci.mgmt.yml + - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/appplatform/ci.mgmt.yml b/sdk/appplatform/ci.mgmt.yml index 1d28b9352b6c..6a8b3aad0662 100644 --- a/sdk/appplatform/ci.mgmt.yml +++ b/sdk/appplatform/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/appplatform/ci.mgmt.yml - sdk/appplatform/Azure.ResourceManager.AppPlatform/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appplatform/ci.mgmt.yml + - sdk/appplatform/Azure.ResourceManager.AppPlatform/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appplatform/ci.mgmt.yml + - sdk/appplatform/Azure.ResourceManager.AppPlatform/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appplatform/ci.mgmt.yml + - sdk/appplatform/Azure.ResourceManager.AppPlatform/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/arc-scvmm/ci.mgmt.yml b/sdk/arc-scvmm/ci.mgmt.yml index bbc2db0c9f63..89bff98c0ef7 100644 --- a/sdk/arc-scvmm/ci.mgmt.yml +++ b/sdk/arc-scvmm/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/arc-scvmm/ci.mgmt.yml - sdk/arc-scvmm/Azure.ResourceManager.ScVmm/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/arc-scvmm/ci.mgmt.yml + - sdk/arc-scvmm/Azure.ResourceManager.ScVmm/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/arc-scvmm/ci.mgmt.yml + - sdk/arc-scvmm/Azure.ResourceManager.ScVmm/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/arc-scvmm/ci.mgmt.yml + - sdk/arc-scvmm/Azure.ResourceManager.ScVmm/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/astronomer/ci.mgmt.yml b/sdk/astronomer/ci.mgmt.yml index f6099036651c..5fca59b1c249 100644 --- a/sdk/astronomer/ci.mgmt.yml +++ b/sdk/astronomer/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/astronomer/ci.mgmt.yml - sdk/astronomer/Azure.ResourceManager.Astro/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/astronomer/ci.mgmt.yml + - sdk/astronomer/Azure.ResourceManager.Astro/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/astronomer/ci.mgmt.yml + - sdk/astronomer/Azure.ResourceManager.Astro/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/astronomer/ci.mgmt.yml + - sdk/astronomer/Azure.ResourceManager.Astro/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/attestation/ci.mgmt.yml b/sdk/attestation/ci.mgmt.yml index 51d1ac0c8240..c220a68252a7 100644 --- a/sdk/attestation/ci.mgmt.yml +++ b/sdk/attestation/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/attestation/ci.mgmt.yml - sdk/attestation/Azure.ResourceManager.Attestation/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/attestation/ci.mgmt.yml + - sdk/attestation/Azure.ResourceManager.Attestation/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/attestation/ci.mgmt.yml + - sdk/attestation/Azure.ResourceManager.Attestation/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/attestation/ci.mgmt.yml + - sdk/attestation/Azure.ResourceManager.Attestation/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/authorization/ci.mgmt.yml b/sdk/authorization/ci.mgmt.yml index 7ac32fcc5543..ae8ffcbbdeec 100644 --- a/sdk/authorization/ci.mgmt.yml +++ b/sdk/authorization/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/authorization/ci.mgmt.yml - sdk/authorization/Azure.ResourceManager.Authorization/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/authorization/ci.mgmt.yml + - sdk/authorization/Azure.ResourceManager.Authorization/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/authorization/ci.mgmt.yml + - sdk/authorization/Azure.ResourceManager.Authorization/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/authorization/ci.mgmt.yml + - sdk/authorization/Azure.ResourceManager.Authorization/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/automanage/ci.mgmt.yml b/sdk/automanage/ci.mgmt.yml index 5a2467820b85..642876c6d481 100644 --- a/sdk/automanage/ci.mgmt.yml +++ b/sdk/automanage/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/automanage/ci.mgmt.yml - sdk/automanage/Azure.ResourceManager.Automanage/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/automanage/ci.mgmt.yml + - sdk/automanage/Azure.ResourceManager.Automanage/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/automanage/ci.mgmt.yml + - sdk/automanage/Azure.ResourceManager.Automanage/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/automanage/ci.mgmt.yml + - sdk/automanage/Azure.ResourceManager.Automanage/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/automation/ci.mgmt.yml b/sdk/automation/ci.mgmt.yml index 45bec5d1c196..dc37582c5cb5 100644 --- a/sdk/automation/ci.mgmt.yml +++ b/sdk/automation/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/automation/ci.mgmt.yml - sdk/automation/Azure.ResourceManager.Automation/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/automation/ci.mgmt.yml + - sdk/automation/Azure.ResourceManager.Automation/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/automation/ci.mgmt.yml + - sdk/automation/Azure.ResourceManager.Automation/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/automation/ci.mgmt.yml + - sdk/automation/Azure.ResourceManager.Automation/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/avs/ci.mgmt.yml b/sdk/avs/ci.mgmt.yml index 6404a2ba34ce..0be7288e3403 100644 --- a/sdk/avs/ci.mgmt.yml +++ b/sdk/avs/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/avs/ci.mgmt.yml - sdk/avs/Azure.ResourceManager.Avs/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/avs/ci.mgmt.yml + - sdk/avs/Azure.ResourceManager.Avs/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/avs/ci.mgmt.yml + - sdk/avs/Azure.ResourceManager.Avs/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/avs/ci.mgmt.yml + - sdk/avs/Azure.ResourceManager.Avs/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/azurelargeinstance/ci.mgmt.yml b/sdk/azurelargeinstance/ci.mgmt.yml index fbe98927ef15..bd9e93c00f06 100644 --- a/sdk/azurelargeinstance/ci.mgmt.yml +++ b/sdk/azurelargeinstance/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/azurelargeinstance/ci.mgmt.yml - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azurelargeinstance/ci.mgmt.yml + - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azurelargeinstance/ci.mgmt.yml + - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azurelargeinstance/ci.mgmt.yml + - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/azurestackhci/ci.mgmt.yml b/sdk/azurestackhci/ci.mgmt.yml index 89c22080e00c..2398a6ef6cb6 100644 --- a/sdk/azurestackhci/ci.mgmt.yml +++ b/sdk/azurestackhci/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/azurestackhci/ci.mgmt.yml - sdk/azurestackhci/Azure.ResourceManager.Hci/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azurestackhci/ci.mgmt.yml + - sdk/azurestackhci/Azure.ResourceManager.Hci/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azurestackhci/ci.mgmt.yml + - sdk/azurestackhci/Azure.ResourceManager.Hci/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azurestackhci/ci.mgmt.yml + - sdk/azurestackhci/Azure.ResourceManager.Hci/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/batch/ci.mgmt.yml b/sdk/batch/ci.mgmt.yml index fdb37873525c..3ec90bf3d208 100644 --- a/sdk/batch/ci.mgmt.yml +++ b/sdk/batch/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/batch/ci.mgmt.yml - sdk/batch/Azure.ResourceManager.Batch/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/batch/ci.mgmt.yml + - sdk/batch/Azure.ResourceManager.Batch/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/batch/ci.mgmt.yml + - sdk/batch/Azure.ResourceManager.Batch/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/batch/ci.mgmt.yml + - sdk/batch/Azure.ResourceManager.Batch/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/billing/ci.mgmt.yml b/sdk/billing/ci.mgmt.yml index 67cf904850c6..3571b0d90912 100644 --- a/sdk/billing/ci.mgmt.yml +++ b/sdk/billing/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/billing/ci.mgmt.yml - sdk/billing/Azure.ResourceManager.Billing/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/billing/ci.mgmt.yml + - sdk/billing/Azure.ResourceManager.Billing/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/billing/ci.mgmt.yml + - sdk/billing/Azure.ResourceManager.Billing/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/billing/ci.mgmt.yml + - sdk/billing/Azure.ResourceManager.Billing/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/billingbenefits/ci.mgmt.yml b/sdk/billingbenefits/ci.mgmt.yml index 9900a842be4f..3839cf164098 100644 --- a/sdk/billingbenefits/ci.mgmt.yml +++ b/sdk/billingbenefits/ci.mgmt.yml @@ -2,6 +2,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -14,6 +15,42 @@ pr: - sdk/billingbenefits/ci.mgmt.yml - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/billingbenefits/ci.mgmt.yml + - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/billingbenefits/ci.mgmt.yml + - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/billingbenefits/ci.mgmt.yml + - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/blueprint/ci.mgmt.yml b/sdk/blueprint/ci.mgmt.yml index 65bd23b77f51..7713f4a2470f 100644 --- a/sdk/blueprint/ci.mgmt.yml +++ b/sdk/blueprint/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/blueprint/ci.mgmt.yml - sdk/blueprint/Azure.ResourceManager.Blueprint/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/blueprint/ci.mgmt.yml + - sdk/blueprint/Azure.ResourceManager.Blueprint/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/blueprint/ci.mgmt.yml + - sdk/blueprint/Azure.ResourceManager.Blueprint/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/blueprint/ci.mgmt.yml + - sdk/blueprint/Azure.ResourceManager.Blueprint/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/botservice/ci.mgmt.yml b/sdk/botservice/ci.mgmt.yml index 8e5444ff3f9a..72c4b392edcd 100644 --- a/sdk/botservice/ci.mgmt.yml +++ b/sdk/botservice/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/botservice/ci.mgmt.yml - sdk/botservice/Azure.ResourceManager.BotService/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/botservice/ci.mgmt.yml + - sdk/botservice/Azure.ResourceManager.BotService/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/botservice/ci.mgmt.yml + - sdk/botservice/Azure.ResourceManager.BotService/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/botservice/ci.mgmt.yml + - sdk/botservice/Azure.ResourceManager.BotService/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/cdn/ci.mgmt.yml b/sdk/cdn/ci.mgmt.yml index ac2ea82249d1..f163590ca849 100644 --- a/sdk/cdn/ci.mgmt.yml +++ b/sdk/cdn/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/cdn/ci.mgmt.yml - sdk/cdn/Azure.ResourceManager.Cdn/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cdn/ci.mgmt.yml + - sdk/cdn/Azure.ResourceManager.Cdn/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cdn/ci.mgmt.yml + - sdk/cdn/Azure.ResourceManager.Cdn/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cdn/ci.mgmt.yml + - sdk/cdn/Azure.ResourceManager.Cdn/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/changeanalysis/ci.mgmt.yml b/sdk/changeanalysis/ci.mgmt.yml index 65c6e90d195a..3ca0f7df8efe 100644 --- a/sdk/changeanalysis/ci.mgmt.yml +++ b/sdk/changeanalysis/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/changeanalysis/ci.mgmt.yml - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/changeanalysis/ci.mgmt.yml + - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/changeanalysis/ci.mgmt.yml + - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/changeanalysis/ci.mgmt.yml + - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/chaos/ci.mgmt.yml b/sdk/chaos/ci.mgmt.yml index 585591bcb6bd..bac035594d2d 100644 --- a/sdk/chaos/ci.mgmt.yml +++ b/sdk/chaos/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/chaos/ci.mgmt.yml - sdk/chaos/Azure.ResourceManager.Chaos/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/chaos/ci.mgmt.yml + - sdk/chaos/Azure.ResourceManager.Chaos/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/chaos/ci.mgmt.yml + - sdk/chaos/Azure.ResourceManager.Chaos/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/chaos/ci.mgmt.yml + - sdk/chaos/Azure.ResourceManager.Chaos/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/cognitiveservices/ci.mgmt.yml b/sdk/cognitiveservices/ci.mgmt.yml index ddeb32b868ce..f81bd063afdf 100644 --- a/sdk/cognitiveservices/ci.mgmt.yml +++ b/sdk/cognitiveservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/cognitiveservices/ci.mgmt.yml - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cognitiveservices/ci.mgmt.yml + - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cognitiveservices/ci.mgmt.yml + - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cognitiveservices/ci.mgmt.yml + - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/communication/ci.mgmt.yml b/sdk/communication/ci.mgmt.yml index 8fc73e107745..011bb396547f 100644 --- a/sdk/communication/ci.mgmt.yml +++ b/sdk/communication/ci.mgmt.yml @@ -1,5 +1,6 @@ trigger: none + pr: branches: include: @@ -12,6 +13,42 @@ pr: - sdk/communication/ci.mgmt.yml - sdk/communication/Azure.ResourceManager.Communication/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/communication/ci.mgmt.yml + - sdk/communication/Azure.ResourceManager.Communication/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/communication/ci.mgmt.yml + - sdk/communication/Azure.ResourceManager.Communication/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/communication/ci.mgmt.yml + - sdk/communication/Azure.ResourceManager.Communication/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/compute/ci.mgmt.yml b/sdk/compute/ci.mgmt.yml index d9520f58d12c..7b4144d5b597 100644 --- a/sdk/compute/ci.mgmt.yml +++ b/sdk/compute/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/compute/ci.mgmt.yml - sdk/compute/Azure.ResourceManager.Compute/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/compute/ci.mgmt.yml + - sdk/compute/Azure.ResourceManager.Compute/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/compute/ci.mgmt.yml + - sdk/compute/Azure.ResourceManager.Compute/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/compute/ci.mgmt.yml + - sdk/compute/Azure.ResourceManager.Compute/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/computefleet/ci.mgmt.yml b/sdk/computefleet/ci.mgmt.yml index de169e18c599..69cd26100b85 100644 --- a/sdk/computefleet/ci.mgmt.yml +++ b/sdk/computefleet/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/computefleet/ci.mgmt.yml - sdk/computefleet/Azure.ResourceManager.ComputeFleet/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computefleet/ci.mgmt.yml + - sdk/computefleet/Azure.ResourceManager.ComputeFleet/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computefleet/ci.mgmt.yml + - sdk/computefleet/Azure.ResourceManager.ComputeFleet/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computefleet/ci.mgmt.yml + - sdk/computefleet/Azure.ResourceManager.ComputeFleet/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/computeschedule/ci.mgmt.yml b/sdk/computeschedule/ci.mgmt.yml index d3a367f82551..5debbe42df6b 100644 --- a/sdk/computeschedule/ci.mgmt.yml +++ b/sdk/computeschedule/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/computeschedule/ci.mgmt.yml - sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computeschedule/ci.mgmt.yml + - sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computeschedule/ci.mgmt.yml + - sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computeschedule/ci.mgmt.yml + - sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/confidentialledger/ci.mgmt.yml b/sdk/confidentialledger/ci.mgmt.yml index 7343d843f2ee..927ed8c65462 100644 --- a/sdk/confidentialledger/ci.mgmt.yml +++ b/sdk/confidentialledger/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,42 @@ pr: - sdk/confidentialledger/ci.mgmt.yml - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/confidentialledger/ci.mgmt.yml + - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/confidentialledger/ci.mgmt.yml + - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/confidentialledger/ci.mgmt.yml + - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/confluent/ci.mgmt.yml b/sdk/confluent/ci.mgmt.yml index 12d37aa41bd2..0af965a2ec87 100644 --- a/sdk/confluent/ci.mgmt.yml +++ b/sdk/confluent/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/confluent/ci.mgmt.yml - sdk/confluent/Azure.ResourceManager.Confluent/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/confluent/ci.mgmt.yml + - sdk/confluent/Azure.ResourceManager.Confluent/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/confluent/ci.mgmt.yml + - sdk/confluent/Azure.ResourceManager.Confluent/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/confluent/ci.mgmt.yml + - sdk/confluent/Azure.ResourceManager.Confluent/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/connectedvmwarevsphere/ci.mgmt.yml b/sdk/connectedvmwarevsphere/ci.mgmt.yml index a9d0db85cf82..a42b21d2292f 100644 --- a/sdk/connectedvmwarevsphere/ci.mgmt.yml +++ b/sdk/connectedvmwarevsphere/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/connectedvmwarevsphere/ci.mgmt.yml - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/connectedvmwarevsphere/ci.mgmt.yml + - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/connectedvmwarevsphere/ci.mgmt.yml + - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/connectedvmwarevsphere/ci.mgmt.yml + - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/consumption/ci.mgmt.yml b/sdk/consumption/ci.mgmt.yml index 6b0ebe2b2fa7..b65ec5cf79f4 100644 --- a/sdk/consumption/ci.mgmt.yml +++ b/sdk/consumption/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/consumption/ci.mgmt.yml - sdk/consumption/Azure.ResourceManager.Consumption/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/consumption/ci.mgmt.yml + - sdk/consumption/Azure.ResourceManager.Consumption/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/consumption/ci.mgmt.yml + - sdk/consumption/Azure.ResourceManager.Consumption/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/consumption/ci.mgmt.yml + - sdk/consumption/Azure.ResourceManager.Consumption/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerapps/ci.mgmt.yml b/sdk/containerapps/ci.mgmt.yml index 7715d499fa59..753d40c6444a 100644 --- a/sdk/containerapps/ci.mgmt.yml +++ b/sdk/containerapps/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/containerapps/ci.mgmt.yml - sdk/containerapps/Azure.ResourceManager.AppContainers/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerapps/ci.mgmt.yml + - sdk/containerapps/Azure.ResourceManager.AppContainers/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerapps/ci.mgmt.yml + - sdk/containerapps/Azure.ResourceManager.AppContainers/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerapps/ci.mgmt.yml + - sdk/containerapps/Azure.ResourceManager.AppContainers/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerinstance/ci.mgmt.yml b/sdk/containerinstance/ci.mgmt.yml index 0b4d90bf6d1c..8707f846b1c2 100644 --- a/sdk/containerinstance/ci.mgmt.yml +++ b/sdk/containerinstance/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/containerinstance/ci.mgmt.yml - sdk/containerinstance/Azure.ResourceManager.ContainerInstance/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerinstance/ci.mgmt.yml + - sdk/containerinstance/Azure.ResourceManager.ContainerInstance/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerinstance/ci.mgmt.yml + - sdk/containerinstance/Azure.ResourceManager.ContainerInstance/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerinstance/ci.mgmt.yml + - sdk/containerinstance/Azure.ResourceManager.ContainerInstance/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerorchestratorruntime/ci.mgmt.yml b/sdk/containerorchestratorruntime/ci.mgmt.yml index 0a036386143b..7ff4e8f7846a 100644 --- a/sdk/containerorchestratorruntime/ci.mgmt.yml +++ b/sdk/containerorchestratorruntime/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/containerorchestratorruntime/ci.mgmt.yml - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerorchestratorruntime/ci.mgmt.yml + - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerorchestratorruntime/ci.mgmt.yml + - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerorchestratorruntime/ci.mgmt.yml + - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerregistry/ci.mgmt.yml b/sdk/containerregistry/ci.mgmt.yml index e3f0cfb5bfa5..aa3425ae880f 100644 --- a/sdk/containerregistry/ci.mgmt.yml +++ b/sdk/containerregistry/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/containerregistry/ci.mgmt.yml - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerregistry/ci.mgmt.yml + - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerregistry/ci.mgmt.yml + - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerregistry/ci.mgmt.yml + - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerservice/ci.mgmt.yml b/sdk/containerservice/ci.mgmt.yml index 9eb58047b02e..ff08b281a577 100644 --- a/sdk/containerservice/ci.mgmt.yml +++ b/sdk/containerservice/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/containerservice/ci.mgmt.yml - sdk/containerservice/Azure.ResourceManager.ContainerService/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerservice/ci.mgmt.yml + - sdk/containerservice/Azure.ResourceManager.ContainerService/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerservice/ci.mgmt.yml + - sdk/containerservice/Azure.ResourceManager.ContainerService/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerservice/ci.mgmt.yml + - sdk/containerservice/Azure.ResourceManager.ContainerService/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/cosmosdb/ci.mgmt.yml b/sdk/cosmosdb/ci.mgmt.yml index 1eab24b3bbf9..3bd9af169252 100644 --- a/sdk/cosmosdb/ci.mgmt.yml +++ b/sdk/cosmosdb/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,42 @@ pr: - sdk/cosmosdb/ci.mgmt.yml - sdk/cosmosdb/Azure.ResourceManager.CosmosDB/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cosmosdb/ci.mgmt.yml + - sdk/cosmosdb/Azure.ResourceManager.CosmosDB/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cosmosdb/ci.mgmt.yml + - sdk/cosmosdb/Azure.ResourceManager.CosmosDB/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cosmosdb/ci.mgmt.yml + - sdk/cosmosdb/Azure.ResourceManager.CosmosDB/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/cosmosdbforpostgresql/ci.mgmt.yml b/sdk/cosmosdbforpostgresql/ci.mgmt.yml index ef6098c3999f..d30e343ff08b 100644 --- a/sdk/cosmosdbforpostgresql/ci.mgmt.yml +++ b/sdk/cosmosdbforpostgresql/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/cosmosdbforpostgresql/ci.mgmt.yml - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cosmosdbforpostgresql/ci.mgmt.yml + - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cosmosdbforpostgresql/ci.mgmt.yml + - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cosmosdbforpostgresql/ci.mgmt.yml + - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/costmanagement/ci.mgmt.yml b/sdk/costmanagement/ci.mgmt.yml index e59280ba6be2..4eb77d442f8f 100644 --- a/sdk/costmanagement/ci.mgmt.yml +++ b/sdk/costmanagement/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,42 @@ pr: - sdk/costmanagement/ci.mgmt.yml - sdk/costmanagement/Azure.ResourceManager.CostManagement/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/costmanagement/ci.mgmt.yml + - sdk/costmanagement/Azure.ResourceManager.CostManagement/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/costmanagement/ci.mgmt.yml + - sdk/costmanagement/Azure.ResourceManager.CostManagement/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/costmanagement/ci.mgmt.yml + - sdk/costmanagement/Azure.ResourceManager.CostManagement/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/customer-insights/ci.mgmt.yml b/sdk/customer-insights/ci.mgmt.yml index 124af418dcfa..5e499bf871ce 100644 --- a/sdk/customer-insights/ci.mgmt.yml +++ b/sdk/customer-insights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/customer-insights/ci.mgmt.yml - sdk/customer-insights/Azure.ResourceManager.CustomerInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/customer-insights/ci.mgmt.yml + - sdk/customer-insights/Azure.ResourceManager.CustomerInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/customer-insights/ci.mgmt.yml + - sdk/customer-insights/Azure.ResourceManager.CustomerInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/customer-insights/ci.mgmt.yml + - sdk/customer-insights/Azure.ResourceManager.CustomerInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/databox/ci.mgmt.yml b/sdk/databox/ci.mgmt.yml index edd63a701700..6e99f6ff3a7e 100644 --- a/sdk/databox/ci.mgmt.yml +++ b/sdk/databox/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/databox/ci.mgmt.yml - sdk/databox/Azure.ResourceManager.DataBox/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/databox/ci.mgmt.yml + - sdk/databox/Azure.ResourceManager.DataBox/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/databox/ci.mgmt.yml + - sdk/databox/Azure.ResourceManager.DataBox/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/databox/ci.mgmt.yml + - sdk/databox/Azure.ResourceManager.DataBox/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/databoxedge/ci.mgmt.yml b/sdk/databoxedge/ci.mgmt.yml index 29e3b1537c78..b0851d6b4770 100644 --- a/sdk/databoxedge/ci.mgmt.yml +++ b/sdk/databoxedge/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/databoxedge/ci.mgmt.yml - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/databoxedge/ci.mgmt.yml + - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/databoxedge/ci.mgmt.yml + - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/databoxedge/ci.mgmt.yml + - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datadog/ci.mgmt.yml b/sdk/datadog/ci.mgmt.yml index 9e9d6825d8b0..c1c535ca210e 100644 --- a/sdk/datadog/ci.mgmt.yml +++ b/sdk/datadog/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/datadog/ci.mgmt.yml - sdk/datadog/Azure.ResourceManager.Datadog/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datadog/ci.mgmt.yml + - sdk/datadog/Azure.ResourceManager.Datadog/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datadog/ci.mgmt.yml + - sdk/datadog/Azure.ResourceManager.Datadog/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datadog/ci.mgmt.yml + - sdk/datadog/Azure.ResourceManager.Datadog/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datafactory/ci.mgmt.yml b/sdk/datafactory/ci.mgmt.yml index 85d246a5d4e7..80ba331a1962 100644 --- a/sdk/datafactory/ci.mgmt.yml +++ b/sdk/datafactory/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/datafactory/ci.mgmt.yml - sdk/datafactory/Azure.ResourceManager.DataFactory/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datafactory/ci.mgmt.yml + - sdk/datafactory/Azure.ResourceManager.DataFactory/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datafactory/ci.mgmt.yml + - sdk/datafactory/Azure.ResourceManager.DataFactory/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datafactory/ci.mgmt.yml + - sdk/datafactory/Azure.ResourceManager.DataFactory/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datalake-analytics/ci.mgmt.yml b/sdk/datalake-analytics/ci.mgmt.yml index b8794cd18f9e..45c7d4652b6f 100644 --- a/sdk/datalake-analytics/ci.mgmt.yml +++ b/sdk/datalake-analytics/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/datalake-analytics/ci.mgmt.yml - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datalake-analytics/ci.mgmt.yml + - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datalake-analytics/ci.mgmt.yml + - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datalake-analytics/ci.mgmt.yml + - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datalake-store/ci.mgmt.yml b/sdk/datalake-store/ci.mgmt.yml index 469839fd3024..719165a251ed 100644 --- a/sdk/datalake-store/ci.mgmt.yml +++ b/sdk/datalake-store/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/datalake-store/ci.mgmt.yml - sdk/datalake-store/Azure.ResourceManager.DataLakeStore/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datalake-store/ci.mgmt.yml + - sdk/datalake-store/Azure.ResourceManager.DataLakeStore/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datalake-store/ci.mgmt.yml + - sdk/datalake-store/Azure.ResourceManager.DataLakeStore/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datalake-store/ci.mgmt.yml + - sdk/datalake-store/Azure.ResourceManager.DataLakeStore/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datamigration/ci.mgmt.yml b/sdk/datamigration/ci.mgmt.yml index 1e64024fed17..268161fbac07 100644 --- a/sdk/datamigration/ci.mgmt.yml +++ b/sdk/datamigration/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/datamigration/ci.mgmt.yml - sdk/datamigration/Azure.ResourceManager.DataMigration/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datamigration/ci.mgmt.yml + - sdk/datamigration/Azure.ResourceManager.DataMigration/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datamigration/ci.mgmt.yml + - sdk/datamigration/Azure.ResourceManager.DataMigration/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datamigration/ci.mgmt.yml + - sdk/datamigration/Azure.ResourceManager.DataMigration/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/dataprotection/ci.mgmt.yml b/sdk/dataprotection/ci.mgmt.yml index 25637090aedb..24c728b4a94c 100644 --- a/sdk/dataprotection/ci.mgmt.yml +++ b/sdk/dataprotection/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/dataprotection/ci.mgmt.yml - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dataprotection/ci.mgmt.yml + - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dataprotection/ci.mgmt.yml + - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dataprotection/ci.mgmt.yml + - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datashare/ci.mgmt.yml b/sdk/datashare/ci.mgmt.yml index f6dd41e0f37f..15ed07f37126 100644 --- a/sdk/datashare/ci.mgmt.yml +++ b/sdk/datashare/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/datashare/ci.mgmt.yml - sdk/datashare/Azure.ResourceManager.DataShare/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datashare/ci.mgmt.yml + - sdk/datashare/Azure.ResourceManager.DataShare/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datashare/ci.mgmt.yml + - sdk/datashare/Azure.ResourceManager.DataShare/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datashare/ci.mgmt.yml + - sdk/datashare/Azure.ResourceManager.DataShare/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/defendereasm/ci.mgmt.yml b/sdk/defendereasm/ci.mgmt.yml index dd90e5a46690..f5df292d4495 100644 --- a/sdk/defendereasm/ci.mgmt.yml +++ b/sdk/defendereasm/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/defendereasm/ci.mgmt.yml - sdk/defendereasm/Azure.ResourceManager.DefenderEasm/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/defendereasm/ci.mgmt.yml + - sdk/defendereasm/Azure.ResourceManager.DefenderEasm/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/defendereasm/ci.mgmt.yml + - sdk/defendereasm/Azure.ResourceManager.DefenderEasm/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/defendereasm/ci.mgmt.yml + - sdk/defendereasm/Azure.ResourceManager.DefenderEasm/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/desktopvirtualization/ci.mgmt.yml b/sdk/desktopvirtualization/ci.mgmt.yml index 3d6f40025c77..d2a9768f24f2 100644 --- a/sdk/desktopvirtualization/ci.mgmt.yml +++ b/sdk/desktopvirtualization/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/desktopvirtualization/ci.mgmt.yml - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/desktopvirtualization/ci.mgmt.yml + - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/desktopvirtualization/ci.mgmt.yml + - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/desktopvirtualization/ci.mgmt.yml + - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/devcenter/ci.mgmt.yml b/sdk/devcenter/ci.mgmt.yml index 136d77bbba6d..114cd898f8c2 100644 --- a/sdk/devcenter/ci.mgmt.yml +++ b/sdk/devcenter/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/devcenter/ci.mgmt.yml - sdk/devcenter/Azure.ResourceManager.DevCenter/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devcenter/ci.mgmt.yml + - sdk/devcenter/Azure.ResourceManager.DevCenter/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devcenter/ci.mgmt.yml + - sdk/devcenter/Azure.ResourceManager.DevCenter/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devcenter/ci.mgmt.yml + - sdk/devcenter/Azure.ResourceManager.DevCenter/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/deviceprovisioningservices/ci.mgmt.yml b/sdk/deviceprovisioningservices/ci.mgmt.yml index f9c94973a324..f9bb8a8c8622 100644 --- a/sdk/deviceprovisioningservices/ci.mgmt.yml +++ b/sdk/deviceprovisioningservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/deviceprovisioningservices/ci.mgmt.yml - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceprovisioningservices/ci.mgmt.yml + - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceprovisioningservices/ci.mgmt.yml + - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceprovisioningservices/ci.mgmt.yml + - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/deviceregistry/ci.mgmt.yml b/sdk/deviceregistry/ci.mgmt.yml index 05fffe301114..070bb7ce8f7c 100644 --- a/sdk/deviceregistry/ci.mgmt.yml +++ b/sdk/deviceregistry/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/deviceregistry/ci.mgmt.yml - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceregistry/ci.mgmt.yml + - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceregistry/ci.mgmt.yml + - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceregistry/ci.mgmt.yml + - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/deviceupdate/ci.mgmt.yml b/sdk/deviceupdate/ci.mgmt.yml index c1315e462bb9..3592fc37ca1b 100644 --- a/sdk/deviceupdate/ci.mgmt.yml +++ b/sdk/deviceupdate/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/deviceupdate/ci.mgmt.yml - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceupdate/ci.mgmt.yml + - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceupdate/ci.mgmt.yml + - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceupdate/ci.mgmt.yml + - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/devopsinfrastructure/ci.mgmt.yml b/sdk/devopsinfrastructure/ci.mgmt.yml index 0f2db1225cf0..f12e84b15eba 100644 --- a/sdk/devopsinfrastructure/ci.mgmt.yml +++ b/sdk/devopsinfrastructure/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/devopsinfrastructure/ci.mgmt.yml - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devopsinfrastructure/ci.mgmt.yml + - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devopsinfrastructure/ci.mgmt.yml + - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devopsinfrastructure/ci.mgmt.yml + - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/devspaces/ci.mgmt.yml b/sdk/devspaces/ci.mgmt.yml index b63234a64555..3d4e8c7db6ff 100644 --- a/sdk/devspaces/ci.mgmt.yml +++ b/sdk/devspaces/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/devspaces/ci.mgmt.yml - sdk/devspaces/Azure.ResourceManager.DevSpaces/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devspaces/ci.mgmt.yml + - sdk/devspaces/Azure.ResourceManager.DevSpaces/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devspaces/ci.mgmt.yml + - sdk/devspaces/Azure.ResourceManager.DevSpaces/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devspaces/ci.mgmt.yml + - sdk/devspaces/Azure.ResourceManager.DevSpaces/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/devtestlabs/ci.mgmt.yml b/sdk/devtestlabs/ci.mgmt.yml index 1946409a6b75..f431893b30ca 100644 --- a/sdk/devtestlabs/ci.mgmt.yml +++ b/sdk/devtestlabs/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/devtestlabs/ci.mgmt.yml - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devtestlabs/ci.mgmt.yml + - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devtestlabs/ci.mgmt.yml + - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devtestlabs/ci.mgmt.yml + - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/digitaltwins/ci.mgmt.yml b/sdk/digitaltwins/ci.mgmt.yml index a0e8233a36cf..6938675d738d 100644 --- a/sdk/digitaltwins/ci.mgmt.yml +++ b/sdk/digitaltwins/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/digitaltwins/ci.mgmt.yml - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/digitaltwins/ci.mgmt.yml + - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/digitaltwins/ci.mgmt.yml + - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/digitaltwins/ci.mgmt.yml + - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/dns/ci.mgmt.yml b/sdk/dns/ci.mgmt.yml index 8357809b4e6f..e1455f6e3059 100644 --- a/sdk/dns/ci.mgmt.yml +++ b/sdk/dns/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,42 @@ pr: - sdk/dns/ci.mgmt.yml - sdk/dns/Azure.ResourceManager.Dns/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dns/ci.mgmt.yml + - sdk/dns/Azure.ResourceManager.Dns/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dns/ci.mgmt.yml + - sdk/dns/Azure.ResourceManager.Dns/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dns/ci.mgmt.yml + - sdk/dns/Azure.ResourceManager.Dns/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/dnsresolver/ci.mgmt.yml b/sdk/dnsresolver/ci.mgmt.yml index afa270cdc600..d48ceafc8823 100644 --- a/sdk/dnsresolver/ci.mgmt.yml +++ b/sdk/dnsresolver/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/dnsresolver/ci.mgmt.yml - sdk/dnsresolver/Azure.ResourceManager.DnsResolver/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dnsresolver/ci.mgmt.yml + - sdk/dnsresolver/Azure.ResourceManager.DnsResolver/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dnsresolver/ci.mgmt.yml + - sdk/dnsresolver/Azure.ResourceManager.DnsResolver/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dnsresolver/ci.mgmt.yml + - sdk/dnsresolver/Azure.ResourceManager.DnsResolver/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/Azure.ResourceManager.DurableTask.sln b/sdk/durabletask/Azure.ResourceManager.DurableTask/Azure.ResourceManager.DurableTask.sln new file mode 100644 index 000000000000..9e1b214ef928 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/Azure.ResourceManager.DurableTask.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.DurableTask", "src\Azure.ResourceManager.DurableTask.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.DurableTask.Tests", "tests\Azure.ResourceManager.DurableTask.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/CHANGELOG.md b/sdk/durabletask/Azure.ResourceManager.DurableTask/CHANGELOG.md new file mode 100644 index 000000000000..13dd08af78ab --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/Directory.Build.props b/sdk/durabletask/Azure.ResourceManager.DurableTask/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/README.md b/sdk/durabletask/Azure.ResourceManager.DurableTask/README.md new file mode 100644 index 000000000000..a7123ce6b031 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/README.md @@ -0,0 +1,86 @@ +# Azure.ResourceManager.DurableTask client library for .NET + +Azure.ResourceManager.DurableTask is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/durabletask/Azure.ResourceManager.DurableTask/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.ResourceManager.DurableTask --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/durabletask/Azure.ResourceManager.DurableTask/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/durabletask/Azure.ResourceManager.DurableTask/README.png) diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.net8.0.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.net8.0.cs new file mode 100644 index 000000000000..397a2afb47cc --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.net8.0.cs @@ -0,0 +1,229 @@ +namespace Azure.ResourceManager.DurableTask +{ + public static partial class DurableTaskExtensions + { + public static Azure.Response GetScheduler(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSchedulerAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DurableTask.SchedulerResource GetSchedulerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DurableTask.SchedulerCollection GetSchedulers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSchedulers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSchedulersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DurableTask.TaskHubResource GetTaskHubResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class SchedulerCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SchedulerCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schedulerName, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schedulerName, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class SchedulerData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DurableTask.Models.SchedulerProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.SchedulerData 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.DurableTask.SchedulerData 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 SchedulerResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SchedulerResource() { } + public virtual Azure.ResourceManager.DurableTask.SchedulerData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTaskHub(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTaskHubAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DurableTask.TaskHubCollection GetTaskHubs() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DurableTask.SchedulerData 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.DurableTask.SchedulerData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class TaskHubCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected TaskHubCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string taskHubName, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string taskHubName, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class TaskHubData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TaskHubData() { } + public Azure.ResourceManager.DurableTask.Models.TaskHubProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.TaskHubData 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.DurableTask.TaskHubData 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 TaskHubResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected TaskHubResource() { } + public virtual Azure.ResourceManager.DurableTask.TaskHubData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DurableTask.TaskHubData 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.DurableTask.TaskHubData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DurableTask.Mocking +{ + public partial class MockableDurableTaskArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskArmClient() { } + public virtual Azure.ResourceManager.DurableTask.SchedulerResource GetSchedulerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DurableTask.TaskHubResource GetTaskHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDurableTaskResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskResourceGroupResource() { } + public virtual Azure.Response GetScheduler(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSchedulerAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DurableTask.SchedulerCollection GetSchedulers() { throw null; } + } + public partial class MockableDurableTaskSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskSubscriptionResource() { } + public virtual Azure.Pageable GetSchedulers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSchedulersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DurableTask.Models +{ + public static partial class ArmDurableTaskModelFactory + { + public static Azure.ResourceManager.DurableTask.SchedulerData SchedulerData(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.DurableTask.Models.SchedulerProperties properties = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerProperties SchedulerProperties(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), string endpoint = null, System.Collections.Generic.IEnumerable ipAllowlist = null, Azure.ResourceManager.DurableTask.Models.SchedulerSku sku = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerSku SchedulerSku(string name = null, int? capacity = default(int?), Azure.ResourceManager.DurableTask.Models.RedundancyState? redundancyState = default(Azure.ResourceManager.DurableTask.Models.RedundancyState?)) { throw null; } + public static Azure.ResourceManager.DurableTask.TaskHubData TaskHubData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DurableTask.Models.TaskHubProperties properties = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.TaskHubProperties TaskHubProperties(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), System.Uri dashboardUri = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DurableTask.Models.ProvisioningState 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.DurableTask.Models.ProvisioningState left, Azure.ResourceManager.DurableTask.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DurableTask.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DurableTask.Models.ProvisioningState left, Azure.ResourceManager.DurableTask.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RedundancyState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RedundancyState(string value) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.RedundancyState None { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.RedundancyState Zone { get { throw null; } } + public bool Equals(Azure.ResourceManager.DurableTask.Models.RedundancyState 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.DurableTask.Models.RedundancyState left, Azure.ResourceManager.DurableTask.Models.RedundancyState right) { throw null; } + public static implicit operator Azure.ResourceManager.DurableTask.Models.RedundancyState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DurableTask.Models.RedundancyState left, Azure.ResourceManager.DurableTask.Models.RedundancyState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SchedulerProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerProperties(System.Collections.Generic.IEnumerable ipAllowlist, Azure.ResourceManager.DurableTask.Models.SchedulerSku sku) { } + public string Endpoint { get { throw null; } } + public System.Collections.Generic.IList IPAllowlist { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.SchedulerSku Sku { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerProperties 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.DurableTask.Models.SchedulerProperties 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 SchedulerSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerSku(string name) { } + public int? Capacity { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DurableTask.Models.RedundancyState? RedundancyState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSku 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.DurableTask.Models.SchedulerSku 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 TaskHubProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TaskHubProperties() { } + public System.Uri DashboardUri { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.TaskHubProperties 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.DurableTask.Models.TaskHubProperties 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/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.netstandard2.0.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.netstandard2.0.cs new file mode 100644 index 000000000000..397a2afb47cc --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/api/Azure.ResourceManager.DurableTask.netstandard2.0.cs @@ -0,0 +1,229 @@ +namespace Azure.ResourceManager.DurableTask +{ + public static partial class DurableTaskExtensions + { + public static Azure.Response GetScheduler(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSchedulerAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DurableTask.SchedulerResource GetSchedulerResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DurableTask.SchedulerCollection GetSchedulers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSchedulers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSchedulersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DurableTask.TaskHubResource GetTaskHubResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class SchedulerCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SchedulerCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string schedulerName, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string schedulerName, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class SchedulerData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DurableTask.Models.SchedulerProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.SchedulerData 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.DurableTask.SchedulerData 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 SchedulerResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SchedulerResource() { } + public virtual Azure.ResourceManager.DurableTask.SchedulerData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTaskHub(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTaskHubAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DurableTask.TaskHubCollection GetTaskHubs() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DurableTask.SchedulerData 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.DurableTask.SchedulerData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.SchedulerData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class TaskHubCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected TaskHubCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string taskHubName, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string taskHubName, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string taskHubName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class TaskHubData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TaskHubData() { } + public Azure.ResourceManager.DurableTask.Models.TaskHubProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.TaskHubData 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.DurableTask.TaskHubData 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 TaskHubResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected TaskHubResource() { } + public virtual Azure.ResourceManager.DurableTask.TaskHubData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DurableTask.TaskHubData 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.DurableTask.TaskHubData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DurableTask.TaskHubData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DurableTask.Mocking +{ + public partial class MockableDurableTaskArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskArmClient() { } + public virtual Azure.ResourceManager.DurableTask.SchedulerResource GetSchedulerResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DurableTask.TaskHubResource GetTaskHubResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDurableTaskResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskResourceGroupResource() { } + public virtual Azure.Response GetScheduler(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSchedulerAsync(string schedulerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DurableTask.SchedulerCollection GetSchedulers() { throw null; } + } + public partial class MockableDurableTaskSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDurableTaskSubscriptionResource() { } + public virtual Azure.Pageable GetSchedulers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSchedulersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DurableTask.Models +{ + public static partial class ArmDurableTaskModelFactory + { + public static Azure.ResourceManager.DurableTask.SchedulerData SchedulerData(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.DurableTask.Models.SchedulerProperties properties = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerProperties SchedulerProperties(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), string endpoint = null, System.Collections.Generic.IEnumerable ipAllowlist = null, Azure.ResourceManager.DurableTask.Models.SchedulerSku sku = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.SchedulerSku SchedulerSku(string name = null, int? capacity = default(int?), Azure.ResourceManager.DurableTask.Models.RedundancyState? redundancyState = default(Azure.ResourceManager.DurableTask.Models.RedundancyState?)) { throw null; } + public static Azure.ResourceManager.DurableTask.TaskHubData TaskHubData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DurableTask.Models.TaskHubProperties properties = null) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.TaskHubProperties TaskHubProperties(Azure.ResourceManager.DurableTask.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.DurableTask.Models.ProvisioningState?), System.Uri dashboardUri = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DurableTask.Models.ProvisioningState 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.DurableTask.Models.ProvisioningState left, Azure.ResourceManager.DurableTask.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DurableTask.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DurableTask.Models.ProvisioningState left, Azure.ResourceManager.DurableTask.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RedundancyState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RedundancyState(string value) { throw null; } + public static Azure.ResourceManager.DurableTask.Models.RedundancyState None { get { throw null; } } + public static Azure.ResourceManager.DurableTask.Models.RedundancyState Zone { get { throw null; } } + public bool Equals(Azure.ResourceManager.DurableTask.Models.RedundancyState 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.DurableTask.Models.RedundancyState left, Azure.ResourceManager.DurableTask.Models.RedundancyState right) { throw null; } + public static implicit operator Azure.ResourceManager.DurableTask.Models.RedundancyState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DurableTask.Models.RedundancyState left, Azure.ResourceManager.DurableTask.Models.RedundancyState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SchedulerProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerProperties(System.Collections.Generic.IEnumerable ipAllowlist, Azure.ResourceManager.DurableTask.Models.SchedulerSku sku) { } + public string Endpoint { get { throw null; } } + public System.Collections.Generic.IList IPAllowlist { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.SchedulerSku Sku { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerProperties 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.DurableTask.Models.SchedulerProperties 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 SchedulerSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SchedulerSku(string name) { } + public int? Capacity { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.DurableTask.Models.RedundancyState? RedundancyState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.SchedulerSku 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.DurableTask.Models.SchedulerSku 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 TaskHubProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TaskHubProperties() { } + public System.Uri DashboardUri { get { throw null; } } + public Azure.ResourceManager.DurableTask.Models.ProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DurableTask.Models.TaskHubProperties 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.DurableTask.Models.TaskHubProperties 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/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerCollection.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerCollection.cs new file mode 100644 index 000000000000..59fb120a856d --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerCollection.cs @@ -0,0 +1,201 @@ +// 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.DurableTask.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DurableTask.Samples +{ + public partial class Sample_SchedulerCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_SchedulersCreateOrUpdate() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_CreateOrUpdate.json + // this example is just showing the usage of "Scheduler_CreateOrUpdate" 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 = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation + string schedulerName = "testscheduler"; + SchedulerData data = new SchedulerData(new AzureLocation("northcentralus")) + { + Properties = new SchedulerProperties(new string[] { "10.0.0.0/8" }, new SchedulerSku("Dedicated")), + Tags = +{ +["key7131"] = "ryohwcoiccwsnewjigfmijz", +["key2138"] = "fjaeecgnvqd" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, schedulerName, data); + SchedulerResource 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 + SchedulerData 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_SchedulersGet() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Get.json + // this example is just showing the usage of "Scheduler_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 = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation + string schedulerName = "testscheduler"; + SchedulerResource result = await collection.GetAsync(schedulerName); + + // 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 + SchedulerData 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_SchedulersListByResourceGroup() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_ListByResourceGroup.json + // this example is just showing the usage of "Scheduler_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 = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation and iterate over the result + await foreach (SchedulerResource 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 + SchedulerData 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_SchedulersGet() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Get.json + // this example is just showing the usage of "Scheduler_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 = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation + string schedulerName = "testscheduler"; + bool result = await collection.ExistsAsync(schedulerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_SchedulersGet() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Get.json + // this example is just showing the usage of "Scheduler_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 = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SchedulerResource + SchedulerCollection collection = resourceGroupResource.GetSchedulers(); + + // invoke the operation + string schedulerName = "testscheduler"; + NullableResponse response = await collection.GetIfExistsAsync(schedulerName); + SchedulerResource 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 + SchedulerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerResource.cs new file mode 100644 index 000000000000..0762e2ee0a49 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SchedulerResource.cs @@ -0,0 +1,117 @@ +// 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.DurableTask.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DurableTask.Samples +{ + public partial class Sample_SchedulerResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SchedulersGet() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Get.json + // this example is just showing the usage of "Scheduler_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 SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // invoke the operation + SchedulerResource result = await scheduler.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 + SchedulerData 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_SchedulersDelete() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Delete.json + // this example is just showing the usage of "Scheduler_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 SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // invoke the operation + await scheduler.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_SchedulersUpdate() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_Update.json + // this example is just showing the usage of "Scheduler_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 SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // invoke the operation + SchedulerData data = new SchedulerData(default) + { + Properties = new SchedulerProperties(new string[] { "10.0.0.0/8" }, new SchedulerSku("Dedicated") + { + Capacity = 10, + }), + Tags = +{ +["key8653"] = "lr" +}, + }; + ArmOperation lro = await scheduler.UpdateAsync(WaitUntil.Completed, data); + SchedulerResource 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 + SchedulerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..ed50efa434ea --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,50 @@ +// 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.DurableTask.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetSchedulers_SchedulersListBySubscription() + { + // Generated from example definition: 2024-10-01-preview/Schedulers_ListBySubscription.json + // this example is just showing the usage of "Scheduler_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 = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SchedulerResource item in subscriptionResource.GetSchedulersAsync()) + { + // 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 + SchedulerData 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/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubCollection.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubCollection.cs new file mode 100644 index 000000000000..b84dc3556b78 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubCollection.cs @@ -0,0 +1,200 @@ +// 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.DurableTask.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DurableTask.Samples +{ + public partial class Sample_TaskHubCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_TaskHubsCreateOrUpdate() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_CreateOrUpdate.json + // this example is just showing the usage of "TaskHub_CreateOrUpdate" 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 SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation + string taskHubName = "testtaskhub"; + TaskHubData data = new TaskHubData + { + Properties = new TaskHubProperties(), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, taskHubName, data); + TaskHubResource 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 + TaskHubData 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_TaskHubsGet() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Get.json + // this example is just showing the usage of "TaskHub_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 SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation + string taskHubName = "testtuskhub"; + TaskHubResource result = await collection.GetAsync(taskHubName); + + // 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 + TaskHubData 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_TaskHubsListByScheduler() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_ListByScheduler.json + // this example is just showing the usage of "TaskHub_ListByScheduler" 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 SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testtaskhub"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation and iterate over the result + await foreach (TaskHubResource 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 + TaskHubData 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_TaskHubsGet() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Get.json + // this example is just showing the usage of "TaskHub_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 SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation + string taskHubName = "testtuskhub"; + bool result = await collection.ExistsAsync(taskHubName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_TaskHubsGet() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Get.json + // this example is just showing the usage of "TaskHub_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 SchedulerResource created on azure + // for more information of creating SchedulerResource, please refer to the document of SchedulerResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + ResourceIdentifier schedulerResourceId = SchedulerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName); + SchedulerResource scheduler = client.GetSchedulerResource(schedulerResourceId); + + // get the collection of this TaskHubResource + TaskHubCollection collection = scheduler.GetTaskHubs(); + + // invoke the operation + string taskHubName = "testtuskhub"; + NullableResponse response = await collection.GetIfExistsAsync(taskHubName); + TaskHubResource 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 + TaskHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubResource.cs new file mode 100644 index 000000000000..3ffd0e10a057 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/samples/Generated/Samples/Sample_TaskHubResource.cs @@ -0,0 +1,113 @@ +// 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.DurableTask.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DurableTask.Samples +{ + public partial class Sample_TaskHubResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_TaskHubsGet() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Get.json + // this example is just showing the usage of "TaskHub_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 TaskHubResource created on azure + // for more information of creating TaskHubResource, please refer to the document of TaskHubResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + string taskHubName = "testtuskhub"; + ResourceIdentifier taskHubResourceId = TaskHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName, taskHubName); + TaskHubResource taskHub = client.GetTaskHubResource(taskHubResourceId); + + // invoke the operation + TaskHubResource result = await taskHub.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 + TaskHubData 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_TaskHubsDelete() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_Delete.json + // this example is just showing the usage of "TaskHub_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 TaskHubResource created on azure + // for more information of creating TaskHubResource, please refer to the document of TaskHubResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + string taskHubName = "testtuskhub"; + ResourceIdentifier taskHubResourceId = TaskHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName, taskHubName); + TaskHubResource taskHub = client.GetTaskHubResource(taskHubResourceId); + + // invoke the operation + await taskHub.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_TaskHubsCreateOrUpdate() + { + // Generated from example definition: 2024-10-01-preview/TaskHubs_CreateOrUpdate.json + // this example is just showing the usage of "TaskHub_CreateOrUpdate" 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 TaskHubResource created on azure + // for more information of creating TaskHubResource, please refer to the document of TaskHubResource + string subscriptionId = "EE9BD735-67CE-4A90-89C4-439D3F6A4C93"; + string resourceGroupName = "rgopenapi"; + string schedulerName = "testscheduler"; + string taskHubName = "testtaskhub"; + ResourceIdentifier taskHubResourceId = TaskHubResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, schedulerName, taskHubName); + TaskHubResource taskHub = client.GetTaskHubResource(taskHubResourceId); + + // invoke the operation + TaskHubData data = new TaskHubData + { + Properties = new TaskHubProperties(), + }; + ArmOperation lro = await taskHub.UpdateAsync(WaitUntil.Completed, data); + TaskHubResource 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 + TaskHubData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Azure.ResourceManager.DurableTask.csproj b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Azure.ResourceManager.DurableTask.csproj new file mode 100644 index 000000000000..f1af8c0dc5c4 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Azure.ResourceManager.DurableTask.csproj @@ -0,0 +1,10 @@ + + + This is the Azure.ResourceManager.DurableTask client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.ResourceManager.DurableTask for Azure Data Plane + 1.0.0-beta.1 + Azure.ResourceManager.DurableTask + $(RequiredTargetFrameworks) + true + + diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ArmDurableTaskModelFactory.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ArmDurableTaskModelFactory.cs new file mode 100644 index 000000000000..663ee5d2615b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ArmDurableTaskModelFactory.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// Model factory for models. + public static partial class ArmDurableTaskModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static TaskHubData TaskHubData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TaskHubProperties properties = null) + { + return new TaskHubData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler dashboard. + /// A new instance for mocking. + public static TaskHubProperties TaskHubProperties(ProvisioningState? provisioningState = null, Uri dashboardUri = null) + { + return new TaskHubProperties(provisioningState, dashboardUri, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static SchedulerData SchedulerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SchedulerProperties properties = null) + { + tags ??= new Dictionary(); + + return new SchedulerData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler. + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + /// SKU of the durable task scheduler. + /// A new instance for mocking. + public static SchedulerProperties SchedulerProperties(ProvisioningState? provisioningState = null, string endpoint = null, IEnumerable ipAllowlist = null, SchedulerSku sku = null) + { + ipAllowlist ??= new List(); + + return new SchedulerProperties(provisioningState, endpoint, ipAllowlist?.ToList(), sku, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the SKU. + /// The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy. + /// Indicates whether the current SKU configuration is zone redundant. + /// A new instance for mocking. + public static SchedulerSku SchedulerSku(string name = null, int? capacity = null, RedundancyState? redundancyState = null) + { + return new SchedulerSku(name, capacity, redundancyState, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/DurableTaskExtensions.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/DurableTaskExtensions.cs new file mode 100644 index 000000000000..59b95fb5863a --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/DurableTaskExtensions.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.DurableTask.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DurableTask +{ + /// A class to add extension methods to Azure.ResourceManager.DurableTask. + public static partial class DurableTaskExtensions + { + private static MockableDurableTaskArmClient GetMockableDurableTaskArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableDurableTaskArmClient(client0)); + } + + private static MockableDurableTaskResourceGroupResource GetMockableDurableTaskResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableDurableTaskResourceGroupResource(client, resource.Id)); + } + + private static MockableDurableTaskSubscriptionResource GetMockableDurableTaskSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableDurableTaskSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SchedulerResource GetSchedulerResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDurableTaskArmClient(client).GetSchedulerResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static TaskHubResource GetTaskHubResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDurableTaskArmClient(client).GetTaskHubResource(id); + } + + /// + /// Gets a collection of SchedulerResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of SchedulerResources and their operations over a SchedulerResource. + public static SchedulerCollection GetSchedulers(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDurableTaskResourceGroupResource(resourceGroupResource).GetSchedulers(); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Scheduler. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSchedulerAsync(this ResourceGroupResource resourceGroupResource, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableDurableTaskResourceGroupResource(resourceGroupResource).GetSchedulerAsync(schedulerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Scheduler. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetScheduler(this ResourceGroupResource resourceGroupResource, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDurableTaskResourceGroupResource(resourceGroupResource).GetScheduler(schedulerName, cancellationToken); + } + + /// + /// List Schedulers by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance 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. + public static AsyncPageable GetSchedulersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDurableTaskSubscriptionResource(subscriptionResource).GetSchedulersAsync(cancellationToken); + } + + /// + /// List Schedulers by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSchedulers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDurableTaskSubscriptionResource(subscriptionResource).GetSchedulers(cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskArmClient.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskArmClient.cs new file mode 100644 index 000000000000..066b094f4491 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskArmClient.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDurableTaskArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDurableTaskArmClient() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableDurableTaskArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDurableTaskArmClient(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. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SchedulerResource GetSchedulerResource(ResourceIdentifier id) + { + SchedulerResource.ValidateResourceId(id); + return new SchedulerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual TaskHubResource GetTaskHubResource(ResourceIdentifier id) + { + TaskHubResource.ValidateResourceId(id); + return new TaskHubResource(Client, id); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskResourceGroupResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskResourceGroupResource.cs new file mode 100644 index 000000000000..7f7eb5e71b35 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDurableTaskResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDurableTaskResourceGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableDurableTaskResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SchedulerResources in the ResourceGroupResource. + /// An object representing collection of SchedulerResources and their operations over a SchedulerResource. + public virtual SchedulerCollection GetSchedulers() + { + return GetCachedClient(client => new SchedulerCollection(client, Id)); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSchedulerAsync(string schedulerName, CancellationToken cancellationToken = default) + { + return await GetSchedulers().GetAsync(schedulerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetScheduler(string schedulerName, CancellationToken cancellationToken = default) + { + return GetSchedulers().Get(schedulerName, cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskSubscriptionResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskSubscriptionResource.cs new file mode 100644 index 000000000000..b46b8c12f2a9 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Extensions/MockableDurableTaskSubscriptionResource.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDurableTaskSubscriptionResource : ArmResource + { + private ClientDiagnostics _schedulerClientDiagnostics; + private SchedulersRestOperations _schedulerRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDurableTaskSubscriptionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableDurableTaskSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics SchedulerClientDiagnostics => _schedulerClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DurableTask", SchedulerResource.ResourceType.Namespace, Diagnostics); + private SchedulersRestOperations SchedulerRestClient => _schedulerRestClient ??= new SchedulersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SchedulerResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Schedulers by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSchedulersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SchedulerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SchedulerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SchedulerResource(Client, SchedulerData.DeserializeSchedulerData(e)), SchedulerClientDiagnostics, Pipeline, "MockableDurableTaskSubscriptionResource.GetSchedulers", "value", "nextLink", cancellationToken); + } + + /// + /// List Schedulers by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSchedulers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SchedulerRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SchedulerRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SchedulerResource(Client, SchedulerData.DeserializeSchedulerData(e)), SchedulerClientDiagnostics, Pipeline, "MockableDurableTaskSubscriptionResource.GetSchedulers", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Argument.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..d15981d33b18 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + 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/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..001cb5f61046 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingList.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..5ce8ee7ec441 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DurableTask +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..0523437e28c8 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// 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.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask +{ + internal static class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var 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(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + 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"); + } + + public static string GetRequiredString(this JsonElement element) + { + var 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}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + 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/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Optional.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..dd8a99d7dd47 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.DurableTask +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..491ccbbaaf8c --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + 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; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperation.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperation.cs new file mode 100644 index 000000000000..34ba48f6a7cb --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperation.cs @@ -0,0 +1,94 @@ +// 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.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DurableTaskArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of DurableTaskArmOperation for mocking. + protected DurableTaskArmOperation() + { + } + + internal DurableTaskArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DurableTaskArmOperation(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) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "DurableTaskArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["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/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperationOfT.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperationOfT.cs new file mode 100644 index 000000000000..dbab97aea54e --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/DurableTaskArmOperationOfT.cs @@ -0,0 +1,100 @@ +// 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.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DurableTaskArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of DurableTaskArmOperation for mocking. + protected DurableTaskArmOperation() + { + } + + internal DurableTaskArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DurableTaskArmOperation(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) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "DurableTaskArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + 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 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/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/SchedulerOperationSource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/SchedulerOperationSource.cs new file mode 100644 index 000000000000..f025997f4f8e --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/SchedulerOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask +{ + internal class SchedulerOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SchedulerOperationSource(ArmClient client) + { + _client = client; + } + + SchedulerResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SchedulerData.DeserializeSchedulerData(document.RootElement); + return new SchedulerResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SchedulerData.DeserializeSchedulerData(document.RootElement); + return new SchedulerResource(_client, data); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/TaskHubOperationSource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/TaskHubOperationSource.cs new file mode 100644 index 000000000000..d7cdb01f518d --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/LongRunningOperation/TaskHubOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask +{ + internal class TaskHubOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal TaskHubOperationSource(ArmClient client) + { + _client = client; + } + + TaskHubResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = TaskHubData.DeserializeTaskHubData(document.RootElement); + return new TaskHubResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = TaskHubData.DeserializeTaskHubData(document.RootElement); + return new TaskHubResource(_client, data); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/ProvisioningState.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..2705a701b11f --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The status of the current operation. + 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"; + private const string ProvisioningValue = "Provisioning"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string AcceptedValue = "Accepted"; + + /// Resource has been created. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// The resource is being provisioned. + public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + /// The resource is updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// The resource is being deleted. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// The resource create request has been accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => 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/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/RedundancyState.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/RedundancyState.cs new file mode 100644 index 000000000000..cab76ba363c0 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/RedundancyState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The state of the resource redundancy. + public readonly partial struct RedundancyState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RedundancyState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string ZoneValue = "Zone"; + + /// The resource is not redundant. + public static RedundancyState None { get; } = new RedundancyState(NoneValue); + /// The resource is zone redundant. + public static RedundancyState Zone { get; } = new RedundancyState(ZoneValue); + /// Determines if two values are the same. + public static bool operator ==(RedundancyState left, RedundancyState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RedundancyState left, RedundancyState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedundancyState(string value) => new RedundancyState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RedundancyState other && Equals(other); + /// + public bool Equals(RedundancyState 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/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.Serialization.cs new file mode 100644 index 000000000000..a5c576ef64cc --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + internal partial class SchedulerListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerListResult(document.RootElement, options); + } + + internal static SchedulerListResult DeserializeSchedulerListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SchedulerData.DeserializeSchedulerData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerListResult)} does not support writing '{options.Format}' format."); + } + } + + SchedulerListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSchedulerListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.cs new file mode 100644 index 000000000000..85a9ef186815 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The response of a Scheduler list operation. + internal partial class SchedulerListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The Scheduler items on this page. + /// is null. + internal SchedulerListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Scheduler items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SchedulerListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchedulerListResult() + { + } + + /// The Scheduler items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.Serialization.cs new file mode 100644 index 000000000000..82c2c826ba36 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + public partial class SchedulerProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint); + } + writer.WritePropertyName("ipAllowlist"u8); + writer.WriteStartArray(); + foreach (var item in IPAllowlist) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerProperties(document.RootElement, options); + } + + internal static SchedulerProperties DeserializeSchedulerProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + string endpoint = default; + IList ipAllowlist = default; + SchedulerSku sku = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("endpoint"u8)) + { + endpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("ipAllowlist"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + ipAllowlist = array; + continue; + } + if (property.NameEquals("sku"u8)) + { + sku = SchedulerSku.DeserializeSchedulerSku(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerProperties(provisioningState, endpoint, ipAllowlist, sku, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerProperties)} does not support writing '{options.Format}' format."); + } + } + + SchedulerProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSchedulerProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.cs new file mode 100644 index 000000000000..622f09dfc0bb --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerProperties.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// Details of the Scheduler. + public partial class SchedulerProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + /// SKU of the durable task scheduler. + /// or is null. + public SchedulerProperties(IEnumerable ipAllowlist, SchedulerSku sku) + { + Argument.AssertNotNull(ipAllowlist, nameof(ipAllowlist)); + Argument.AssertNotNull(sku, nameof(sku)); + + IPAllowlist = ipAllowlist.ToList(); + Sku = sku; + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler. + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + /// SKU of the durable task scheduler. + /// Keeps track of any properties unknown to the library. + internal SchedulerProperties(ProvisioningState? provisioningState, string endpoint, IList ipAllowlist, SchedulerSku sku, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Endpoint = endpoint; + IPAllowlist = ipAllowlist; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchedulerProperties() + { + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// URL of the durable task scheduler. + public string Endpoint { get; } + /// IP allow list for durable task scheduler. Values can be IPv4, IPv6 or CIDR. + public IList IPAllowlist { get; } + /// SKU of the durable task scheduler. + public SchedulerSku Sku { get; set; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.Serialization.cs new file mode 100644 index 000000000000..c0bfd7ee9980 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + public partial class SchedulerSku : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Capacity)) + { + writer.WritePropertyName("capacity"u8); + writer.WriteNumberValue(Capacity.Value); + } + if (options.Format != "W" && Optional.IsDefined(RedundancyState)) + { + writer.WritePropertyName("redundancyState"u8); + writer.WriteStringValue(RedundancyState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchedulerSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerSku(document.RootElement, options); + } + + internal static SchedulerSku DeserializeSchedulerSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + int? capacity = default; + RedundancyState? redundancyState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("capacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("redundancyState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redundancyState = new RedundancyState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerSku(name, capacity, redundancyState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerSku)} does not support writing '{options.Format}' format."); + } + } + + SchedulerSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSchedulerSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.cs new file mode 100644 index 000000000000..9da3588373ca --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/SchedulerSku.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The SKU (Stock Keeping Unit) assigned to this durable task scheduler. + public partial class SchedulerSku + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the SKU. + /// is null. + public SchedulerSku(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// The name of the SKU. + /// The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy. + /// Indicates whether the current SKU configuration is zone redundant. + /// Keeps track of any properties unknown to the library. + internal SchedulerSku(string name, int? capacity, RedundancyState? redundancyState, IDictionary serializedAdditionalRawData) + { + Name = name; + Capacity = capacity; + RedundancyState = redundancyState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchedulerSku() + { + } + + /// The name of the SKU. + public string Name { get; set; } + /// The SKU capacity. This allows scale out/in for the resource and impacts zone redundancy. + public int? Capacity { get; set; } + /// Indicates whether the current SKU configuration is zone redundant. + public RedundancyState? RedundancyState { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.Serialization.cs new file mode 100644 index 000000000000..66cd34841d2b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + internal partial class TaskHubListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TaskHubListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTaskHubListResult(document.RootElement, options); + } + + internal static TaskHubListResult DeserializeTaskHubListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TaskHubData.DeserializeTaskHubData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TaskHubListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TaskHubListResult)} does not support writing '{options.Format}' format."); + } + } + + TaskHubListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTaskHubListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TaskHubListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.cs new file mode 100644 index 000000000000..a15dd30e019b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The response of a TaskHub list operation. + internal partial class TaskHubListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The TaskHub items on this page. + /// is null. + internal TaskHubListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The TaskHub items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal TaskHubListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TaskHubListResult() + { + } + + /// The TaskHub items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.Serialization.cs new file mode 100644 index 000000000000..9e1458a977a1 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DurableTask.Models +{ + public partial class TaskHubProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(DashboardUri)) + { + writer.WritePropertyName("dashboardUrl"u8); + writer.WriteStringValue(DashboardUri.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TaskHubProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTaskHubProperties(document.RootElement, options); + } + + internal static TaskHubProperties DeserializeTaskHubProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + Uri dashboardUrl = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("dashboardUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dashboardUrl = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TaskHubProperties(provisioningState, dashboardUrl, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TaskHubProperties)} does not support writing '{options.Format}' format."); + } + } + + TaskHubProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTaskHubProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TaskHubProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.cs new file mode 100644 index 000000000000..97074a8f32f9 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/Models/TaskHubProperties.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DurableTask.Models +{ + /// The properties of Task Hub. + public partial class TaskHubProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TaskHubProperties() + { + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// URL of the durable task scheduler dashboard. + /// Keeps track of any properties unknown to the library. + internal TaskHubProperties(ProvisioningState? provisioningState, Uri dashboardUri, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + DashboardUri = dashboardUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// URL of the durable task scheduler dashboard. + public Uri DashboardUri { get; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ProviderConstants.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..6cb750df8d05 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/ProviderConstants.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/SchedulersRestOperations.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/SchedulersRestOperations.cs new file mode 100644 index 000000000000..0f0e739f86fd --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/SchedulersRestOperations.cs @@ -0,0 +1,723 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DurableTask.Models; + +namespace Azure.ResourceManager.DurableTask +{ + internal partial class SchedulersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SchedulersRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public SchedulersRestOperations(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 ?? "2024-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string schedulerName) + { + 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.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string schedulerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// 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 schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schedulerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SchedulerData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchedulerData.DeserializeSchedulerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SchedulerData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// 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 schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schedulerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SchedulerData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchedulerData.DeserializeSchedulerData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SchedulerData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData 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.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, 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; + } + + /// Create or update a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, schedulerName, 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); + } + } + + /// Create or update a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, schedulerName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData 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.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string schedulerName, SchedulerData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, 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; + } + + /// Update a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The resource properties to be updated. + /// 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 schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, schedulerName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The resource properties to be updated. + /// 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 schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, schedulerName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string schedulerName) + { + 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.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string schedulerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// 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 schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schedulerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Scheduler. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// 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 schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schedulerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + 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.DurableTask/schedulers", 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(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schedulers by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + SchedulerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schedulers by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// 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) + { + 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: + { + SchedulerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchedulerListResult.DeserializeSchedulerListResult(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.DurableTask/schedulers", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schedulers by subscription. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + SchedulerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schedulers by subscription. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + SchedulerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchedulerListResult.DeserializeSchedulerListResult(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) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schedulers by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + SchedulerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schedulers by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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) + { + 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: + { + SchedulerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchedulerListResult.DeserializeSchedulerListResult(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(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Schedulers by subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + SchedulerListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Schedulers by subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + SchedulerListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SchedulerListResult.DeserializeSchedulerListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/TaskHubsRestOperations.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/TaskHubsRestOperations.cs new file mode 100644 index 000000000000..76ec523b72bd --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/RestOperations/TaskHubsRestOperations.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DurableTask.Models; + +namespace Azure.ResourceManager.DurableTask +{ + internal partial class TaskHubsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TaskHubsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public TaskHubsRestOperations(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 ?? "2024-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + 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.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// 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 schedulerName, string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TaskHubData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TaskHubData.DeserializeTaskHubData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TaskHubData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// 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 schedulerName, string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TaskHubData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TaskHubData.DeserializeTaskHubData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TaskHubData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, TaskHubData 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.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, TaskHubData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, 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; + } + + /// Create or Update a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName, 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); + } + } + + /// Create or Update a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + 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.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs/", false); + uri.AppendPath(taskHubName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// 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 schedulerName, string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Task Hub. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The name of the TaskHub. + /// 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 schedulerName, string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, schedulerName, taskHubName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySchedulerRequestUri(string subscriptionId, string resourceGroupName, string schedulerName) + { + 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.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySchedulerRequest(string subscriptionId, string resourceGroupName, string schedulerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DurableTask/schedulers/", false); + uri.AppendPath(schedulerName, true); + uri.AppendPath("/taskHubs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Task Hubs. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySchedulerAsync(string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateListBySchedulerRequest(subscriptionId, resourceGroupName, schedulerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TaskHubListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TaskHubListResult.DeserializeTaskHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Task Hubs. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByScheduler(string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateListBySchedulerRequest(subscriptionId, resourceGroupName, schedulerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TaskHubListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TaskHubListResult.DeserializeTaskHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySchedulerNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string schedulerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySchedulerNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string schedulerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Task Hubs. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListBySchedulerNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateListBySchedulerNextPageRequest(nextLink, subscriptionId, resourceGroupName, schedulerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TaskHubListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TaskHubListResult.DeserializeTaskHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Task Hubs. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Scheduler. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListBySchedulerNextPage(string nextLink, string subscriptionId, string resourceGroupName, string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var message = CreateListBySchedulerNextPageRequest(nextLink, subscriptionId, resourceGroupName, schedulerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TaskHubListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TaskHubListResult.DeserializeTaskHubListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerCollection.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerCollection.cs new file mode 100644 index 000000000000..e99481ec7eda --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// 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 GetSchedulers method from an instance of . + /// + public partial class SchedulerCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _schedulerClientDiagnostics; + private readonly SchedulersRestOperations _schedulerRestClient; + + /// Initializes a new instance of the class for mocking. + protected SchedulerCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal SchedulerCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _schedulerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DurableTask", SchedulerResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SchedulerResource.ResourceType, out string schedulerApiVersion); + _schedulerRestClient = new SchedulersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, schedulerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The name of the Scheduler. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _schedulerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, data, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(new SchedulerOperationSource(Client), _schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The name of the Scheduler. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string schedulerName, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _schedulerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, data, cancellationToken); + var operation = new DurableTaskArmOperation(new SchedulerOperationSource(Client), _schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.Get"); + scope.Start(); + try + { + var response = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.Get"); + scope.Start(); + try + { + var response = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Schedulers by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _schedulerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _schedulerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SchedulerResource(Client, SchedulerData.DeserializeSchedulerData(e)), _schedulerClientDiagnostics, Pipeline, "SchedulerCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Schedulers by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers + /// + /// + /// Operation Id + /// Scheduler_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _schedulerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _schedulerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SchedulerResource(Client, SchedulerData.DeserializeSchedulerData(e)), _schedulerClientDiagnostics, Pipeline, "SchedulerCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.Exists"); + scope.Start(); + try + { + var response = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.Exists"); + scope.Start(); + try + { + var response = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Scheduler. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string schedulerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(schedulerName, nameof(schedulerName)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerCollection.GetIfExists"); + scope.Start(); + try + { + var response = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, schedulerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.Serialization.cs new file mode 100644 index 000000000000..86cf6aae99a9 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.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.Core; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask +{ + public partial class SchedulerData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + SchedulerData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchedulerData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchedulerData(document.RootElement, options); + } + + internal static SchedulerData DeserializeSchedulerData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SchedulerProperties properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SchedulerProperties.DeserializeSchedulerProperties(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchedulerData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchedulerData)} does not support writing '{options.Format}' format."); + } + } + + SchedulerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSchedulerData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchedulerData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.cs new file mode 100644 index 000000000000..b0efc6bb0c8b --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerData.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A class representing the Scheduler data model. + /// A Durable Task Scheduler resource + /// + public partial class SchedulerData : 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; + + /// Initializes a new instance of . + /// The location. + public SchedulerData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal SchedulerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SchedulerProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchedulerData() + { + } + + /// The resource-specific properties for this resource. + public SchedulerProperties Properties { get; set; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.Serialization.cs new file mode 100644 index 000000000000..ee2bf83f4e2f --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DurableTask +{ + public partial class SchedulerResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SchedulerData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SchedulerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.cs new file mode 100644 index 000000000000..0f8025ffa154 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/SchedulerResource.cs @@ -0,0 +1,775 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A Class representing a Scheduler 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 GetSchedulerResource method. + /// Otherwise you can get one from its parent resource using the GetScheduler method. + /// + public partial class SchedulerResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The schedulerName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _schedulerClientDiagnostics; + private readonly SchedulersRestOperations _schedulerRestClient; + private readonly SchedulerData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DurableTask/schedulers"; + + /// Initializes a new instance of the class for mocking. + protected SchedulerResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SchedulerResource(ArmClient client, SchedulerData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SchedulerResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _schedulerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DurableTask", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string schedulerApiVersion); + _schedulerRestClient = new SchedulersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, schedulerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SchedulerData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of TaskHubResources in the Scheduler. + /// An object representing collection of TaskHubResources and their operations over a TaskHubResource. + public virtual TaskHubCollection GetTaskHubs() + { + return GetCachedClient(client => new TaskHubCollection(client, Id)); + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetTaskHubAsync(string taskHubName, CancellationToken cancellationToken = default) + { + return await GetTaskHubs().GetAsync(taskHubName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetTaskHub(string taskHubName, CancellationToken cancellationToken = default) + { + return GetTaskHubs().Get(taskHubName, cancellationToken); + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Get"); + scope.Start(); + try + { + var response = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Get"); + scope.Start(); + try + { + var response = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SchedulerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Delete + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Delete"); + scope.Start(); + try + { + var response = await _schedulerRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(_schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Delete + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Delete"); + scope.Start(); + try + { + var response = _schedulerRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DurableTaskArmOperation(_schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Update + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Update"); + scope.Start(); + try + { + var response = await _schedulerRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(new SchedulerOperationSource(Client), _schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Scheduler + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Update + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SchedulerData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.Update"); + scope.Start(); + try + { + var response = _schedulerRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); + var operation = new DurableTaskArmOperation(new SchedulerOperationSource(Client), _schedulerClientDiagnostics, Pipeline, _schedulerRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SchedulerData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SchedulerData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SchedulerData(current.Location); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SchedulerData(current.Location); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _schedulerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SchedulerData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName} + /// + /// + /// Operation Id + /// Scheduler_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _schedulerClientDiagnostics.CreateScope("SchedulerResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _schedulerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SchedulerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SchedulerData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubCollection.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubCollection.cs new file mode 100644 index 000000000000..b6cb03eee7e5 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// 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 GetTaskHubs method from an instance of . + /// + public partial class TaskHubCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _taskHubClientDiagnostics; + private readonly TaskHubsRestOperations _taskHubRestClient; + + /// Initializes a new instance of the class for mocking. + protected TaskHubCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal TaskHubCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _taskHubClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DurableTask", TaskHubResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(TaskHubResource.ResourceType, out string taskHubApiVersion); + _taskHubRestClient = new TaskHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, taskHubApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SchedulerResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SchedulerResource.ResourceType), nameof(id)); + } + + /// + /// Create or Update a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The name of the TaskHub. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string taskHubName, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _taskHubRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, data, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(new TaskHubOperationSource(Client), _taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The name of the TaskHub. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string taskHubName, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _taskHubRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, data, cancellationToken); + var operation = new DurableTaskArmOperation(new TaskHubOperationSource(Client), _taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.Get"); + scope.Start(); + try + { + var response = await _taskHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.Get"); + scope.Start(); + try + { + var response = _taskHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Task Hubs + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs + /// + /// + /// Operation Id + /// TaskHub_ListByScheduler + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _taskHubRestClient.CreateListBySchedulerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _taskHubRestClient.CreateListBySchedulerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TaskHubResource(Client, TaskHubData.DeserializeTaskHubData(e)), _taskHubClientDiagnostics, Pipeline, "TaskHubCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Task Hubs + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs + /// + /// + /// Operation Id + /// TaskHub_ListByScheduler + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _taskHubRestClient.CreateListBySchedulerRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _taskHubRestClient.CreateListBySchedulerNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TaskHubResource(Client, TaskHubData.DeserializeTaskHubData(e)), _taskHubClientDiagnostics, Pipeline, "TaskHubCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.Exists"); + scope.Start(); + try + { + var response = await _taskHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.Exists"); + scope.Start(); + try + { + var response = _taskHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _taskHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the TaskHub. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string taskHubName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskHubName, nameof(taskHubName)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubCollection.GetIfExists"); + scope.Start(); + try + { + var response = _taskHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, taskHubName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.Serialization.cs new file mode 100644 index 000000000000..4e95bf665e4e --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask +{ + public partial class TaskHubData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + TaskHubData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TaskHubData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTaskHubData(document.RootElement, options); + } + + internal static TaskHubData DeserializeTaskHubData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TaskHubProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = TaskHubProperties.DeserializeTaskHubProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TaskHubData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TaskHubData)} does not support writing '{options.Format}' format."); + } + } + + TaskHubData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTaskHubData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TaskHubData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.cs new file mode 100644 index 000000000000..32ccf2cef315 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DurableTask.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A class representing the TaskHub data model. + /// A Task Hub resource belonging to the scheduler + /// + public partial class TaskHubData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TaskHubData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal TaskHubData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TaskHubProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public TaskHubProperties Properties { get; set; } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.Serialization.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.Serialization.cs new file mode 100644 index 000000000000..dbb7d1eccb6a --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DurableTask +{ + public partial class TaskHubResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + TaskHubData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + TaskHubData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.cs new file mode 100644 index 000000000000..732958f3e416 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Generated/TaskHubResource.cs @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DurableTask +{ + /// + /// A Class representing a TaskHub 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 GetTaskHubResource method. + /// Otherwise you can get one from its parent resource using the GetTaskHub method. + /// + public partial class TaskHubResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The schedulerName. + /// The taskHubName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string schedulerName, string taskHubName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _taskHubClientDiagnostics; + private readonly TaskHubsRestOperations _taskHubRestClient; + private readonly TaskHubData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DurableTask/schedulers/taskHubs"; + + /// Initializes a new instance of the class for mocking. + protected TaskHubResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal TaskHubResource(ArmClient client, TaskHubData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal TaskHubResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _taskHubClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DurableTask", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string taskHubApiVersion); + _taskHubRestClient = new TaskHubsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, taskHubApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual TaskHubData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Get"); + scope.Start(); + try + { + var response = await _taskHubRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Get + /// + /// + /// Default Api Version + /// 2024-10-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Get"); + scope.Start(); + try + { + var response = _taskHubRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TaskHubResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Delete + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Delete"); + scope.Start(); + try + { + var response = await _taskHubRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(_taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_Delete + /// + /// + /// Default Api Version + /// 2024-10-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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Delete"); + scope.Start(); + try + { + var response = _taskHubRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DurableTaskArmOperation(_taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-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. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Update"); + scope.Start(); + try + { + var response = await _taskHubRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new DurableTaskArmOperation(new TaskHubOperationSource(Client), _taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or Update a Task Hub + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/taskHubs/{taskHubName} + /// + /// + /// Operation Id + /// TaskHub_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-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. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, TaskHubData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _taskHubClientDiagnostics.CreateScope("TaskHubResource.Update"); + scope.Start(); + try + { + var response = _taskHubRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new DurableTaskArmOperation(new TaskHubOperationSource(Client), _taskHubClientDiagnostics, Pipeline, _taskHubRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Properties/AssemblyInfo.cs b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..34391efa0f1c --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.DurableTask.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/Azure.ResourceManager.DurableTask.Tests.csproj b/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/Azure.ResourceManager.DurableTask.Tests.csproj new file mode 100644 index 000000000000..dfcea894b39a --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/tests/Azure.ResourceManager.DurableTask.Tests.csproj @@ -0,0 +1,12 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + diff --git a/sdk/durabletask/Azure.ResourceManager.DurableTask/tsp-location.yaml b/sdk/durabletask/Azure.ResourceManager.DurableTask/tsp-location.yaml new file mode 100644 index 000000000000..3633c9630c90 --- /dev/null +++ b/sdk/durabletask/Azure.ResourceManager.DurableTask/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/durabletask/DurableTask.Management +commit: 1eb05b957a92bd56ef0ae770335b5813338984c2 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/durabletask/ci.mgmt.yml b/sdk/durabletask/ci.mgmt.yml new file mode 100644 index 000000000000..39da7a52b1d7 --- /dev/null +++ b/sdk/durabletask/ci.mgmt.yml @@ -0,0 +1,48 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/durabletask/ci.mgmt.yml + - sdk/durabletask/Azure.ResourceManager.DurableTask/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/durabletask/ci.mgmt.yml + - sdk/durabletask/Azure.ResourceManager.DurableTask/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/durabletask/ci.mgmt.yml + - sdk/durabletask/Azure.ResourceManager.DurableTask/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: durabletask + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.DurableTask + safeName: AzureResourceManagerDurableTask diff --git a/sdk/dynatrace/ci.mgmt.yml b/sdk/dynatrace/ci.mgmt.yml index f76bf3a316af..2c4d2d4128f7 100644 --- a/sdk/dynatrace/ci.mgmt.yml +++ b/sdk/dynatrace/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/dynatrace/ci.mgmt.yml - sdk/dynatrace/Azure.ResourceManager.Dynatrace/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dynatrace/ci.mgmt.yml + - sdk/dynatrace/Azure.ResourceManager.Dynatrace/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dynatrace/ci.mgmt.yml + - sdk/dynatrace/Azure.ResourceManager.Dynatrace/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dynatrace/ci.mgmt.yml + - sdk/dynatrace/Azure.ResourceManager.Dynatrace/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/edgeorder/ci.mgmt.yml b/sdk/edgeorder/ci.mgmt.yml index 4d1fbaa121f9..15989232b722 100644 --- a/sdk/edgeorder/ci.mgmt.yml +++ b/sdk/edgeorder/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/edgeorder/ci.mgmt.yml - sdk/edgeorder/Azure.ResourceManager.EdgeOrder/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgeorder/ci.mgmt.yml + - sdk/edgeorder/Azure.ResourceManager.EdgeOrder/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgeorder/ci.mgmt.yml + - sdk/edgeorder/Azure.ResourceManager.EdgeOrder/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgeorder/ci.mgmt.yml + - sdk/edgeorder/Azure.ResourceManager.EdgeOrder/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/edgezones/ci.mgmt.yml b/sdk/edgezones/ci.mgmt.yml index 9dc8d79aab30..84c08c9db876 100644 --- a/sdk/edgezones/ci.mgmt.yml +++ b/sdk/edgezones/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/edgezones/ci.mgmt.yml - sdk/edgezones/Azure.ResourceManager.EdgeZones/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgezones/ci.mgmt.yml + - sdk/edgezones/Azure.ResourceManager.EdgeZones/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgezones/ci.mgmt.yml + - sdk/edgezones/Azure.ResourceManager.EdgeZones/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgezones/ci.mgmt.yml + - sdk/edgezones/Azure.ResourceManager.EdgeZones/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/elastic/ci.mgmt.yml b/sdk/elastic/ci.mgmt.yml index 76ecd8b3923d..42e07ac5394c 100644 --- a/sdk/elastic/ci.mgmt.yml +++ b/sdk/elastic/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/elastic/ci.mgmt.yml - sdk/elastic/Azure.ResourceManager.Elastic/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/elastic/ci.mgmt.yml + - sdk/elastic/Azure.ResourceManager.Elastic/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/elastic/ci.mgmt.yml + - sdk/elastic/Azure.ResourceManager.Elastic/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/elastic/ci.mgmt.yml + - sdk/elastic/Azure.ResourceManager.Elastic/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/elasticsan/ci.mgmt.yml b/sdk/elasticsan/ci.mgmt.yml index 7e2bb35dde21..843db1ad0bc7 100644 --- a/sdk/elasticsan/ci.mgmt.yml +++ b/sdk/elasticsan/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/elasticsan/ci.mgmt.yml - sdk/elasticsan/Azure.ResourceManager.ElasticSan/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/elasticsan/ci.mgmt.yml + - sdk/elasticsan/Azure.ResourceManager.ElasticSan/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/elasticsan/ci.mgmt.yml + - sdk/elasticsan/Azure.ResourceManager.ElasticSan/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/elasticsan/ci.mgmt.yml + - sdk/elasticsan/Azure.ResourceManager.ElasticSan/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/eventgrid/ci.mgmt.yml b/sdk/eventgrid/ci.mgmt.yml index cb02a1b84e8b..158903918490 100644 --- a/sdk/eventgrid/ci.mgmt.yml +++ b/sdk/eventgrid/ci.mgmt.yml @@ -2,6 +2,7 @@ # This is for Track 2 managment plane SDK trigger: none + pr: branches: include: @@ -14,6 +15,42 @@ pr: - sdk/eventgrid/ci.mgmt.yml - sdk/eventgrid/Azure.ResourceManager.EventGrid/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventgrid/ci.mgmt.yml + - sdk/eventgrid/Azure.ResourceManager.EventGrid/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventgrid/ci.mgmt.yml + - sdk/eventgrid/Azure.ResourceManager.EventGrid/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventgrid/ci.mgmt.yml + - sdk/eventgrid/Azure.ResourceManager.EventGrid/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/eventhub/ci.mgmt.yml b/sdk/eventhub/ci.mgmt.yml index b7c0045fffb3..f524d0ccd549 100644 --- a/sdk/eventhub/ci.mgmt.yml +++ b/sdk/eventhub/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/eventhub/ci.mgmt.yml - sdk/eventhub/Azure.ResourceManager.EventHubs/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventhub/ci.mgmt.yml + - sdk/eventhub/Azure.ResourceManager.EventHubs/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventhub/ci.mgmt.yml + - sdk/eventhub/Azure.ResourceManager.EventHubs/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventhub/ci.mgmt.yml + - sdk/eventhub/Azure.ResourceManager.EventHubs/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/extendedlocation/ci.mgmt.yml b/sdk/extendedlocation/ci.mgmt.yml index 4fb53374be74..0c6a34a04697 100644 --- a/sdk/extendedlocation/ci.mgmt.yml +++ b/sdk/extendedlocation/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/extendedlocation/ci.mgmt.yml - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/extendedlocation/ci.mgmt.yml + - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/extendedlocation/ci.mgmt.yml + - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/extendedlocation/ci.mgmt.yml + - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/fabric/ci.mgmt.yml b/sdk/fabric/ci.mgmt.yml index d0bc6cea6eb9..be7a72ffc8ea 100644 --- a/sdk/fabric/ci.mgmt.yml +++ b/sdk/fabric/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/fabric/ci.mgmt.yml - sdk/fabric/Azure.ResourceManager.Fabric/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fabric/ci.mgmt.yml + - sdk/fabric/Azure.ResourceManager.Fabric/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fabric/ci.mgmt.yml + - sdk/fabric/Azure.ResourceManager.Fabric/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fabric/ci.mgmt.yml + - sdk/fabric/Azure.ResourceManager.Fabric/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/fleet/ci.mgmt.yml b/sdk/fleet/ci.mgmt.yml index 09a225882401..e555ed49a969 100644 --- a/sdk/fleet/ci.mgmt.yml +++ b/sdk/fleet/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/fleet/ci.mgmt.yml - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fleet/ci.mgmt.yml + - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fleet/ci.mgmt.yml + - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fleet/ci.mgmt.yml + - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/fluidrelay/ci.mgmt.yml b/sdk/fluidrelay/ci.mgmt.yml index d43dfe94d729..6a383b9de7b0 100644 --- a/sdk/fluidrelay/ci.mgmt.yml +++ b/sdk/fluidrelay/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/fluidrelay/ci.mgmt.yml - sdk/fluidrelay/Azure.ResourceManager.FluidRelay/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fluidrelay/ci.mgmt.yml + - sdk/fluidrelay/Azure.ResourceManager.FluidRelay/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fluidrelay/ci.mgmt.yml + - sdk/fluidrelay/Azure.ResourceManager.FluidRelay/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fluidrelay/ci.mgmt.yml + - sdk/fluidrelay/Azure.ResourceManager.FluidRelay/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/frontdoor/ci.mgmt.yml b/sdk/frontdoor/ci.mgmt.yml index bff9dbcae78c..3c807e462e10 100644 --- a/sdk/frontdoor/ci.mgmt.yml +++ b/sdk/frontdoor/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/frontdoor/ci.mgmt.yml - sdk/frontdoor/Azure.ResourceManager.FrontDoor/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/frontdoor/ci.mgmt.yml + - sdk/frontdoor/Azure.ResourceManager.FrontDoor/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/frontdoor/ci.mgmt.yml + - sdk/frontdoor/Azure.ResourceManager.FrontDoor/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/frontdoor/ci.mgmt.yml + - sdk/frontdoor/Azure.ResourceManager.FrontDoor/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/grafana/ci.mgmt.yml b/sdk/grafana/ci.mgmt.yml index a2f22e6ee33b..713896b81293 100644 --- a/sdk/grafana/ci.mgmt.yml +++ b/sdk/grafana/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/grafana/ci.mgmt.yml - sdk/grafana/Azure.ResourceManager.Grafana/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/grafana/ci.mgmt.yml + - sdk/grafana/Azure.ResourceManager.Grafana/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/grafana/ci.mgmt.yml + - sdk/grafana/Azure.ResourceManager.Grafana/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/grafana/ci.mgmt.yml + - sdk/grafana/Azure.ResourceManager.Grafana/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/graphservices/ci.mgmt.yml b/sdk/graphservices/ci.mgmt.yml index 717a9a4a1963..276d9f996d38 100644 --- a/sdk/graphservices/ci.mgmt.yml +++ b/sdk/graphservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/graphservices/ci.mgmt.yml - sdk/graphservices/Azure.ResourceManager.GraphServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/graphservices/ci.mgmt.yml + - sdk/graphservices/Azure.ResourceManager.GraphServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/graphservices/ci.mgmt.yml + - sdk/graphservices/Azure.ResourceManager.GraphServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/graphservices/ci.mgmt.yml + - sdk/graphservices/Azure.ResourceManager.GraphServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/guestconfiguration/ci.mgmt.yml b/sdk/guestconfiguration/ci.mgmt.yml index 5ebc59550f58..47a7023ce8aa 100644 --- a/sdk/guestconfiguration/ci.mgmt.yml +++ b/sdk/guestconfiguration/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/guestconfiguration/ci.mgmt.yml - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/guestconfiguration/ci.mgmt.yml + - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/guestconfiguration/ci.mgmt.yml + - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/guestconfiguration/ci.mgmt.yml + - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hardwaresecuritymodules/ci.mgmt.yml b/sdk/hardwaresecuritymodules/ci.mgmt.yml index 21778711f99e..ca1bb6451739 100644 --- a/sdk/hardwaresecuritymodules/ci.mgmt.yml +++ b/sdk/hardwaresecuritymodules/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/hardwaresecuritymodules/ci.mgmt.yml - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hardwaresecuritymodules/ci.mgmt.yml + - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hardwaresecuritymodules/ci.mgmt.yml + - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hardwaresecuritymodules/ci.mgmt.yml + - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hdinsight/ci.mgmt.yml b/sdk/hdinsight/ci.mgmt.yml index 4df0a02f5c80..8f2cfa6c25b6 100644 --- a/sdk/hdinsight/ci.mgmt.yml +++ b/sdk/hdinsight/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/hdinsight/ci.mgmt.yml - sdk/hdinsight/Azure.ResourceManager.HDInsight/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hdinsight/ci.mgmt.yml + - sdk/hdinsight/Azure.ResourceManager.HDInsight/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hdinsight/ci.mgmt.yml + - sdk/hdinsight/Azure.ResourceManager.HDInsight/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hdinsight/ci.mgmt.yml + - sdk/hdinsight/Azure.ResourceManager.HDInsight/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hdinsightcontainers/ci.mgmt.yml b/sdk/hdinsightcontainers/ci.mgmt.yml index 69a7566e0caa..9d3efe569486 100644 --- a/sdk/hdinsightcontainers/ci.mgmt.yml +++ b/sdk/hdinsightcontainers/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/hdinsightcontainers/ci.mgmt.yml - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hdinsightcontainers/ci.mgmt.yml + - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hdinsightcontainers/ci.mgmt.yml + - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hdinsightcontainers/ci.mgmt.yml + - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/healthbot/ci.mgmt.yml b/sdk/healthbot/ci.mgmt.yml index 14bfc7f855e6..bbd36df2145d 100644 --- a/sdk/healthbot/ci.mgmt.yml +++ b/sdk/healthbot/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/healthbot/ci.mgmt.yml - sdk/healthbot/Azure.ResourceManager.HealthBot/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthbot/ci.mgmt.yml + - sdk/healthbot/Azure.ResourceManager.HealthBot/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthbot/ci.mgmt.yml + - sdk/healthbot/Azure.ResourceManager.HealthBot/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthbot/ci.mgmt.yml + - sdk/healthbot/Azure.ResourceManager.HealthBot/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/healthcareapis/ci.mgmt.yml b/sdk/healthcareapis/ci.mgmt.yml index 57030df35e56..e19a8a966124 100644 --- a/sdk/healthcareapis/ci.mgmt.yml +++ b/sdk/healthcareapis/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/healthcareapis/ci.mgmt.yml - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthcareapis/ci.mgmt.yml + - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthcareapis/ci.mgmt.yml + - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthcareapis/ci.mgmt.yml + - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/healthdataaiservices/ci.mgmt.yml b/sdk/healthdataaiservices/ci.mgmt.yml index 016a917c1e19..6ee87763dca3 100644 --- a/sdk/healthdataaiservices/ci.mgmt.yml +++ b/sdk/healthdataaiservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/healthdataaiservices/ci.mgmt.yml - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthdataaiservices/ci.mgmt.yml + - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthdataaiservices/ci.mgmt.yml + - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthdataaiservices/ci.mgmt.yml + - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridaks/ci.mgmt.yml b/sdk/hybridaks/ci.mgmt.yml index 552eb3298d3a..22aa4961f780 100644 --- a/sdk/hybridaks/ci.mgmt.yml +++ b/sdk/hybridaks/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/hybridaks/ci.mgmt.yml - sdk/hybridaks/Azure.ResourceManager.HybridContainerService/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridaks/ci.mgmt.yml + - sdk/hybridaks/Azure.ResourceManager.HybridContainerService/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridaks/ci.mgmt.yml + - sdk/hybridaks/Azure.ResourceManager.HybridContainerService/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridaks/ci.mgmt.yml + - sdk/hybridaks/Azure.ResourceManager.HybridContainerService/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridcompute/ci.mgmt.yml b/sdk/hybridcompute/ci.mgmt.yml index d163a966512d..a7b9298ef946 100644 --- a/sdk/hybridcompute/ci.mgmt.yml +++ b/sdk/hybridcompute/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/hybridcompute/ci.mgmt.yml - sdk/hybridcompute/Azure.ResourceManager.HybridCompute/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridcompute/ci.mgmt.yml + - sdk/hybridcompute/Azure.ResourceManager.HybridCompute/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridcompute/ci.mgmt.yml + - sdk/hybridcompute/Azure.ResourceManager.HybridCompute/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridcompute/ci.mgmt.yml + - sdk/hybridcompute/Azure.ResourceManager.HybridCompute/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridconnectivity/ci.mgmt.yml b/sdk/hybridconnectivity/ci.mgmt.yml index 9ccca42ef557..17980d18b98d 100644 --- a/sdk/hybridconnectivity/ci.mgmt.yml +++ b/sdk/hybridconnectivity/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/hybridconnectivity/ci.mgmt.yml - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridconnectivity/ci.mgmt.yml + - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridconnectivity/ci.mgmt.yml + - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridconnectivity/ci.mgmt.yml + - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridkubernetes/ci.mgmt.yml b/sdk/hybridkubernetes/ci.mgmt.yml index fff768430c9d..c5ab2783c2d7 100644 --- a/sdk/hybridkubernetes/ci.mgmt.yml +++ b/sdk/hybridkubernetes/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/hybridkubernetes/ci.mgmt.yml - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridkubernetes/ci.mgmt.yml + - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridkubernetes/ci.mgmt.yml + - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridkubernetes/ci.mgmt.yml + - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridnetwork/ci.mgmt.yml b/sdk/hybridnetwork/ci.mgmt.yml index 35f71f8ae870..d7e92eda6f5a 100644 --- a/sdk/hybridnetwork/ci.mgmt.yml +++ b/sdk/hybridnetwork/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/hybridnetwork/ci.mgmt.yml - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridnetwork/ci.mgmt.yml + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridnetwork/ci.mgmt.yml + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridnetwork/ci.mgmt.yml + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/informaticadatamanagement/ci.mgmt.yml b/sdk/informaticadatamanagement/ci.mgmt.yml index 03013cc9c90b..cdab730e9b79 100644 --- a/sdk/informaticadatamanagement/ci.mgmt.yml +++ b/sdk/informaticadatamanagement/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/informaticadatamanagement/ci.mgmt.yml - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/informaticadatamanagement/ci.mgmt.yml + - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/informaticadatamanagement/ci.mgmt.yml + - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/informaticadatamanagement/ci.mgmt.yml + - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/iot/ci.mgmt.yml b/sdk/iot/ci.mgmt.yml index 6260cd0d71f2..3490622340e6 100644 --- a/sdk/iot/ci.mgmt.yml +++ b/sdk/iot/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/iot/ci.mgmt.yml - sdk/iot/Azure.ResourceManager.IotFirmwareDefense/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iot/ci.mgmt.yml + - sdk/iot/Azure.ResourceManager.IotFirmwareDefense/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iot/ci.mgmt.yml + - sdk/iot/Azure.ResourceManager.IotFirmwareDefense/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iot/ci.mgmt.yml + - sdk/iot/Azure.ResourceManager.IotFirmwareDefense/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/iotcentral/ci.mgmt.yml b/sdk/iotcentral/ci.mgmt.yml index 1702fd71c6dd..34220b2a885d 100644 --- a/sdk/iotcentral/ci.mgmt.yml +++ b/sdk/iotcentral/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/iotcentral/ci.mgmt.yml - sdk/iotcentral/Azure.ResourceManager.IotCentral/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iotcentral/ci.mgmt.yml + - sdk/iotcentral/Azure.ResourceManager.IotCentral/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iotcentral/ci.mgmt.yml + - sdk/iotcentral/Azure.ResourceManager.IotCentral/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iotcentral/ci.mgmt.yml + - sdk/iotcentral/Azure.ResourceManager.IotCentral/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/iothub/ci.mgmt.yml b/sdk/iothub/ci.mgmt.yml index 5eb9e999a89c..c896300a0604 100644 --- a/sdk/iothub/ci.mgmt.yml +++ b/sdk/iothub/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/iothub/ci.mgmt.yml - sdk/iothub/Azure.ResourceManager.IotHub/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iothub/ci.mgmt.yml + - sdk/iothub/Azure.ResourceManager.IotHub/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iothub/ci.mgmt.yml + - sdk/iothub/Azure.ResourceManager.IotHub/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iothub/ci.mgmt.yml + - sdk/iothub/Azure.ResourceManager.IotHub/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/Azure.ResourceManager.IoTOperations.sln b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/Azure.ResourceManager.IoTOperations.sln new file mode 100644 index 000000000000..3528878c41ce --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/Azure.ResourceManager.IoTOperations.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.IoTOperations", "src\Azure.ResourceManager.IoTOperations.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.IoTOperations.Tests", "tests\Azure.ResourceManager.IoTOperations.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/CHANGELOG.md b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/CHANGELOG.md new file mode 100644 index 000000000000..13dd08af78ab --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/Directory.Build.props b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/README.md b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/README.md new file mode 100644 index 000000000000..92abdc4c0f4c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/README.md @@ -0,0 +1,86 @@ +# Azure.ResourceManager.IoTOperations client library for .NET + +Azure.ResourceManager.IoTOperations is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.ResourceManager.IoTOperations --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/iotoperations/Azure.ResourceManager.IoTOperations/README.png) diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthenticationResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthenticationResource.cs new file mode 100644 index 000000000000..3c1967edca87 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthenticationResource.cs @@ -0,0 +1,209 @@ +// 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.Core; +using Azure.Identity; +using Azure.ResourceManager.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_BrokerAuthenticationResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_BrokerAuthenticationGet() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthenticationResource_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 BrokerAuthenticationResource created on azure + // for more information of creating BrokerAuthenticationResource, please refer to the document of BrokerAuthenticationResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string authenticationName = "resource-name123"; + ResourceIdentifier brokerAuthenticationResourceId = BrokerAuthenticationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName); + BrokerAuthenticationResource brokerAuthenticationResource = client.GetBrokerAuthenticationResource(brokerAuthenticationResourceId); + + // invoke the operation + BrokerAuthenticationResource result = await brokerAuthenticationResource.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 + BrokerAuthenticationResourceData 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_BrokerAuthenticationDelete() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthenticationResource_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 BrokerAuthenticationResource created on azure + // for more information of creating BrokerAuthenticationResource, please refer to the document of BrokerAuthenticationResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string authenticationName = "resource-name123"; + ResourceIdentifier brokerAuthenticationResourceId = BrokerAuthenticationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName); + BrokerAuthenticationResource brokerAuthenticationResource = client.GetBrokerAuthenticationResource(brokerAuthenticationResourceId); + + // invoke the operation + await brokerAuthenticationResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_BrokerAuthenticationCreateOrUpdateComplex() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_CreateOrUpdate_Complex.json + // this example is just showing the usage of "BrokerAuthenticationResource_CreateOrUpdate" 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 BrokerAuthenticationResource created on azure + // for more information of creating BrokerAuthenticationResource, please refer to the document of BrokerAuthenticationResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string authenticationName = "resource-name123"; + ResourceIdentifier brokerAuthenticationResourceId = BrokerAuthenticationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName); + BrokerAuthenticationResource brokerAuthenticationResource = client.GetBrokerAuthenticationResource(brokerAuthenticationResourceId); + + // invoke the operation + BrokerAuthenticationResourceData data = new BrokerAuthenticationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthenticationProperties(new BrokerAuthenticatorMethods[] + { +new BrokerAuthenticatorMethods(BrokerAuthenticationMethod.ServiceAccountToken) +{ +ServiceAccountTokenAudiences = {"aio-internal"}, +}, +new BrokerAuthenticatorMethods(BrokerAuthenticationMethod.X509) +{ +X509Settings = new BrokerAuthenticatorMethodX509 +{ +AuthorizationAttributes = +{ +["root"] = new BrokerAuthenticatorMethodX509Attributes(new Dictionary +{ +["organization"] = "contoso" +}, "CN = Contoso Root CA Cert, OU = Engineering, C = US"), +["intermediate"] = new BrokerAuthenticatorMethodX509Attributes(new Dictionary +{ +["city"] = "seattle", +["foo"] = "bar" +}, "CN = Contoso Intermediate CA"), +["smart-fan"] = new BrokerAuthenticatorMethodX509Attributes(new Dictionary +{ +["building"] = "17" +}, "CN = smart-fan") +}, +TrustedClientCaCert = "my-ca", +}, +} + }), + }; + ArmOperation lro = await brokerAuthenticationResource.UpdateAsync(WaitUntil.Completed, data); + BrokerAuthenticationResource 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 + BrokerAuthenticationResourceData 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 Update_BrokerAuthenticationCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthenticationResource_CreateOrUpdate" 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 BrokerAuthenticationResource created on azure + // for more information of creating BrokerAuthenticationResource, please refer to the document of BrokerAuthenticationResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string authenticationName = "resource-name123"; + ResourceIdentifier brokerAuthenticationResourceId = BrokerAuthenticationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName); + BrokerAuthenticationResource brokerAuthenticationResource = client.GetBrokerAuthenticationResource(brokerAuthenticationResourceId); + + // invoke the operation + BrokerAuthenticationResourceData data = new BrokerAuthenticationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthenticationProperties(new BrokerAuthenticatorMethods[] + { +new BrokerAuthenticatorMethods(BrokerAuthenticationMethod.Custom) +{ +CustomSettings = new BrokerAuthenticatorMethodCustom(new Uri("https://www.example.com")) +{ +X509SecretRef = "secret-name", +CaCertConfigMap = "pdecudefqyolvncbus", +Headers = +{ +["key8518"] = "bwityjy" +}, +}, +ServiceAccountTokenAudiences = {"jqyhyqatuydg"}, +X509Settings = new BrokerAuthenticatorMethodX509 +{ +AuthorizationAttributes = +{ +["key3384"] = new BrokerAuthenticatorMethodX509Attributes(new Dictionary +{ +["key186"] = "ucpajramsz" +}, "jpgwctfeixitptfgfnqhua") +}, +TrustedClientCaCert = "vlctsqddl", +}, +} + }), + }; + ArmOperation lro = await brokerAuthenticationResource.UpdateAsync(WaitUntil.Completed, data); + BrokerAuthenticationResource 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 + BrokerAuthenticationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthenticationResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthenticationResourceCollection.cs new file mode 100644 index 000000000000..ea03e1901a21 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthenticationResourceCollection.cs @@ -0,0 +1,301 @@ +// 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.Core; +using Azure.Identity; +using Azure.ResourceManager.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_BrokerAuthenticationResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_BrokerAuthenticationCreateOrUpdateComplex() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_CreateOrUpdate_Complex.json + // this example is just showing the usage of "BrokerAuthenticationResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthenticationResource + BrokerAuthenticationResourceCollection collection = brokerResource.GetBrokerAuthenticationResources(); + + // invoke the operation + string authenticationName = "resource-name123"; + BrokerAuthenticationResourceData data = new BrokerAuthenticationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthenticationProperties(new BrokerAuthenticatorMethods[] + { +new BrokerAuthenticatorMethods(BrokerAuthenticationMethod.ServiceAccountToken) +{ +ServiceAccountTokenAudiences = {"aio-internal"}, +}, +new BrokerAuthenticatorMethods(BrokerAuthenticationMethod.X509) +{ +X509Settings = new BrokerAuthenticatorMethodX509 +{ +AuthorizationAttributes = +{ +["root"] = new BrokerAuthenticatorMethodX509Attributes(new Dictionary +{ +["organization"] = "contoso" +}, "CN = Contoso Root CA Cert, OU = Engineering, C = US"), +["intermediate"] = new BrokerAuthenticatorMethodX509Attributes(new Dictionary +{ +["city"] = "seattle", +["foo"] = "bar" +}, "CN = Contoso Intermediate CA"), +["smart-fan"] = new BrokerAuthenticatorMethodX509Attributes(new Dictionary +{ +["building"] = "17" +}, "CN = smart-fan") +}, +TrustedClientCaCert = "my-ca", +}, +} + }), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authenticationName, data); + BrokerAuthenticationResource 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 + BrokerAuthenticationResourceData 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_BrokerAuthenticationCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthenticationResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthenticationResource + BrokerAuthenticationResourceCollection collection = brokerResource.GetBrokerAuthenticationResources(); + + // invoke the operation + string authenticationName = "resource-name123"; + BrokerAuthenticationResourceData data = new BrokerAuthenticationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthenticationProperties(new BrokerAuthenticatorMethods[] + { +new BrokerAuthenticatorMethods(BrokerAuthenticationMethod.Custom) +{ +CustomSettings = new BrokerAuthenticatorMethodCustom(new Uri("https://www.example.com")) +{ +X509SecretRef = "secret-name", +CaCertConfigMap = "pdecudefqyolvncbus", +Headers = +{ +["key8518"] = "bwityjy" +}, +}, +ServiceAccountTokenAudiences = {"jqyhyqatuydg"}, +X509Settings = new BrokerAuthenticatorMethodX509 +{ +AuthorizationAttributes = +{ +["key3384"] = new BrokerAuthenticatorMethodX509Attributes(new Dictionary +{ +["key186"] = "ucpajramsz" +}, "jpgwctfeixitptfgfnqhua") +}, +TrustedClientCaCert = "vlctsqddl", +}, +} + }), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authenticationName, data); + BrokerAuthenticationResource 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 + BrokerAuthenticationResourceData 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_BrokerAuthenticationGet() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthenticationResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthenticationResource + BrokerAuthenticationResourceCollection collection = brokerResource.GetBrokerAuthenticationResources(); + + // invoke the operation + string authenticationName = "resource-name123"; + BrokerAuthenticationResource result = await collection.GetAsync(authenticationName); + + // 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 + BrokerAuthenticationResourceData 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_BrokerAuthenticationListByResourceGroup() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthenticationResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthenticationResource + BrokerAuthenticationResourceCollection collection = brokerResource.GetBrokerAuthenticationResources(); + + // invoke the operation and iterate over the result + await foreach (BrokerAuthenticationResource 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 + BrokerAuthenticationResourceData 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_BrokerAuthenticationGet() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthenticationResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthenticationResource + BrokerAuthenticationResourceCollection collection = brokerResource.GetBrokerAuthenticationResources(); + + // invoke the operation + string authenticationName = "resource-name123"; + bool result = await collection.ExistsAsync(authenticationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_BrokerAuthenticationGet() + { + // Generated from example definition: 2024-11-01/BrokerAuthentication_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthenticationResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthenticationResource + BrokerAuthenticationResourceCollection collection = brokerResource.GetBrokerAuthenticationResources(); + + // invoke the operation + string authenticationName = "resource-name123"; + NullableResponse response = await collection.GetIfExistsAsync(authenticationName); + BrokerAuthenticationResource 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 + BrokerAuthenticationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthorizationResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthorizationResource.cs new file mode 100644 index 000000000000..2155febeb979 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthorizationResource.cs @@ -0,0 +1,266 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_BrokerAuthorizationResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_BrokerAuthorizationGet() + { + // Generated from example definition: 2024-11-01/BrokerAuthorization_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthorizationResource_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 BrokerAuthorizationResource created on azure + // for more information of creating BrokerAuthorizationResource, please refer to the document of BrokerAuthorizationResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string authorizationName = "resource-name123"; + ResourceIdentifier brokerAuthorizationResourceId = BrokerAuthorizationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName); + BrokerAuthorizationResource brokerAuthorizationResource = client.GetBrokerAuthorizationResource(brokerAuthorizationResourceId); + + // invoke the operation + BrokerAuthorizationResource result = await brokerAuthorizationResource.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 + BrokerAuthorizationResourceData 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_BrokerAuthorizationDelete() + { + // Generated from example definition: 2024-11-01/BrokerAuthorization_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthorizationResource_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 BrokerAuthorizationResource created on azure + // for more information of creating BrokerAuthorizationResource, please refer to the document of BrokerAuthorizationResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string authorizationName = "resource-name123"; + ResourceIdentifier brokerAuthorizationResourceId = BrokerAuthorizationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName); + BrokerAuthorizationResource brokerAuthorizationResource = client.GetBrokerAuthorizationResource(brokerAuthorizationResourceId); + + // invoke the operation + await brokerAuthorizationResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_BrokerAuthorizationCreateOrUpdateComplex() + { + // Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_Complex.json + // this example is just showing the usage of "BrokerAuthorizationResource_CreateOrUpdate" 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 BrokerAuthorizationResource created on azure + // for more information of creating BrokerAuthorizationResource, please refer to the document of BrokerAuthorizationResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string authorizationName = "resource-name123"; + ResourceIdentifier brokerAuthorizationResourceId = BrokerAuthorizationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName); + BrokerAuthorizationResource brokerAuthorizationResource = client.GetBrokerAuthorizationResource(brokerAuthorizationResourceId); + + // invoke the operation + BrokerAuthorizationResourceData data = new BrokerAuthorizationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthorizationProperties(new AuthorizationConfig + { + Cache = OperationalMode.Enabled, + Rules = {new AuthorizationRule(new BrokerResourceRule[] +{ +new BrokerResourceRule(BrokerResourceDefinitionMethod.Connect) +{ +ClientIds = {"{principal.attributes.building}*"}, +}, +new BrokerResourceRule(BrokerResourceDefinitionMethod.Publish) +{ +Topics = {"sensors/{principal.attributes.building}/{principal.clientId}/telemetry/*"}, +}, +new BrokerResourceRule(BrokerResourceDefinitionMethod.Subscribe) +{ +Topics = {"commands/{principal.attributes.organization}"}, +} +}, new PrincipalDefinition +{ +Attributes = { +{ +["building"] = "17", +["organization"] = "contoso" +}}, +Usernames = {"temperature-sensor", "humidity-sensor"}, +}) + { + StateStoreResources = { new StateStoreResourceRule(StateStoreResourceKeyType.Pattern, new string[] { "myreadkey", "myotherkey?", "mynumerickeysuffix[0-9]", "clients:{principal.clientId}:*" }, StateStoreResourceDefinitionMethod.Read), new StateStoreResourceRule(StateStoreResourceKeyType.Binary, new string[] { "MTE2IDEwMSAxMTUgMTE2" }, StateStoreResourceDefinitionMethod.ReadWrite) }, + } + }, + }), +}; + ArmOperation lro = await brokerAuthorizationResource.UpdateAsync(WaitUntil.Completed, data); + BrokerAuthorizationResource 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 + BrokerAuthorizationResourceData 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 Update_BrokerAuthorizationCreateOrUpdate() +{ + // Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthorizationResource_CreateOrUpdate" 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 + Azure.ResourceManager.ArmClient client = new Azure.ResourceManager.ArmClient(cred); + + // this example assumes you already have this BrokerAuthorizationResource created on azure + // for more information of creating BrokerAuthorizationResource, please refer to the document of BrokerAuthorizationResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string authorizationName = "resource-name123"; + ResourceIdentifier brokerAuthorizationResourceId = Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName); + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource brokerAuthorizationResource = client.GetBrokerAuthorizationResource(brokerAuthorizationResourceId); + + // invoke the operation + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData data = new Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthorizationProperties(new AuthorizationConfig + { + Cache = OperationalMode.Enabled, + Rules = {new AuthorizationRule(new BrokerResourceRule[] +{ +new BrokerResourceRule(BrokerResourceDefinitionMethod.Connect) +{ +ClientIds = {"nlc"}, +Topics = {"wvuca"}, +} +}, new PrincipalDefinition +{ +Attributes = { +{ +["key5526"] = "nydhzdhbldygqcn" +}}, +ClientIds = {"smopeaeddsygz"}, +Usernames = {"iozngyqndrteikszkbasinzdjtm"}, +}) + { + StateStoreResources = { new StateStoreResourceRule(StateStoreResourceKeyType.Pattern, new string[] { "tkounsqtwvzyaklxjqoerpu" }, StateStoreResourceDefinitionMethod.Read) }, + } + }, +}), +}; +Azure.ResourceManager.ArmOperation lro = await brokerAuthorizationResource.UpdateAsync(Azure.WaitUntil.Completed, data); +Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource 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 +Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData 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 Update_BrokerAuthorizationCreateOrUpdateSimple() +{ + // Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_Simple.json + // this example is just showing the usage of "BrokerAuthorizationResource_CreateOrUpdate" 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 + Azure.ResourceManager.ArmClient client = new Azure.ResourceManager.ArmClient(cred); + + // this example assumes you already have this BrokerAuthorizationResource created on azure + // for more information of creating BrokerAuthorizationResource, please refer to the document of BrokerAuthorizationResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string authorizationName = "resource-name123"; + ResourceIdentifier brokerAuthorizationResourceId = Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName); + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource brokerAuthorizationResource = client.GetBrokerAuthorizationResource(brokerAuthorizationResourceId); + + // invoke the operation + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData data = new Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthorizationProperties(new AuthorizationConfig + { + Cache = OperationalMode.Enabled, + Rules = {new AuthorizationRule(new BrokerResourceRule[] +{ +new BrokerResourceRule(BrokerResourceDefinitionMethod.Connect), +new BrokerResourceRule(BrokerResourceDefinitionMethod.Subscribe) +{ +Topics = {"topic", "topic/with/wildcard/#"}, +} +}, new PrincipalDefinition +{ +Attributes = { +{ +["floor"] = "floor1", +["site"] = "site1" +}}, +ClientIds = {"my-client-id"}, +}) + { + StateStoreResources = { new StateStoreResourceRule(StateStoreResourceKeyType.Pattern, new string[] { "*" }, StateStoreResourceDefinitionMethod.ReadWrite) }, + } + }, +}), +}; +Azure.ResourceManager.ArmOperation lro = await brokerAuthorizationResource.UpdateAsync(Azure.WaitUntil.Completed, data); +Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource 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 +Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData resourceData = result.Data; +// for demo we just print out the id +Console.WriteLine($"Succeeded on id: {resourceData.Id}"); +} +} +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthorizationResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthorizationResourceCollection.cs new file mode 100644 index 000000000000..51f9c6ef6f5a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerAuthorizationResourceCollection.cs @@ -0,0 +1,361 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_BrokerAuthorizationResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_BrokerAuthorizationCreateOrUpdateComplex() + { + // Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_Complex.json + // this example is just showing the usage of "BrokerAuthorizationResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthorizationResource + BrokerAuthorizationResourceCollection collection = brokerResource.GetBrokerAuthorizationResources(); + + // invoke the operation + string authorizationName = "resource-name123"; + BrokerAuthorizationResourceData data = new BrokerAuthorizationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthorizationProperties(new AuthorizationConfig + { + Cache = OperationalMode.Enabled, + Rules = {new AuthorizationRule(new BrokerResourceRule[] +{ +new BrokerResourceRule(BrokerResourceDefinitionMethod.Connect) +{ +ClientIds = {"{principal.attributes.building}*"}, +}, +new BrokerResourceRule(BrokerResourceDefinitionMethod.Publish) +{ +Topics = {"sensors/{principal.attributes.building}/{principal.clientId}/telemetry/*"}, +}, +new BrokerResourceRule(BrokerResourceDefinitionMethod.Subscribe) +{ +Topics = {"commands/{principal.attributes.organization}"}, +} +}, new PrincipalDefinition +{ +Attributes = { +{ +["building"] = "17", +["organization"] = "contoso" +}}, +Usernames = {"temperature-sensor", "humidity-sensor"}, +}) + { + StateStoreResources = { new StateStoreResourceRule(StateStoreResourceKeyType.Pattern, new string[] { "myreadkey", "myotherkey?", "mynumerickeysuffix[0-9]", "clients:{principal.clientId}:*" }, StateStoreResourceDefinitionMethod.Read), new StateStoreResourceRule(StateStoreResourceKeyType.Binary, new string[] { "MTE2IDEwMSAxMTUgMTE2" }, StateStoreResourceDefinitionMethod.ReadWrite) }, + } + }, + }), +}; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationName, data); + BrokerAuthorizationResource 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 + BrokerAuthorizationResourceData 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_BrokerAuthorizationCreateOrUpdate() +{ + // Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthorizationResource_CreateOrUpdate" 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 + Azure.ResourceManager.ArmClient client = new Azure.ResourceManager.ArmClient(cred); + + // this example assumes you already have this BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = Azure.ResourceManager.IoTOperations.BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + Azure.ResourceManager.IoTOperations.BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthorizationResource + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceCollection collection = brokerResource.GetBrokerAuthorizationResources(); + + // invoke the operation + string authorizationName = "resource-name123"; + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData data = new Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthorizationProperties(new AuthorizationConfig + { + Cache = OperationalMode.Enabled, + Rules = {new AuthorizationRule(new BrokerResourceRule[] +{ +new BrokerResourceRule(BrokerResourceDefinitionMethod.Connect) +{ +ClientIds = {"nlc"}, +Topics = {"wvuca"}, +} +}, new PrincipalDefinition +{ +Attributes = { +{ +["key5526"] = "nydhzdhbldygqcn" +}}, +ClientIds = {"smopeaeddsygz"}, +Usernames = {"iozngyqndrteikszkbasinzdjtm"}, +}) + { + StateStoreResources = { new StateStoreResourceRule(StateStoreResourceKeyType.Pattern, new string[] { "tkounsqtwvzyaklxjqoerpu" }, StateStoreResourceDefinitionMethod.Read) }, + } + }, +}), +}; +Azure.ResourceManager.ArmOperation lro = await collection.CreateOrUpdateAsync(Azure.WaitUntil.Completed, authorizationName, data); +Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource 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 +Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData 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_BrokerAuthorizationCreateOrUpdateSimple() +{ + // Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_Simple.json + // this example is just showing the usage of "BrokerAuthorizationResource_CreateOrUpdate" 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 + Azure.ResourceManager.ArmClient client = new Azure.ResourceManager.ArmClient(cred); + + // this example assumes you already have this BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = Azure.ResourceManager.IoTOperations.BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + Azure.ResourceManager.IoTOperations.BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthorizationResource + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceCollection collection = brokerResource.GetBrokerAuthorizationResources(); + + // invoke the operation + string authorizationName = "resource-name123"; + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData data = new Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerAuthorizationProperties(new AuthorizationConfig + { + Cache = OperationalMode.Enabled, + Rules = {new AuthorizationRule(new BrokerResourceRule[] +{ +new BrokerResourceRule(BrokerResourceDefinitionMethod.Connect), +new BrokerResourceRule(BrokerResourceDefinitionMethod.Subscribe) +{ +Topics = {"topic", "topic/with/wildcard/#"}, +} +}, new PrincipalDefinition +{ +Attributes = { +{ +["floor"] = "floor1", +["site"] = "site1" +}}, +ClientIds = {"my-client-id"}, +}) + { + StateStoreResources = { new StateStoreResourceRule(StateStoreResourceKeyType.Pattern, new string[] { "*" }, StateStoreResourceDefinitionMethod.ReadWrite) }, + } + }, +}), +}; +Azure.ResourceManager.ArmOperation lro = await collection.CreateOrUpdateAsync(Azure.WaitUntil.Completed, authorizationName, data); +Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource 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 +Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData 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_BrokerAuthorizationGet() +{ + // Generated from example definition: 2024-11-01/BrokerAuthorization_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthorizationResource_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 + Azure.ResourceManager.ArmClient client = new Azure.ResourceManager.ArmClient(cred); + + // this example assumes you already have this BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = Azure.ResourceManager.IoTOperations.BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + Azure.ResourceManager.IoTOperations.BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthorizationResource + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceCollection collection = brokerResource.GetBrokerAuthorizationResources(); + + // invoke the operation + string authorizationName = "resource-name123"; + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource result = await collection.GetAsync(authorizationName); + + // 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 + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData 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_BrokerAuthorizationListByResourceGroup() +{ + // Generated from example definition: 2024-11-01/BrokerAuthorization_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthorizationResource_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 + Azure.ResourceManager.ArmClient client = new Azure.ResourceManager.ArmClient(cred); + + // this example assumes you already have this BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = Azure.ResourceManager.IoTOperations.BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + Azure.ResourceManager.IoTOperations.BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthorizationResource + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceCollection collection = brokerResource.GetBrokerAuthorizationResources(); + + // invoke the operation and iterate over the result + await foreach (Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource 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 + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData 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_BrokerAuthorizationGet() +{ + // Generated from example definition: 2024-11-01/BrokerAuthorization_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthorizationResource_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 + Azure.ResourceManager.ArmClient client = new Azure.ResourceManager.ArmClient(cred); + + // this example assumes you already have this BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = Azure.ResourceManager.IoTOperations.BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + Azure.ResourceManager.IoTOperations.BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthorizationResource + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceCollection collection = brokerResource.GetBrokerAuthorizationResources(); + + // invoke the operation + string authorizationName = "resource-name123"; + bool result = await collection.ExistsAsync(authorizationName); + + Console.WriteLine($"Succeeded: {result}"); +} + +[Test] +[Ignore("Only validating compilation of examples")] +public async Task GetIfExists_BrokerAuthorizationGet() +{ + // Generated from example definition: 2024-11-01/BrokerAuthorization_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerAuthorizationResource_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 + Azure.ResourceManager.ArmClient client = new Azure.ResourceManager.ArmClient(cred); + + // this example assumes you already have this BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = Azure.ResourceManager.IoTOperations.BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + Azure.ResourceManager.IoTOperations.BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerAuthorizationResource + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceCollection collection = brokerResource.GetBrokerAuthorizationResources(); + + // invoke the operation + string authorizationName = "resource-name123"; + Azure.NullableResponse response = await collection.GetIfExistsAsync(authorizationName); + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResource 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 + Azure.ResourceManager.IoTOperations.BrokerAuthorizationResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } +} +} +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerListenerResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerListenerResource.cs new file mode 100644 index 000000000000..52405ffd98a3 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerListenerResource.cs @@ -0,0 +1,249 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_BrokerListenerResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_BrokerListenerGet() + { + // Generated from example definition: 2024-11-01/BrokerListener_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerListenerResource_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 BrokerListenerResource created on azure + // for more information of creating BrokerListenerResource, please refer to the document of BrokerListenerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string listenerName = "resource-name123"; + ResourceIdentifier brokerListenerResourceId = BrokerListenerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName); + BrokerListenerResource brokerListenerResource = client.GetBrokerListenerResource(brokerListenerResourceId); + + // invoke the operation + BrokerListenerResource result = await brokerListenerResource.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 + BrokerListenerResourceData 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_BrokerListenerDelete() + { + // Generated from example definition: 2024-11-01/BrokerListener_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerListenerResource_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 BrokerListenerResource created on azure + // for more information of creating BrokerListenerResource, please refer to the document of BrokerListenerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string listenerName = "resource-name123"; + ResourceIdentifier brokerListenerResourceId = BrokerListenerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName); + BrokerListenerResource brokerListenerResource = client.GetBrokerListenerResource(brokerListenerResourceId); + + // invoke the operation + await brokerListenerResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_BrokerListenerCreateOrUpdateComplex() + { + // Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Complex.json + // this example is just showing the usage of "BrokerListenerResource_CreateOrUpdate" 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 BrokerListenerResource created on azure + // for more information of creating BrokerListenerResource, please refer to the document of BrokerListenerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string listenerName = "resource-name123"; + ResourceIdentifier brokerListenerResourceId = BrokerListenerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName); + BrokerListenerResource brokerListenerResource = client.GetBrokerListenerResource(brokerListenerResourceId); + + // invoke the operation + BrokerListenerResourceData data = new BrokerListenerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerListenerProperties(new ListenerPort[] + { +new ListenerPort(8080) +{ +AuthenticationRef = "example-authentication", +Protocol = BrokerProtocolType.WebSockets, +}, +new ListenerPort(8443) +{ +AuthenticationRef = "example-authentication", +Protocol = BrokerProtocolType.WebSockets, +Tls = new TlsCertMethod(TlsCertMethodMode.Automatic) +{ +CertManagerCertificateSpec = new CertManagerCertificateSpec(new CertManagerIssuerRef("jtmuladdkpasfpoyvewekmiy", CertManagerIssuerKind.Issuer, "example-issuer")), +}, +}, +new ListenerPort(1883) +{ +AuthenticationRef = "example-authentication", +}, +new ListenerPort(8883) +{ +AuthenticationRef = "example-authentication", +Tls = new TlsCertMethod(TlsCertMethodMode.Manual) +{ +ManualSecretRef = "example-secret", +}, +} + }) + { + ServiceType = ServiceType.LoadBalancer, + }, + }; + ArmOperation lro = await brokerListenerResource.UpdateAsync(WaitUntil.Completed, data); + BrokerListenerResource 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 + BrokerListenerResourceData 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 Update_BrokerListenerCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerListenerResource_CreateOrUpdate" 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 BrokerListenerResource created on azure + // for more information of creating BrokerListenerResource, please refer to the document of BrokerListenerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string listenerName = "resource-name123"; + ResourceIdentifier brokerListenerResourceId = BrokerListenerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName); + BrokerListenerResource brokerListenerResource = client.GetBrokerListenerResource(brokerListenerResourceId); + + // invoke the operation + BrokerListenerResourceData data = new BrokerListenerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerListenerProperties(new ListenerPort[] + { +new ListenerPort(1268) +{ +AuthenticationRef = "tjvdroaqqy", +AuthorizationRef = "inxhvxnwswyrvt", +NodePort = 7281, +Protocol = BrokerProtocolType.Mqtt, +Tls = new TlsCertMethod(TlsCertMethodMode.Automatic) +{ +CertManagerCertificateSpec = new CertManagerCertificateSpec(new CertManagerIssuerRef("jtmuladdkpasfpoyvewekmiy", CertManagerIssuerKind.Issuer, "ocwoqpgucvjrsuudtjhb")) +{ +Duration = "qmpeffoksron", +SecretName = "oagi", +RenewBefore = "hutno", +PrivateKey = new CertManagerPrivateKey(PrivateKeyAlgorithm.Ec256, PrivateKeyRotationPolicy.Always), +San = new SanForCert(new string[]{"xhvmhrrhgfsapocjeebqtnzarlj"}, new string[]{"zbgugfzcgsmegevzktsnibyuyp"}), +}, +ManualSecretRef = "secret-name", +}, +} + }) + { + ServiceName = "tpfiszlapdpxktx", + ServiceType = ServiceType.ClusterIP, + }, + }; + ArmOperation lro = await brokerListenerResource.UpdateAsync(WaitUntil.Completed, data); + BrokerListenerResource 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 + BrokerListenerResourceData 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 Update_BrokerListenerCreateOrUpdateSimple() + { + // Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Simple.json + // this example is just showing the usage of "BrokerListenerResource_CreateOrUpdate" 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 BrokerListenerResource created on azure + // for more information of creating BrokerListenerResource, please refer to the document of BrokerListenerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + string listenerName = "resource-name123"; + ResourceIdentifier brokerListenerResourceId = BrokerListenerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName); + BrokerListenerResource brokerListenerResource = client.GetBrokerListenerResource(brokerListenerResourceId); + + // invoke the operation + BrokerListenerResourceData data = new BrokerListenerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerListenerProperties(new ListenerPort[] + { +new ListenerPort(1883) + }), + }; + ArmOperation lro = await brokerListenerResource.UpdateAsync(WaitUntil.Completed, data); + BrokerListenerResource 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 + BrokerListenerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerListenerResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerListenerResourceCollection.cs new file mode 100644 index 000000000000..9f78d8b1c2f5 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerListenerResourceCollection.cs @@ -0,0 +1,344 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_BrokerListenerResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_BrokerListenerCreateOrUpdateComplex() + { + // Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Complex.json + // this example is just showing the usage of "BrokerListenerResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerListenerResource + BrokerListenerResourceCollection collection = brokerResource.GetBrokerListenerResources(); + + // invoke the operation + string listenerName = "resource-name123"; + BrokerListenerResourceData data = new BrokerListenerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerListenerProperties(new ListenerPort[] + { +new ListenerPort(8080) +{ +AuthenticationRef = "example-authentication", +Protocol = BrokerProtocolType.WebSockets, +}, +new ListenerPort(8443) +{ +AuthenticationRef = "example-authentication", +Protocol = BrokerProtocolType.WebSockets, +Tls = new TlsCertMethod(TlsCertMethodMode.Automatic) +{ +CertManagerCertificateSpec = new CertManagerCertificateSpec(new CertManagerIssuerRef("jtmuladdkpasfpoyvewekmiy", CertManagerIssuerKind.Issuer, "example-issuer")), +}, +}, +new ListenerPort(1883) +{ +AuthenticationRef = "example-authentication", +}, +new ListenerPort(8883) +{ +AuthenticationRef = "example-authentication", +Tls = new TlsCertMethod(TlsCertMethodMode.Manual) +{ +ManualSecretRef = "example-secret", +}, +} + }) + { + ServiceType = ServiceType.LoadBalancer, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, listenerName, data); + BrokerListenerResource 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 + BrokerListenerResourceData 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_BrokerListenerCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerListenerResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerListenerResource + BrokerListenerResourceCollection collection = brokerResource.GetBrokerListenerResources(); + + // invoke the operation + string listenerName = "resource-name123"; + BrokerListenerResourceData data = new BrokerListenerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerListenerProperties(new ListenerPort[] + { +new ListenerPort(1268) +{ +AuthenticationRef = "tjvdroaqqy", +AuthorizationRef = "inxhvxnwswyrvt", +NodePort = 7281, +Protocol = BrokerProtocolType.Mqtt, +Tls = new TlsCertMethod(TlsCertMethodMode.Automatic) +{ +CertManagerCertificateSpec = new CertManagerCertificateSpec(new CertManagerIssuerRef("jtmuladdkpasfpoyvewekmiy", CertManagerIssuerKind.Issuer, "ocwoqpgucvjrsuudtjhb")) +{ +Duration = "qmpeffoksron", +SecretName = "oagi", +RenewBefore = "hutno", +PrivateKey = new CertManagerPrivateKey(PrivateKeyAlgorithm.Ec256, PrivateKeyRotationPolicy.Always), +San = new SanForCert(new string[]{"xhvmhrrhgfsapocjeebqtnzarlj"}, new string[]{"zbgugfzcgsmegevzktsnibyuyp"}), +}, +ManualSecretRef = "secret-name", +}, +} + }) + { + ServiceName = "tpfiszlapdpxktx", + ServiceType = ServiceType.ClusterIP, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, listenerName, data); + BrokerListenerResource 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 + BrokerListenerResourceData 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_BrokerListenerCreateOrUpdateSimple() + { + // Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Simple.json + // this example is just showing the usage of "BrokerListenerResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerListenerResource + BrokerListenerResourceCollection collection = brokerResource.GetBrokerListenerResources(); + + // invoke the operation + string listenerName = "resource-name123"; + BrokerListenerResourceData data = new BrokerListenerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerListenerProperties(new ListenerPort[] + { +new ListenerPort(1883) + }), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, listenerName, data); + BrokerListenerResource 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 + BrokerListenerResourceData 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_BrokerListenerGet() + { + // Generated from example definition: 2024-11-01/BrokerListener_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerListenerResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerListenerResource + BrokerListenerResourceCollection collection = brokerResource.GetBrokerListenerResources(); + + // invoke the operation + string listenerName = "resource-name123"; + BrokerListenerResource result = await collection.GetAsync(listenerName); + + // 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 + BrokerListenerResourceData 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_BrokerListenerListByResourceGroup() + { + // Generated from example definition: 2024-11-01/BrokerListener_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerListenerResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerListenerResource + BrokerListenerResourceCollection collection = brokerResource.GetBrokerListenerResources(); + + // invoke the operation and iterate over the result + await foreach (BrokerListenerResource 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 + BrokerListenerResourceData 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_BrokerListenerGet() + { + // Generated from example definition: 2024-11-01/BrokerListener_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerListenerResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerListenerResource + BrokerListenerResourceCollection collection = brokerResource.GetBrokerListenerResources(); + + // invoke the operation + string listenerName = "resource-name123"; + bool result = await collection.ExistsAsync(listenerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_BrokerListenerGet() + { + // Generated from example definition: 2024-11-01/BrokerListener_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerListenerResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // get the collection of this BrokerListenerResource + BrokerListenerResourceCollection collection = brokerResource.GetBrokerListenerResources(); + + // invoke the operation + string listenerName = "resource-name123"; + NullableResponse response = await collection.GetIfExistsAsync(listenerName); + BrokerListenerResource 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 + BrokerListenerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerResource.cs new file mode 100644 index 000000000000..a8655a9335b4 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerResource.cs @@ -0,0 +1,377 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_BrokerResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_BrokerGet() + { + // Generated from example definition: 2024-11-01/Broker_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // invoke the operation + BrokerResource result = await brokerResource.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 + BrokerResourceData 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_BrokerDelete() + { + // Generated from example definition: 2024-11-01/Broker_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerResource_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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // invoke the operation + await brokerResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_BrokerCreateOrUpdateComplex() + { + // Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_Complex.json + // this example is just showing the usage of "BrokerResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // invoke the operation + BrokerResourceData data = new BrokerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerProperties + { + Cardinality = new Cardinality(new BackendChain(2, 2) + { + Workers = 2, + }, new Frontend(2) + { + Workers = 2, + }), + DiskBackedMessageBuffer = new DiskBackedMessageBuffer("50M"), + GenerateResourceLimitsCpu = OperationalMode.Enabled, + MemoryProfile = BrokerMemoryProfile.Medium, + }, + }; + ArmOperation lro = await brokerResource.UpdateAsync(WaitUntil.Completed, data); + BrokerResource 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 + BrokerResourceData 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 Update_BrokerCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // invoke the operation + BrokerResourceData data = new BrokerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerProperties + { + Advanced = new AdvancedSettings + { + Clients = new ClientConfig + { + MaxSessionExpirySeconds = 3859, + MaxMessageExpirySeconds = 3263, + MaxPacketSizeBytes = 3029, + SubscriberQueueLimit = new SubscriberQueueLimit + { + Length = 6L, + Strategy = SubscriberMessageDropStrategy.None, + }, + MaxReceiveMaximum = 2365, + MaxKeepAliveSeconds = 3744, + }, + EncryptInternalTraffic = OperationalMode.Enabled, + InternalCerts = new CertManagerCertOptions("bchrc", "xkafmpgjfifkwwrhkswtopdnne", new CertManagerPrivateKey(PrivateKeyAlgorithm.Ec256, PrivateKeyRotationPolicy.Always)), + }, + Cardinality = new Cardinality(new BackendChain(11, 5) + { + Workers = 15, + }, new Frontend(2) + { + Workers = 6, + }), + Diagnostics = new BrokerDiagnostics + { + LogsLevel = "rnmwokumdmebpmfxxxzvvjfdywotav", + MetricsPrometheusPort = 7581, + SelfCheck = new SelfCheck + { + Mode = OperationalMode.Enabled, + IntervalSeconds = 158, + TimeoutSeconds = 14, + }, + Traces = new Traces + { + Mode = OperationalMode.Enabled, + CacheSizeMegabytes = 28, + SelfTracing = new SelfTracing + { + Mode = OperationalMode.Enabled, + IntervalSeconds = 22, + }, + SpanChannelCapacity = 1000, + }, + }, + DiskBackedMessageBuffer = new DiskBackedMessageBuffer("500M") + { + EphemeralVolumeClaimSpec = new VolumeClaimSpec + { + VolumeName = "c", + VolumeMode = "rxvpksjuuugqnqzeiprocknbn", + StorageClassName = "sseyhrjptkhrqvpdpjmornkqvon", + AccessModes = { "nuluhigrbb" }, + DataSource = new LocalKubernetesReference("wazgyb", "cwhsgxxcxsyppoefm") + { + ApiGroup = "npqapyksvvpkohujx", + }, + DataSourceRef = new KubernetesReference("odynqzekfzsnawrctaxg", "envszivbbmixbyddzg") + { + ApiGroup = "mnfnykznjjsoqpfsgdqioupt", + Namespace = "etcfzvxqd", + }, + Resources = new VolumeClaimResourceRequirements + { + Limits = +{ +["key2719"] = "hmphcrgctu" +}, + Requests = +{ +["key2909"] = "txocprnyrsgvhfrg" +}, + }, + Selector = new VolumeClaimSpecSelector + { + MatchExpressions = {new VolumeClaimSpecSelectorMatchExpressions("e", OperatorValue.In) +{ +Values = {"slmpajlywqvuyknipgztsonqyybt"}, +}}, + MatchLabels = +{ +["key6673"] = "wlngfalznwxnurzpgxomcxhbqefpr" +}, + }, + }, + PersistentVolumeClaimSpec = new VolumeClaimSpec + { + VolumeName = "c", + VolumeMode = "rxvpksjuuugqnqzeiprocknbn", + StorageClassName = "sseyhrjptkhrqvpdpjmornkqvon", + AccessModes = { "nuluhigrbb" }, + DataSource = new LocalKubernetesReference("wazgyb", "cwhsgxxcxsyppoefm") + { + ApiGroup = "npqapyksvvpkohujx", + }, + DataSourceRef = new KubernetesReference("odynqzekfzsnawrctaxg", "envszivbbmixbyddzg") + { + ApiGroup = "mnfnykznjjsoqpfsgdqioupt", + Namespace = "etcfzvxqd", + }, + Resources = new VolumeClaimResourceRequirements + { + Limits = +{ +["key2719"] = "hmphcrgctu" +}, + Requests = +{ +["key2909"] = "txocprnyrsgvhfrg" +}, + }, + Selector = new VolumeClaimSpecSelector + { + MatchExpressions = {new VolumeClaimSpecSelectorMatchExpressions("e", OperatorValue.In) +{ +Values = {"slmpajlywqvuyknipgztsonqyybt"}, +}}, + MatchLabels = +{ +["key6673"] = "wlngfalznwxnurzpgxomcxhbqefpr" +}, + }, + }, + }, + GenerateResourceLimitsCpu = OperationalMode.Enabled, + MemoryProfile = BrokerMemoryProfile.Tiny, + }, + }; + ArmOperation lro = await brokerResource.UpdateAsync(WaitUntil.Completed, data); + BrokerResource 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 + BrokerResourceData 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 Update_BrokerCreateOrUpdateMinimal() + { + // Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_Minimal.json + // this example is just showing the usage of "BrokerResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // invoke the operation + BrokerResourceData data = new BrokerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerProperties + { + MemoryProfile = BrokerMemoryProfile.Tiny, + }, + }; + ArmOperation lro = await brokerResource.UpdateAsync(WaitUntil.Completed, data); + BrokerResource 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 + BrokerResourceData 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 Update_BrokerCreateOrUpdateSimple() + { + // Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_Simple.json + // this example is just showing the usage of "BrokerResource_CreateOrUpdate" 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 BrokerResource created on azure + // for more information of creating BrokerResource, please refer to the document of BrokerResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string brokerName = "resource-name123"; + ResourceIdentifier brokerResourceId = BrokerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, brokerName); + BrokerResource brokerResource = client.GetBrokerResource(brokerResourceId); + + // invoke the operation + BrokerResourceData data = new BrokerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerProperties + { + Cardinality = new Cardinality(new BackendChain(2, 2) + { + Workers = 2, + }, new Frontend(2) + { + Workers = 2, + }), + GenerateResourceLimitsCpu = OperationalMode.Enabled, + MemoryProfile = BrokerMemoryProfile.Low, + }, + }; + ArmOperation lro = await brokerResource.UpdateAsync(WaitUntil.Completed, data); + BrokerResource 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 + BrokerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerResourceCollection.cs new file mode 100644 index 000000000000..2f97e8785a88 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_BrokerResourceCollection.cs @@ -0,0 +1,473 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_BrokerResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_BrokerCreateOrUpdateComplex() + { + // Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_Complex.json + // this example is just showing the usage of "BrokerResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this BrokerResource + BrokerResourceCollection collection = instanceResource.GetBrokerResources(); + + // invoke the operation + string brokerName = "resource-name123"; + BrokerResourceData data = new BrokerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerProperties + { + Cardinality = new Cardinality(new BackendChain(2, 2) + { + Workers = 2, + }, new Frontend(2) + { + Workers = 2, + }), + DiskBackedMessageBuffer = new DiskBackedMessageBuffer("50M"), + GenerateResourceLimitsCpu = OperationalMode.Enabled, + MemoryProfile = BrokerMemoryProfile.Medium, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, brokerName, data); + BrokerResource 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 + BrokerResourceData 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_BrokerCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this BrokerResource + BrokerResourceCollection collection = instanceResource.GetBrokerResources(); + + // invoke the operation + string brokerName = "resource-name123"; + BrokerResourceData data = new BrokerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerProperties + { + Advanced = new AdvancedSettings + { + Clients = new ClientConfig + { + MaxSessionExpirySeconds = 3859, + MaxMessageExpirySeconds = 3263, + MaxPacketSizeBytes = 3029, + SubscriberQueueLimit = new SubscriberQueueLimit + { + Length = 6L, + Strategy = SubscriberMessageDropStrategy.None, + }, + MaxReceiveMaximum = 2365, + MaxKeepAliveSeconds = 3744, + }, + EncryptInternalTraffic = OperationalMode.Enabled, + InternalCerts = new CertManagerCertOptions("bchrc", "xkafmpgjfifkwwrhkswtopdnne", new CertManagerPrivateKey(PrivateKeyAlgorithm.Ec256, PrivateKeyRotationPolicy.Always)), + }, + Cardinality = new Cardinality(new BackendChain(11, 5) + { + Workers = 15, + }, new Frontend(2) + { + Workers = 6, + }), + Diagnostics = new BrokerDiagnostics + { + LogsLevel = "rnmwokumdmebpmfxxxzvvjfdywotav", + MetricsPrometheusPort = 7581, + SelfCheck = new SelfCheck + { + Mode = OperationalMode.Enabled, + IntervalSeconds = 158, + TimeoutSeconds = 14, + }, + Traces = new Traces + { + Mode = OperationalMode.Enabled, + CacheSizeMegabytes = 28, + SelfTracing = new SelfTracing + { + Mode = OperationalMode.Enabled, + IntervalSeconds = 22, + }, + SpanChannelCapacity = 1000, + }, + }, + DiskBackedMessageBuffer = new DiskBackedMessageBuffer("500M") + { + EphemeralVolumeClaimSpec = new VolumeClaimSpec + { + VolumeName = "c", + VolumeMode = "rxvpksjuuugqnqzeiprocknbn", + StorageClassName = "sseyhrjptkhrqvpdpjmornkqvon", + AccessModes = { "nuluhigrbb" }, + DataSource = new LocalKubernetesReference("wazgyb", "cwhsgxxcxsyppoefm") + { + ApiGroup = "npqapyksvvpkohujx", + }, + DataSourceRef = new KubernetesReference("odynqzekfzsnawrctaxg", "envszivbbmixbyddzg") + { + ApiGroup = "mnfnykznjjsoqpfsgdqioupt", + Namespace = "etcfzvxqd", + }, + Resources = new VolumeClaimResourceRequirements + { + Limits = +{ +["key2719"] = "hmphcrgctu" +}, + Requests = +{ +["key2909"] = "txocprnyrsgvhfrg" +}, + }, + Selector = new VolumeClaimSpecSelector + { + MatchExpressions = {new VolumeClaimSpecSelectorMatchExpressions("e", OperatorValue.In) +{ +Values = {"slmpajlywqvuyknipgztsonqyybt"}, +}}, + MatchLabels = +{ +["key6673"] = "wlngfalznwxnurzpgxomcxhbqefpr" +}, + }, + }, + PersistentVolumeClaimSpec = new VolumeClaimSpec + { + VolumeName = "c", + VolumeMode = "rxvpksjuuugqnqzeiprocknbn", + StorageClassName = "sseyhrjptkhrqvpdpjmornkqvon", + AccessModes = { "nuluhigrbb" }, + DataSource = new LocalKubernetesReference("wazgyb", "cwhsgxxcxsyppoefm") + { + ApiGroup = "npqapyksvvpkohujx", + }, + DataSourceRef = new KubernetesReference("odynqzekfzsnawrctaxg", "envszivbbmixbyddzg") + { + ApiGroup = "mnfnykznjjsoqpfsgdqioupt", + Namespace = "etcfzvxqd", + }, + Resources = new VolumeClaimResourceRequirements + { + Limits = +{ +["key2719"] = "hmphcrgctu" +}, + Requests = +{ +["key2909"] = "txocprnyrsgvhfrg" +}, + }, + Selector = new VolumeClaimSpecSelector + { + MatchExpressions = {new VolumeClaimSpecSelectorMatchExpressions("e", OperatorValue.In) +{ +Values = {"slmpajlywqvuyknipgztsonqyybt"}, +}}, + MatchLabels = +{ +["key6673"] = "wlngfalznwxnurzpgxomcxhbqefpr" +}, + }, + }, + }, + GenerateResourceLimitsCpu = OperationalMode.Enabled, + MemoryProfile = BrokerMemoryProfile.Tiny, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, brokerName, data); + BrokerResource 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 + BrokerResourceData 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_BrokerCreateOrUpdateMinimal() + { + // Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_Minimal.json + // this example is just showing the usage of "BrokerResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this BrokerResource + BrokerResourceCollection collection = instanceResource.GetBrokerResources(); + + // invoke the operation + string brokerName = "resource-name123"; + BrokerResourceData data = new BrokerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerProperties + { + MemoryProfile = BrokerMemoryProfile.Tiny, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, brokerName, data); + BrokerResource 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 + BrokerResourceData 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_BrokerCreateOrUpdateSimple() + { + // Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_Simple.json + // this example is just showing the usage of "BrokerResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this BrokerResource + BrokerResourceCollection collection = instanceResource.GetBrokerResources(); + + // invoke the operation + string brokerName = "resource-name123"; + BrokerResourceData data = new BrokerResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new BrokerProperties + { + Cardinality = new Cardinality(new BackendChain(2, 2) + { + Workers = 2, + }, new Frontend(2) + { + Workers = 2, + }), + GenerateResourceLimitsCpu = OperationalMode.Enabled, + MemoryProfile = BrokerMemoryProfile.Low, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, brokerName, data); + BrokerResource 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 + BrokerResourceData 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_BrokerGet() + { + // Generated from example definition: 2024-11-01/Broker_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this BrokerResource + BrokerResourceCollection collection = instanceResource.GetBrokerResources(); + + // invoke the operation + string brokerName = "resource-name123"; + BrokerResource result = await collection.GetAsync(brokerName); + + // 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 + BrokerResourceData 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_BrokerListByResourceGroup() + { + // Generated from example definition: 2024-11-01/Broker_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this BrokerResource + BrokerResourceCollection collection = instanceResource.GetBrokerResources(); + + // invoke the operation and iterate over the result + await foreach (BrokerResource 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 + BrokerResourceData 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_BrokerGet() + { + // Generated from example definition: 2024-11-01/Broker_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this BrokerResource + BrokerResourceCollection collection = instanceResource.GetBrokerResources(); + + // invoke the operation + string brokerName = "resource-name123"; + bool result = await collection.ExistsAsync(brokerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_BrokerGet() + { + // Generated from example definition: 2024-11-01/Broker_Get_MaximumSet_Gen.json + // this example is just showing the usage of "BrokerResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this BrokerResource + BrokerResourceCollection collection = instanceResource.GetBrokerResources(); + + // invoke the operation + string brokerName = "resource-name123"; + NullableResponse response = await collection.GetIfExistsAsync(brokerName); + BrokerResource 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 + BrokerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowEndpointResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowEndpointResource.cs new file mode 100644 index 000000000000..8208963516f3 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowEndpointResource.cs @@ -0,0 +1,642 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_DataflowEndpointResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_DataflowEndpointGet() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowEndpointResource_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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "resource-name123"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResource result = await dataflowEndpointResource.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 + DataflowEndpointResourceData 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_DataflowEndpointDelete() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowEndpointResource_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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "resource-name123"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + await dataflowEndpointResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_DataflowEndpointCreateOrUpdateADLSv2() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_ADLSv2.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "adlsv2-endpoint"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.DataLakeStorage) + { + DataLakeStorageSettings = new DataflowEndpointDataLakeStorage(new DataflowEndpointDataLakeStorageAuthentication(DataLakeStorageAuthMethod.AccessToken) + { + AccessTokenSecretRef = "my-secret", + }, "example.blob.core.windows.net"), + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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 Update_DataflowEndpointCreateOrUpdateADX() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_ADX.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "adx-endpoint"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.DataExplorer) + { + DataExplorerSettings = new DataflowEndpointDataExplorer(new DataflowEndpointDataExplorerAuthentication(DataExplorerAuthMethod.SystemAssignedManagedIdentity), "example-database", "example.westeurope.kusto.windows.net") + { + Batching = new BatchingConfiguration + { + LatencySeconds = 9312, + MaxMessages = 9028, + }, + }, + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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 Update_DataflowEndpointCreateOrUpdateAIO() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_AIO.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "aio-builtin-broker-endpoint"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Mqtt) + { + MqttSettings = new DataflowEndpointMqtt(new DataflowEndpointMqttAuthentication(default) + { + ServiceAccountTokenAudience = "aio-internal", + }) + { + Host = "aio-broker:18883", + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + TrustedCaCertificateConfigMapRef = "aio-ca-trust-bundle-test-only", + }, + }, + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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 Update_DataflowEndpointCreateOrUpdateEventGrid() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_EventGrid.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "event-grid-endpoint"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Mqtt) + { + MqttSettings = new DataflowEndpointMqtt(new DataflowEndpointMqttAuthentication(MqttAuthMethod.SystemAssignedManagedIdentity)) + { + Host = "example.westeurope-1.ts.eventgrid.azure.net:8883", + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + }, + }, + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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 Update_DataflowEndpointCreateOrUpdateEventHub() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_EventHub.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "event-hub-endpoint"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Kafka) + { + KafkaSettings = new DataflowEndpointKafka(new DataflowEndpointKafkaAuthentication(KafkaAuthMethod.SystemAssignedManagedIdentity), "example.servicebus.windows.net:9093") + { + ConsumerGroupId = "aiodataflows", + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + }, + }, + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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 Update_DataflowEndpointCreateOrUpdateFabric() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_Fabric.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "fabric-endpoint"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.FabricOneLake) + { + FabricOneLakeSettings = new DataflowEndpointFabricOneLake(new DataflowEndpointFabricOneLakeAuthentication(FabricOneLakeAuthMethod.SystemAssignedManagedIdentity), new DataflowEndpointFabricOneLakeNames("example-lakehouse", "example-workspace"), DataflowEndpointFabricPathType.Tables, "onelake.dfs.fabric.microsoft.com"), + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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 Update_DataflowEndpointCreateOrUpdateKafka() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_Kafka.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "generic-kafka-endpoint"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Kafka) + { + KafkaSettings = new DataflowEndpointKafka(new DataflowEndpointKafkaAuthentication(KafkaAuthMethod.Sasl) + { + SaslSettings = new DataflowEndpointAuthenticationSasl(DataflowEndpointAuthenticationSaslType.Plain, "my-secret"), + }, "example.kafka.local:9093") + { + ConsumerGroupId = "dataflows", + Batching = new DataflowEndpointKafkaBatching + { + Mode = OperationalMode.Enabled, + LatencyMs = 5, + MaxBytes = 1000000, + MaxMessages = 100000, + }, + CopyMqttProperties = OperationalMode.Enabled, + Compression = DataflowEndpointKafkaCompression.Gzip, + KafkaAcks = DataflowEndpointKafkaAck.All, + PartitionStrategy = DataflowEndpointKafkaPartitionStrategy.Default, + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + TrustedCaCertificateConfigMapRef = "ca-certificates", + }, + CloudEventAttributes = CloudEventAttributeType.Propagate, + }, + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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 Update_DataflowEndpointCreateOrUpdateLocalStorage() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_LocalStorage.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "local-storage-endpoint"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.LocalStorage) + { + LocalStoragePersistentVolumeClaimRef = "example-pvc", + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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 Update_DataflowEndpointCreateOrUpdateMQTT() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MQTT.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "generic-mqtt-broker-endpoint"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Mqtt) + { + MqttSettings = new DataflowEndpointMqtt(new DataflowEndpointMqttAuthentication(MqttAuthMethod.X509Certificate) + { + X509CertificateSecretRef = "example-secret", + }) + { + ClientIdPrefix = "factory-gateway", + Host = "example.broker.local:1883", + Protocol = BrokerProtocolType.WebSockets, + KeepAliveSeconds = 60, + Retain = MqttRetainType.Keep, + MaxInflightMessages = 100, + Qos = 1, + SessionExpirySeconds = 3600, + Tls = new TlsProperties + { + Mode = OperationalMode.Disabled, + }, + }, + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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 Update_DataflowEndpointCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 DataflowEndpointResource created on azure + // for more information of creating DataflowEndpointResource, please refer to the document of DataflowEndpointResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowEndpointName = "resource-name123"; + ResourceIdentifier dataflowEndpointResourceId = DataflowEndpointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + DataflowEndpointResource dataflowEndpointResource = client.GetDataflowEndpointResource(dataflowEndpointResourceId); + + // invoke the operation + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.DataExplorer) + { + DataExplorerSettings = new DataflowEndpointDataExplorer(new DataflowEndpointDataExplorerAuthentication(DataExplorerAuthMethod.SystemAssignedManagedIdentity) + { + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + }, "yqcdpjsifm", "..kusto.windows.net") + { + Batching = new BatchingConfiguration + { + LatencySeconds = 9312, + MaxMessages = 9028, + }, + }, + DataLakeStorageSettings = new DataflowEndpointDataLakeStorage(new DataflowEndpointDataLakeStorageAuthentication(DataLakeStorageAuthMethod.SystemAssignedManagedIdentity) + { + AccessTokenSecretRef = "sevriyphcvnlrnfudqzejecwa", + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + }, ".blob.core.windows.net") + { + Batching = new BatchingConfiguration + { + LatencySeconds = 9312, + MaxMessages = 9028, + }, + }, + FabricOneLakeSettings = new DataflowEndpointFabricOneLake(new DataflowEndpointFabricOneLakeAuthentication(FabricOneLakeAuthMethod.SystemAssignedManagedIdentity) + { + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + }, new DataflowEndpointFabricOneLakeNames("wpeathi", "nwgmitkbljztgms"), DataflowEndpointFabricPathType.Files, "https://.fabric.microsoft.com") + { + Batching = new BatchingConfiguration + { + LatencySeconds = 9312, + MaxMessages = 9028, + }, + }, + KafkaSettings = new DataflowEndpointKafka(new DataflowEndpointKafkaAuthentication(KafkaAuthMethod.SystemAssignedManagedIdentity) + { + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + SaslSettings = new DataflowEndpointAuthenticationSasl(DataflowEndpointAuthenticationSaslType.Plain, "visyxoztqnylvbyokhtmpdkwes"), + X509CertificateSecretRef = "afwizrystfslkfqd", + }, "pwcqfiqclcgneolpewnyavoulbip") + { + ConsumerGroupId = "ukkzcjiyenhxokat", + Batching = new DataflowEndpointKafkaBatching + { + Mode = OperationalMode.Enabled, + LatencyMs = 3679, + MaxBytes = 8887, + MaxMessages = 2174, + }, + CopyMqttProperties = OperationalMode.Enabled, + Compression = DataflowEndpointKafkaCompression.None, + KafkaAcks = DataflowEndpointKafkaAck.Zero, + PartitionStrategy = DataflowEndpointKafkaPartitionStrategy.Default, + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + TrustedCaCertificateConfigMapRef = "tectjjvukvelsreihwadh", + }, + }, + LocalStoragePersistentVolumeClaimRef = "jjwqwvd", + MqttSettings = new DataflowEndpointMqtt(new DataflowEndpointMqttAuthentication(MqttAuthMethod.SystemAssignedManagedIdentity) + { + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + ServiceAccountTokenAudience = "ejbklrbxgjaqleoycgpje", + X509CertificateSecretRef = "afwizrystfslkfqd", + }) + { + ClientIdPrefix = "kkljsdxdirfhwxtkavldekeqhv", + Host = "nyhnxqnbspstctl", + Protocol = BrokerProtocolType.Mqtt, + KeepAliveSeconds = 0, + Retain = MqttRetainType.Keep, + MaxInflightMessages = 0, + Qos = 1, + SessionExpirySeconds = 0, + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + TrustedCaCertificateConfigMapRef = "tectjjvukvelsreihwadh", + }, + }, + }, + }; + ArmOperation lro = await dataflowEndpointResource.UpdateAsync(WaitUntil.Completed, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowEndpointResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowEndpointResourceCollection.cs new file mode 100644 index 000000000000..b8d75a220bc9 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowEndpointResourceCollection.cs @@ -0,0 +1,756 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_DataflowEndpointResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_DataflowEndpointCreateOrUpdateADLSv2() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_ADLSv2.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "adlsv2-endpoint"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.DataLakeStorage) + { + DataLakeStorageSettings = new DataflowEndpointDataLakeStorage(new DataflowEndpointDataLakeStorageAuthentication(DataLakeStorageAuthMethod.AccessToken) + { + AccessTokenSecretRef = "my-secret", + }, "example.blob.core.windows.net"), + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointCreateOrUpdateADX() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_ADX.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "adx-endpoint"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.DataExplorer) + { + DataExplorerSettings = new DataflowEndpointDataExplorer(new DataflowEndpointDataExplorerAuthentication(DataExplorerAuthMethod.SystemAssignedManagedIdentity), "example-database", "example.westeurope.kusto.windows.net") + { + Batching = new BatchingConfiguration + { + LatencySeconds = 9312, + MaxMessages = 9028, + }, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointCreateOrUpdateAIO() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_AIO.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "aio-builtin-broker-endpoint"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Mqtt) + { + MqttSettings = new DataflowEndpointMqtt(new DataflowEndpointMqttAuthentication(default) + { + ServiceAccountTokenAudience = "aio-internal", + }) + { + Host = "aio-broker:18883", + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + TrustedCaCertificateConfigMapRef = "aio-ca-trust-bundle-test-only", + }, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointCreateOrUpdateEventGrid() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_EventGrid.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "event-grid-endpoint"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Mqtt) + { + MqttSettings = new DataflowEndpointMqtt(new DataflowEndpointMqttAuthentication(MqttAuthMethod.SystemAssignedManagedIdentity)) + { + Host = "example.westeurope-1.ts.eventgrid.azure.net:8883", + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + }, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointCreateOrUpdateEventHub() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_EventHub.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "event-hub-endpoint"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Kafka) + { + KafkaSettings = new DataflowEndpointKafka(new DataflowEndpointKafkaAuthentication(KafkaAuthMethod.SystemAssignedManagedIdentity), "example.servicebus.windows.net:9093") + { + ConsumerGroupId = "aiodataflows", + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + }, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointCreateOrUpdateFabric() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_Fabric.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "fabric-endpoint"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.FabricOneLake) + { + FabricOneLakeSettings = new DataflowEndpointFabricOneLake(new DataflowEndpointFabricOneLakeAuthentication(FabricOneLakeAuthMethod.SystemAssignedManagedIdentity), new DataflowEndpointFabricOneLakeNames("example-lakehouse", "example-workspace"), DataflowEndpointFabricPathType.Tables, "onelake.dfs.fabric.microsoft.com"), + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointCreateOrUpdateKafka() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_Kafka.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "generic-kafka-endpoint"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Kafka) + { + KafkaSettings = new DataflowEndpointKafka(new DataflowEndpointKafkaAuthentication(KafkaAuthMethod.Sasl) + { + SaslSettings = new DataflowEndpointAuthenticationSasl(DataflowEndpointAuthenticationSaslType.Plain, "my-secret"), + }, "example.kafka.local:9093") + { + ConsumerGroupId = "dataflows", + Batching = new DataflowEndpointKafkaBatching + { + Mode = OperationalMode.Enabled, + LatencyMs = 5, + MaxBytes = 1000000, + MaxMessages = 100000, + }, + CopyMqttProperties = OperationalMode.Enabled, + Compression = DataflowEndpointKafkaCompression.Gzip, + KafkaAcks = DataflowEndpointKafkaAck.All, + PartitionStrategy = DataflowEndpointKafkaPartitionStrategy.Default, + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + TrustedCaCertificateConfigMapRef = "ca-certificates", + }, + CloudEventAttributes = CloudEventAttributeType.Propagate, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointCreateOrUpdateLocalStorage() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_LocalStorage.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "local-storage-endpoint"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.LocalStorage) + { + LocalStoragePersistentVolumeClaimRef = "example-pvc", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointCreateOrUpdateMQTT() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MQTT.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "generic-mqtt-broker-endpoint"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.Mqtt) + { + MqttSettings = new DataflowEndpointMqtt(new DataflowEndpointMqttAuthentication(MqttAuthMethod.X509Certificate) + { + X509CertificateSecretRef = "example-secret", + }) + { + ClientIdPrefix = "factory-gateway", + Host = "example.broker.local:1883", + Protocol = BrokerProtocolType.WebSockets, + KeepAliveSeconds = 60, + Retain = MqttRetainType.Keep, + MaxInflightMessages = 100, + Qos = 1, + SessionExpirySeconds = 3600, + Tls = new TlsProperties + { + Mode = OperationalMode.Disabled, + }, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowEndpointResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "resource-name123"; + DataflowEndpointResourceData data = new DataflowEndpointResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowEndpointProperties(EndpointType.DataExplorer) + { + DataExplorerSettings = new DataflowEndpointDataExplorer(new DataflowEndpointDataExplorerAuthentication(DataExplorerAuthMethod.SystemAssignedManagedIdentity) + { + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + }, "yqcdpjsifm", "..kusto.windows.net") + { + Batching = new BatchingConfiguration + { + LatencySeconds = 9312, + MaxMessages = 9028, + }, + }, + DataLakeStorageSettings = new DataflowEndpointDataLakeStorage(new DataflowEndpointDataLakeStorageAuthentication(DataLakeStorageAuthMethod.SystemAssignedManagedIdentity) + { + AccessTokenSecretRef = "sevriyphcvnlrnfudqzejecwa", + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + }, ".blob.core.windows.net") + { + Batching = new BatchingConfiguration + { + LatencySeconds = 9312, + MaxMessages = 9028, + }, + }, + FabricOneLakeSettings = new DataflowEndpointFabricOneLake(new DataflowEndpointFabricOneLakeAuthentication(FabricOneLakeAuthMethod.SystemAssignedManagedIdentity) + { + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + }, new DataflowEndpointFabricOneLakeNames("wpeathi", "nwgmitkbljztgms"), DataflowEndpointFabricPathType.Files, "https://.fabric.microsoft.com") + { + Batching = new BatchingConfiguration + { + LatencySeconds = 9312, + MaxMessages = 9028, + }, + }, + KafkaSettings = new DataflowEndpointKafka(new DataflowEndpointKafkaAuthentication(KafkaAuthMethod.SystemAssignedManagedIdentity) + { + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + SaslSettings = new DataflowEndpointAuthenticationSasl(DataflowEndpointAuthenticationSaslType.Plain, "visyxoztqnylvbyokhtmpdkwes"), + X509CertificateSecretRef = "afwizrystfslkfqd", + }, "pwcqfiqclcgneolpewnyavoulbip") + { + ConsumerGroupId = "ukkzcjiyenhxokat", + Batching = new DataflowEndpointKafkaBatching + { + Mode = OperationalMode.Enabled, + LatencyMs = 3679, + MaxBytes = 8887, + MaxMessages = 2174, + }, + CopyMqttProperties = OperationalMode.Enabled, + Compression = DataflowEndpointKafkaCompression.None, + KafkaAcks = DataflowEndpointKafkaAck.Zero, + PartitionStrategy = DataflowEndpointKafkaPartitionStrategy.Default, + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + TrustedCaCertificateConfigMapRef = "tectjjvukvelsreihwadh", + }, + }, + LocalStoragePersistentVolumeClaimRef = "jjwqwvd", + MqttSettings = new DataflowEndpointMqtt(new DataflowEndpointMqttAuthentication(MqttAuthMethod.SystemAssignedManagedIdentity) + { + SystemAssignedManagedIdentityAudience = "psxomrfbhoflycm", + UserAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationUserAssignedManagedIdentity("fb90f267-8872-431a-a76a-a1cec5d3c4d2", "ed060aa2-71ff-4d3f-99c4-a9138356fdec") + { + Scope = "zop", + }, + ServiceAccountTokenAudience = "ejbklrbxgjaqleoycgpje", + X509CertificateSecretRef = "afwizrystfslkfqd", + }) + { + ClientIdPrefix = "kkljsdxdirfhwxtkavldekeqhv", + Host = "nyhnxqnbspstctl", + Protocol = BrokerProtocolType.Mqtt, + KeepAliveSeconds = 0, + Retain = MqttRetainType.Keep, + MaxInflightMessages = 0, + Qos = 1, + SessionExpirySeconds = 0, + Tls = new TlsProperties + { + Mode = OperationalMode.Enabled, + TrustedCaCertificateConfigMapRef = "tectjjvukvelsreihwadh", + }, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowEndpointName, data); + DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointGet() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowEndpointResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "resource-name123"; + DataflowEndpointResource result = await collection.GetAsync(dataflowEndpointName); + + // 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 + DataflowEndpointResourceData 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_DataflowEndpointListByResourceGroup() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowEndpointResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation and iterate over the result + await foreach (DataflowEndpointResource 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 + DataflowEndpointResourceData 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_DataflowEndpointGet() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowEndpointResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "resource-name123"; + bool result = await collection.ExistsAsync(dataflowEndpointName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_DataflowEndpointGet() + { + // Generated from example definition: 2024-11-01/DataflowEndpoint_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowEndpointResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowEndpointResource + DataflowEndpointResourceCollection collection = instanceResource.GetDataflowEndpointResources(); + + // invoke the operation + string dataflowEndpointName = "resource-name123"; + NullableResponse response = await collection.GetIfExistsAsync(dataflowEndpointName); + DataflowEndpointResource 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 + DataflowEndpointResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowProfileResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowProfileResource.cs new file mode 100644 index 000000000000..a511c9a04891 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowProfileResource.cs @@ -0,0 +1,199 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_DataflowProfileResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_DataflowProfileGet() + { + // Generated from example definition: 2024-11-01/DataflowProfile_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowProfileResource_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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // invoke the operation + DataflowProfileResource result = await dataflowProfileResource.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 + DataflowProfileResourceData 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_DataflowProfileDelete() + { + // Generated from example definition: 2024-11-01/DataflowProfile_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowProfileResource_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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // invoke the operation + await dataflowProfileResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_DataflowProfileCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowProfileResource_CreateOrUpdate" 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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // invoke the operation + DataflowProfileResourceData data = new DataflowProfileResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProfileProperties + { + Diagnostics = new ProfileDiagnostics + { + LogsLevel = "rnmwokumdmebpmfxxxzvvjfdywotav", + MetricsPrometheusPort = 7581, + }, + InstanceCount = 14, + }, + }; + ArmOperation lro = await dataflowProfileResource.UpdateAsync(WaitUntil.Completed, data); + DataflowProfileResource 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 + DataflowProfileResourceData 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 Update_DataflowProfileCreateOrUpdateMinimal() + { + // Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_Minimal.json + // this example is just showing the usage of "DataflowProfileResource_CreateOrUpdate" 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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "aio-dataflowprofile"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // invoke the operation + DataflowProfileResourceData data = new DataflowProfileResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProfileProperties + { + InstanceCount = 1, + }, + }; + ArmOperation lro = await dataflowProfileResource.UpdateAsync(WaitUntil.Completed, data); + DataflowProfileResource 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 + DataflowProfileResourceData 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 Update_DataflowProfileCreateOrUpdateMulti() + { + // Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_Multi.json + // this example is just showing the usage of "DataflowProfileResource_CreateOrUpdate" 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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "aio-dataflowprofile"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // invoke the operation + DataflowProfileResourceData data = new DataflowProfileResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProfileProperties + { + InstanceCount = 3, + }, + }; + ArmOperation lro = await dataflowProfileResource.UpdateAsync(WaitUntil.Completed, data); + DataflowProfileResource 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 + DataflowProfileResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowProfileResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowProfileResourceCollection.cs new file mode 100644 index 000000000000..643a0d2032fd --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowProfileResourceCollection.cs @@ -0,0 +1,292 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_DataflowProfileResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_DataflowProfileCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowProfileResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowProfileResource + DataflowProfileResourceCollection collection = instanceResource.GetDataflowProfileResources(); + + // invoke the operation + string dataflowProfileName = "resource-name123"; + DataflowProfileResourceData data = new DataflowProfileResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProfileProperties + { + Diagnostics = new ProfileDiagnostics + { + LogsLevel = "rnmwokumdmebpmfxxxzvvjfdywotav", + MetricsPrometheusPort = 7581, + }, + InstanceCount = 14, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowProfileName, data); + DataflowProfileResource 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 + DataflowProfileResourceData 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_DataflowProfileCreateOrUpdateMinimal() + { + // Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_Minimal.json + // this example is just showing the usage of "DataflowProfileResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowProfileResource + DataflowProfileResourceCollection collection = instanceResource.GetDataflowProfileResources(); + + // invoke the operation + string dataflowProfileName = "aio-dataflowprofile"; + DataflowProfileResourceData data = new DataflowProfileResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProfileProperties + { + InstanceCount = 1, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowProfileName, data); + DataflowProfileResource 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 + DataflowProfileResourceData 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_DataflowProfileCreateOrUpdateMulti() + { + // Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_Multi.json + // this example is just showing the usage of "DataflowProfileResource_CreateOrUpdate" 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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowProfileResource + DataflowProfileResourceCollection collection = instanceResource.GetDataflowProfileResources(); + + // invoke the operation + string dataflowProfileName = "aio-dataflowprofile"; + DataflowProfileResourceData data = new DataflowProfileResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProfileProperties + { + InstanceCount = 3, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowProfileName, data); + DataflowProfileResource 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 + DataflowProfileResourceData 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_DataflowProfileGet() + { + // Generated from example definition: 2024-11-01/DataflowProfile_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowProfileResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowProfileResource + DataflowProfileResourceCollection collection = instanceResource.GetDataflowProfileResources(); + + // invoke the operation + string dataflowProfileName = "resource-name123"; + DataflowProfileResource result = await collection.GetAsync(dataflowProfileName); + + // 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 + DataflowProfileResourceData 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_DataflowProfileListByResourceGroup() + { + // Generated from example definition: 2024-11-01/DataflowProfile_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowProfileResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowProfileResource + DataflowProfileResourceCollection collection = instanceResource.GetDataflowProfileResources(); + + // invoke the operation and iterate over the result + await foreach (DataflowProfileResource 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 + DataflowProfileResourceData 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_DataflowProfileGet() + { + // Generated from example definition: 2024-11-01/DataflowProfile_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowProfileResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowProfileResource + DataflowProfileResourceCollection collection = instanceResource.GetDataflowProfileResources(); + + // invoke the operation + string dataflowProfileName = "resource-name123"; + bool result = await collection.ExistsAsync(dataflowProfileName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_DataflowProfileGet() + { + // Generated from example definition: 2024-11-01/DataflowProfile_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowProfileResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // get the collection of this DataflowProfileResource + DataflowProfileResourceCollection collection = instanceResource.GetDataflowProfileResources(); + + // invoke the operation + string dataflowProfileName = "resource-name123"; + NullableResponse response = await collection.GetIfExistsAsync(dataflowProfileName); + DataflowProfileResource 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 + DataflowProfileResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowResource.cs new file mode 100644 index 000000000000..81fe4022720c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowResource.cs @@ -0,0 +1,476 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_DataflowResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_DataflowGet() + { + // Generated from example definition: 2024-11-01/Dataflow_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowResource_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 DataflowResource created on azure + // for more information of creating DataflowResource, please refer to the document of DataflowResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + string dataflowName = "resource-name123"; + ResourceIdentifier dataflowResourceId = DataflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + DataflowResource dataflowResource = client.GetDataflowResource(dataflowResourceId); + + // invoke the operation + DataflowResource result = await dataflowResource.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 + DataflowResourceData 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_DataflowDelete() + { + // Generated from example definition: 2024-11-01/Dataflow_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowResource_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 DataflowResource created on azure + // for more information of creating DataflowResource, please refer to the document of DataflowResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + string dataflowName = "resource-name123"; + ResourceIdentifier dataflowResourceId = DataflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + DataflowResource dataflowResource = client.GetDataflowResource(dataflowResourceId); + + // invoke the operation + await dataflowResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_DataflowCreateOrUpdateComplexContextualization() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_ComplexContextualization.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowResource created on azure + // for more information of creating DataflowResource, please refer to the document of DataflowResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + string dataflowName = "aio-to-adx-contexualized"; + ResourceIdentifier dataflowResourceId = DataflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + DataflowResource dataflowResource = client.GetDataflowResource(dataflowResourceId); + + // invoke the operation + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"azure-iot-operations/data/thermostat"}), +}, +new DataflowOperation(OperationType.BuiltInTransformation) +{ +Name = "transformation1", +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +Datasets = {new DataflowBuiltInTransformationDataset("quality", new string[]{"$source.country", "$context.country"}) +{ +Expression = "$1 == $2", +}}, +Map = {new DataflowBuiltInTransformationMap(new string[]{"*"}, "*"), new DataflowBuiltInTransformationMap(new string[]{"$context(quality).*"}, "enriched.*")}, +}, +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("adx-endpoint", "mytable"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await dataflowResource.UpdateAsync(WaitUntil.Completed, data); + DataflowResource 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 + DataflowResourceData 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 Update_DataflowCreateOrUpdateComplexEventHub() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_ComplexEventHub.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowResource created on azure + // for more information of creating DataflowResource, please refer to the document of DataflowResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + string dataflowName = "aio-to-event-hub-transformed"; + ResourceIdentifier dataflowResourceId = DataflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + DataflowResource dataflowResource = client.GetDataflowResource(dataflowResourceId); + + // invoke the operation + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"azure-iot-operations/data/thermostat"}), +}, +new DataflowOperation(OperationType.BuiltInTransformation) +{ +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +Filter = {new DataflowBuiltInTransformationFilter(new string[]{"temperature.Value", "\"Tag 10\".Value"}, "$1 > 9000 && $2 >= 8000")}, +Map = {new DataflowBuiltInTransformationMap(new string[]{"*"}, "*"), new DataflowBuiltInTransformationMap(new string[]{"temperature.Value", "\"Tag 10\".Value"}, "AvgTemp.Value") +{ +Expression = "($1+$2)/2", +}, new DataflowBuiltInTransformationMap(Array.Empty(), "dataflow-processed") +{ +Expression = "true", +}, new DataflowBuiltInTransformationMap(new string[]{"temperature.SourceTimestamp"}, "") +{ +Expression = "", +}, new DataflowBuiltInTransformationMap(new string[]{"\"Tag 10\""}, "pressure") +{ +Expression = "", +}, new DataflowBuiltInTransformationMap(new string[]{"temperature.Value"}, "temperatureF.Value") +{ +Expression = "cToF($1)", +}, new DataflowBuiltInTransformationMap(new string[]{"\"Tag 10\".Value"}, "\"Scale Tag 10\".Value") +{ +Expression = "scale ($1,0,10,0,100)", +}}, +}, +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("event-hub-endpoint", "myuniqueeventhub"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await dataflowResource.UpdateAsync(WaitUntil.Completed, data); + DataflowResource 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 + DataflowResourceData 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 Update_DataflowCreateOrUpdateFilterToTopic() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_FilterToTopic.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowResource created on azure + // for more information of creating DataflowResource, please refer to the document of DataflowResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + string dataflowName = "mqtt-filter-to-topic"; + ResourceIdentifier dataflowResourceId = DataflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + DataflowResource dataflowResource = client.GetDataflowResource(dataflowResourceId); + + // invoke the operation + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"azure-iot-operations/data/thermostat"}), +}, +new DataflowOperation(OperationType.BuiltInTransformation) +{ +Name = "transformation1", +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +Filter = {new DataflowBuiltInTransformationFilter(new string[]{"temperature.Value", "\"Tag 10\".Value"}, "$1 > 9000 && $2 >= 8000") +{ +Type = FilterType.Filter, +Description = "filter-datapoint", +}}, +Map = {new DataflowBuiltInTransformationMap(new string[]{"*"}, "*") +{ +Type = DataflowMappingType.PassThrough, +}}, +}, +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("aio-builtin-broker-endpoint", "data/filtered/thermostat"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await dataflowResource.UpdateAsync(WaitUntil.Completed, data); + DataflowResource 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 + DataflowResourceData 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 Update_DataflowCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowResource created on azure + // for more information of creating DataflowResource, please refer to the document of DataflowResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + string dataflowName = "resource-name123"; + ResourceIdentifier dataflowResourceId = DataflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + DataflowResource dataflowResource = client.GetDataflowResource(dataflowResourceId); + + // invoke the operation + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "knnafvkwoeakm", +SourceSettings = new DataflowSourceOperationSettings("iixotodhvhkkfcfyrkoveslqig", new string[]{"chkkpymxhp"}) +{ +AssetRef = "zayyykwmckaocywdkohmu", +SerializationFormat = SourceSerializationFormat.Json, +SchemaRef = "pknmdzqll", +}, +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +SerializationFormat = TransformationSerializationFormat.Delta, +SchemaRef = "mcdc", +Datasets = {new DataflowBuiltInTransformationDataset("qsfqcgxaxnhfumrsdsokwyv", new string[]{"mosffpsslifkq"}) +{ +Description = "Lorem ipsum odor amet, consectetuer adipiscing elit.", +SchemaRef = "n", +Expression = "aatbwomvflemsxialv", +}}, +Filter = {new DataflowBuiltInTransformationFilter(new string[]{"sxmjkbntgb"}, "n") +{ +Type = FilterType.Filter, +Description = "Lorem ipsum odor amet, consectetuer adipiscing elit.", +}}, +Map = {new DataflowBuiltInTransformationMap(new string[]{"xsbxuk"}, "nvgtmkfl") +{ +Type = DataflowMappingType.NewProperties, +Description = "Lorem ipsum odor amet, consectetuer adipiscing elit.", +Expression = "txoiltogsarwkzalsphvlmt", +}}, +}, +DestinationSettings = new DataflowDestinationOperationSettings("kybkchnzimerguekuvqlqiqdvvrt", "cbrh"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await dataflowResource.UpdateAsync(WaitUntil.Completed, data); + DataflowResource 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 + DataflowResourceData 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 Update_DataflowCreateOrUpdateSimpleEventGrid() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_SimpleEventGrid.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowResource created on azure + // for more information of creating DataflowResource, please refer to the document of DataflowResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + string dataflowName = "aio-to-event-grid"; + ResourceIdentifier dataflowResourceId = DataflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + DataflowResource dataflowResource = client.GetDataflowResource(dataflowResourceId); + + // invoke the operation + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"thermostats/+/telemetry/temperature/#"}), +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("event-grid-endpoint", "factory/telemetry"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await dataflowResource.UpdateAsync(WaitUntil.Completed, data); + DataflowResource 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 + DataflowResourceData 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 Update_DataflowCreateOrUpdateSimpleFabric() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_SimpleFabric.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowResource created on azure + // for more information of creating DataflowResource, please refer to the document of DataflowResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + string dataflowName = "aio-to-fabric"; + ResourceIdentifier dataflowResourceId = DataflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + DataflowResource dataflowResource = client.GetDataflowResource(dataflowResourceId); + + // invoke the operation + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"azure-iot-operations/data/thermostat"}), +}, +new DataflowOperation(OperationType.BuiltInTransformation) +{ +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +SerializationFormat = TransformationSerializationFormat.Parquet, +SchemaRef = "aio-sr://exampleNamespace/exmapleParquetSchema:1.0.0", +}, +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("fabric-endpoint", "telemetryTable"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await dataflowResource.UpdateAsync(WaitUntil.Completed, data); + DataflowResource 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 + DataflowResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowResourceCollection.cs new file mode 100644 index 000000000000..fa1b6d162009 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_DataflowResourceCollection.cs @@ -0,0 +1,580 @@ +// 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.IoTOperations.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_DataflowResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_DataflowCreateOrUpdateComplexContextualization() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_ComplexContextualization.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation + string dataflowName = "aio-to-adx-contexualized"; + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"azure-iot-operations/data/thermostat"}), +}, +new DataflowOperation(OperationType.BuiltInTransformation) +{ +Name = "transformation1", +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +Datasets = {new DataflowBuiltInTransformationDataset("quality", new string[]{"$source.country", "$context.country"}) +{ +Expression = "$1 == $2", +}}, +Map = {new DataflowBuiltInTransformationMap(new string[]{"*"}, "*"), new DataflowBuiltInTransformationMap(new string[]{"$context(quality).*"}, "enriched.*")}, +}, +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("adx-endpoint", "mytable"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowName, data); + DataflowResource 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 + DataflowResourceData 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_DataflowCreateOrUpdateComplexEventHub() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_ComplexEventHub.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation + string dataflowName = "aio-to-event-hub-transformed"; + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"azure-iot-operations/data/thermostat"}), +}, +new DataflowOperation(OperationType.BuiltInTransformation) +{ +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +Filter = {new DataflowBuiltInTransformationFilter(new string[]{"temperature.Value", "\"Tag 10\".Value"}, "$1 > 9000 && $2 >= 8000")}, +Map = {new DataflowBuiltInTransformationMap(new string[]{"*"}, "*"), new DataflowBuiltInTransformationMap(new string[]{"temperature.Value", "\"Tag 10\".Value"}, "AvgTemp.Value") +{ +Expression = "($1+$2)/2", +}, new DataflowBuiltInTransformationMap(Array.Empty(), "dataflow-processed") +{ +Expression = "true", +}, new DataflowBuiltInTransformationMap(new string[]{"temperature.SourceTimestamp"}, "") +{ +Expression = "", +}, new DataflowBuiltInTransformationMap(new string[]{"\"Tag 10\""}, "pressure") +{ +Expression = "", +}, new DataflowBuiltInTransformationMap(new string[]{"temperature.Value"}, "temperatureF.Value") +{ +Expression = "cToF($1)", +}, new DataflowBuiltInTransformationMap(new string[]{"\"Tag 10\".Value"}, "\"Scale Tag 10\".Value") +{ +Expression = "scale ($1,0,10,0,100)", +}}, +}, +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("event-hub-endpoint", "myuniqueeventhub"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowName, data); + DataflowResource 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 + DataflowResourceData 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_DataflowCreateOrUpdateFilterToTopic() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_FilterToTopic.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation + string dataflowName = "mqtt-filter-to-topic"; + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"azure-iot-operations/data/thermostat"}), +}, +new DataflowOperation(OperationType.BuiltInTransformation) +{ +Name = "transformation1", +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +Filter = {new DataflowBuiltInTransformationFilter(new string[]{"temperature.Value", "\"Tag 10\".Value"}, "$1 > 9000 && $2 >= 8000") +{ +Type = FilterType.Filter, +Description = "filter-datapoint", +}}, +Map = {new DataflowBuiltInTransformationMap(new string[]{"*"}, "*") +{ +Type = DataflowMappingType.PassThrough, +}}, +}, +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("aio-builtin-broker-endpoint", "data/filtered/thermostat"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowName, data); + DataflowResource 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 + DataflowResourceData 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_DataflowCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation + string dataflowName = "resource-name123"; + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "knnafvkwoeakm", +SourceSettings = new DataflowSourceOperationSettings("iixotodhvhkkfcfyrkoveslqig", new string[]{"chkkpymxhp"}) +{ +AssetRef = "zayyykwmckaocywdkohmu", +SerializationFormat = SourceSerializationFormat.Json, +SchemaRef = "pknmdzqll", +}, +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +SerializationFormat = TransformationSerializationFormat.Delta, +SchemaRef = "mcdc", +Datasets = {new DataflowBuiltInTransformationDataset("qsfqcgxaxnhfumrsdsokwyv", new string[]{"mosffpsslifkq"}) +{ +Description = "Lorem ipsum odor amet, consectetuer adipiscing elit.", +SchemaRef = "n", +Expression = "aatbwomvflemsxialv", +}}, +Filter = {new DataflowBuiltInTransformationFilter(new string[]{"sxmjkbntgb"}, "n") +{ +Type = FilterType.Filter, +Description = "Lorem ipsum odor amet, consectetuer adipiscing elit.", +}}, +Map = {new DataflowBuiltInTransformationMap(new string[]{"xsbxuk"}, "nvgtmkfl") +{ +Type = DataflowMappingType.NewProperties, +Description = "Lorem ipsum odor amet, consectetuer adipiscing elit.", +Expression = "txoiltogsarwkzalsphvlmt", +}}, +}, +DestinationSettings = new DataflowDestinationOperationSettings("kybkchnzimerguekuvqlqiqdvvrt", "cbrh"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowName, data); + DataflowResource 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 + DataflowResourceData 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_DataflowCreateOrUpdateSimpleEventGrid() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_SimpleEventGrid.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation + string dataflowName = "aio-to-event-grid"; + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"thermostats/+/telemetry/temperature/#"}), +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("event-grid-endpoint", "factory/telemetry"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowName, data); + DataflowResource 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 + DataflowResourceData 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_DataflowCreateOrUpdateSimpleFabric() + { + // Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_SimpleFabric.json + // this example is just showing the usage of "DataflowResource_CreateOrUpdate" 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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation + string dataflowName = "aio-to-fabric"; + DataflowResourceData data = new DataflowResourceData(new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new DataflowProperties(new DataflowOperation[] + { +new DataflowOperation(OperationType.Source) +{ +Name = "source1", +SourceSettings = new DataflowSourceOperationSettings("aio-builtin-broker-endpoint", new string[]{"azure-iot-operations/data/thermostat"}), +}, +new DataflowOperation(OperationType.BuiltInTransformation) +{ +BuiltInTransformationSettings = new DataflowBuiltInTransformationSettings +{ +SerializationFormat = TransformationSerializationFormat.Parquet, +SchemaRef = "aio-sr://exampleNamespace/exmapleParquetSchema:1.0.0", +}, +}, +new DataflowOperation(OperationType.Destination) +{ +Name = "destination1", +DestinationSettings = new DataflowDestinationOperationSettings("fabric-endpoint", "telemetryTable"), +} + }) + { + Mode = OperationalMode.Enabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dataflowName, data); + DataflowResource 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 + DataflowResourceData 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_DataflowGet() + { + // Generated from example definition: 2024-11-01/Dataflow_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowResource_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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation + string dataflowName = "resource-name123"; + DataflowResource result = await collection.GetAsync(dataflowName); + + // 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 + DataflowResourceData 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_DataflowListByProfileResource() + { + // Generated from example definition: 2024-11-01/Dataflow_ListByProfileResource_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowResource_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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation and iterate over the result + await foreach (DataflowResource 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 + DataflowResourceData 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_DataflowGet() + { + // Generated from example definition: 2024-11-01/Dataflow_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowResource_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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation + string dataflowName = "resource-name123"; + bool result = await collection.ExistsAsync(dataflowName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_DataflowGet() + { + // Generated from example definition: 2024-11-01/Dataflow_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DataflowResource_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 DataflowProfileResource created on azure + // for more information of creating DataflowProfileResource, please refer to the document of DataflowProfileResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "resource-name123"; + string dataflowProfileName = "resource-name123"; + ResourceIdentifier dataflowProfileResourceId = DataflowProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + DataflowProfileResource dataflowProfileResource = client.GetDataflowProfileResource(dataflowProfileResourceId); + + // get the collection of this DataflowResource + DataflowResourceCollection collection = dataflowProfileResource.GetDataflowResources(); + + // invoke the operation + string dataflowName = "resource-name123"; + NullableResponse response = await collection.GetIfExistsAsync(dataflowName); + DataflowResource 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 + DataflowResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_InstanceResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_InstanceResource.cs new file mode 100644 index 000000000000..83313b99e954 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_InstanceResource.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_InstanceResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_InstanceGet() + { + // Generated from example definition: 2024-11-01/Instance_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "aio-instance"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // invoke the operation + InstanceResource result = await instanceResource.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 + InstanceResourceData 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_InstanceDelete() + { + // Generated from example definition: 2024-11-01/Instance_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "aio-instance"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // invoke the operation + await instanceResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_InstanceUpdate() + { + // Generated from example definition: 2024-11-01/Instance_Update_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + string instanceName = "aio-instance"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instanceName); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // invoke the operation + InstanceResourcePatch patch = new InstanceResourcePatch + { + Tags = { }, + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = { }, + }, + }; + InstanceResource result = await instanceResource.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 + InstanceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_InstanceResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_InstanceResourceCollection.cs new file mode 100644 index 000000000000..61f119d172c7 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_InstanceResourceCollection.cs @@ -0,0 +1,205 @@ +// 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.IoTOperations.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.IoTOperations.Samples +{ + public partial class Sample_InstanceResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_InstanceCreateOrUpdate() + { + // Generated from example definition: 2024-11-01/Instance_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_CreateOrUpdate" 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 = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation + string instanceName = "aio-instance"; + InstanceResourceData data = new InstanceResourceData(new AzureLocation("xvewadyhycrjpu"), new ExtendedLocation("qmbrfwcpwwhggszhrdjv", ExtendedLocationType.CustomLocation)) + { + Properties = new InstanceProperties(new SchemaRegistryRef(new ResourceIdentifier("/subscriptions/0000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup123/providers/Microsoft.DeviceRegistry/schemaRegistries/resource-name123"))) + { + Description = "kpqtgocs", + }, + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = { }, + }, + Tags = { }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, instanceName, data); + InstanceResource 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 + InstanceResourceData 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_InstanceGet() + { + // Generated from example definition: 2024-11-01/Instance_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation + string instanceName = "aio-instance"; + InstanceResource result = await collection.GetAsync(instanceName); + + // 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 + InstanceResourceData 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_InstanceListByResourceGroup() + { + // Generated from example definition: 2024-11-01/Instance_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation and iterate over the result + await foreach (InstanceResource 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 + InstanceResourceData 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_InstanceGet() + { + // Generated from example definition: 2024-11-01/Instance_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation + string instanceName = "aio-instance"; + bool result = await collection.ExistsAsync(instanceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_InstanceGet() + { + // Generated from example definition: 2024-11-01/Instance_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + string resourceGroupName = "rgiotoperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation + string instanceName = "aio-instance"; + NullableResponse response = await collection.GetIfExistsAsync(instanceName); + InstanceResource 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 + InstanceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..93f8bfdc7d44 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,50 @@ +// 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.IoTOperations.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetInstanceResources_InstanceListBySubscription() + { + // Generated from example definition: 2024-11-01/Instance_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "F8C729F9-DF9C-4743-848F-96EE433D8E53"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (InstanceResource item in subscriptionResource.GetInstanceResourcesAsync()) + { + // 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 + InstanceResourceData 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Azure.ResourceManager.IoTOperations.csproj b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Azure.ResourceManager.IoTOperations.csproj new file mode 100644 index 000000000000..f35cdf07bb01 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Azure.ResourceManager.IoTOperations.csproj @@ -0,0 +1,10 @@ + + + This is the Azure.ResourceManager.IoTOperations client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.ResourceManager.IoTOperations for Azure Data Plane + 1.0.0-beta.1 + Azure.ResourceManager.IoTOperations + $(RequiredTargetFrameworks) + true + + diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/ArmIoTOperationsModelFactory.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/ArmIoTOperationsModelFactory.cs new file mode 100644 index 000000000000..be165eee33a7 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/ArmIoTOperationsModelFactory.cs @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Model factory for models. + public static partial class ArmIoTOperationsModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// A new instance for mocking. + public static DataflowEndpointResourceData DataflowEndpointResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataflowEndpointProperties properties = null, ExtendedLocation extendedLocation = null) + { + return new DataflowEndpointResourceData( + id, + name, + resourceType, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Endpoint Type. + /// Azure Data Explorer endpoint. + /// Azure Data Lake endpoint. + /// Microsoft Fabric endpoint. + /// Kafka endpoint. + /// Local persistent volume endpoint. + /// Broker endpoint. + /// The status of the last operation. + /// A new instance for mocking. + public static DataflowEndpointProperties DataflowEndpointProperties(EndpointType endpointType = default, DataflowEndpointDataExplorer dataExplorerSettings = null, DataflowEndpointDataLakeStorage dataLakeStorageSettings = null, DataflowEndpointFabricOneLake fabricOneLakeSettings = null, DataflowEndpointKafka kafkaSettings = null, string localStoragePersistentVolumeClaimRef = null, DataflowEndpointMqtt mqttSettings = null, ProvisioningState? provisioningState = null) + { + return new DataflowEndpointProperties( + endpointType, + dataExplorerSettings, + dataLakeStorageSettings, + fabricOneLakeSettings, + kafkaSettings, + localStoragePersistentVolumeClaimRef != null ? new DataflowEndpointLocalStorage(localStoragePersistentVolumeClaimRef, serializedAdditionalRawData: null) : null, + mqttSettings, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// A new instance for mocking. + public static DataflowResourceData DataflowResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataflowProperties properties = null, ExtendedLocation extendedLocation = null) + { + return new DataflowResourceData( + id, + name, + resourceType, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Mode for Dataflow. Optional; defaults to Enabled. + /// List of operations including source and destination references as well as transformation. + /// The status of the last operation. + /// A new instance for mocking. + public static DataflowProperties DataflowProperties(OperationalMode? mode = null, IEnumerable operations = null, ProvisioningState? provisioningState = null) + { + operations ??= new List(); + + return new DataflowProperties(mode, operations?.ToList(), provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// A new instance for mocking. + public static DataflowProfileResourceData DataflowProfileResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataflowProfileProperties properties = null, ExtendedLocation extendedLocation = null) + { + return new DataflowProfileResourceData( + id, + name, + resourceType, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Spec defines the desired identities of NBC diagnostics settings. + /// To manually scale the dataflow profile, specify the maximum number of instances you want to run. + /// The status of the last operation. + /// A new instance for mocking. + public static DataflowProfileProperties DataflowProfileProperties(ProfileDiagnostics diagnostics = null, int? instanceCount = null, ProvisioningState? provisioningState = null) + { + return new DataflowProfileProperties(diagnostics, instanceCount, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// A new instance for mocking. + public static BrokerAuthorizationResourceData BrokerAuthorizationResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, BrokerAuthorizationProperties properties = null, ExtendedLocation extendedLocation = null) + { + return new BrokerAuthorizationResourceData( + id, + name, + resourceType, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The list of authorization policies supported by the Authorization Resource. + /// The status of the last operation. + /// A new instance for mocking. + public static BrokerAuthorizationProperties BrokerAuthorizationProperties(AuthorizationConfig authorizationPolicies = null, ProvisioningState? provisioningState = null) + { + return new BrokerAuthorizationProperties(authorizationPolicies, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// A new instance for mocking. + public static BrokerAuthenticationResourceData BrokerAuthenticationResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, BrokerAuthenticationProperties properties = null, ExtendedLocation extendedLocation = null) + { + return new BrokerAuthenticationResourceData( + id, + name, + resourceType, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Defines a set of Broker authentication methods to be used on `BrokerListeners`. For each array element one authenticator type supported. + /// The status of the last operation. + /// A new instance for mocking. + public static BrokerAuthenticationProperties BrokerAuthenticationProperties(IEnumerable authenticationMethods = null, ProvisioningState? provisioningState = null) + { + authenticationMethods ??= new List(); + + return new BrokerAuthenticationProperties(authenticationMethods?.ToList(), provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// A new instance for mocking. + public static BrokerListenerResourceData BrokerListenerResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, BrokerListenerProperties properties = null, ExtendedLocation extendedLocation = null) + { + return new BrokerListenerResourceData( + id, + name, + resourceType, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Kubernetes Service name of this listener. + /// Ports on which this listener accepts client connections. + /// Kubernetes Service type of this listener. + /// The status of the last operation. + /// A new instance for mocking. + public static BrokerListenerProperties BrokerListenerProperties(string serviceName = null, IEnumerable ports = null, ServiceType? serviceType = null, ProvisioningState? provisioningState = null) + { + ports ??= new List(); + + return new BrokerListenerProperties(serviceName, ports?.ToList(), serviceType, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// A new instance for mocking. + public static BrokerResourceData BrokerResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, BrokerProperties properties = null, ExtendedLocation extendedLocation = null) + { + return new BrokerResourceData( + id, + name, + resourceType, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Advanced settings of Broker. + /// The cardinality details of the broker. + /// Spec defines the desired identities of Broker diagnostics settings. + /// Settings of Disk Backed Message Buffer. + /// This setting controls whether Kubernetes CPU resource limits are requested. Increasing the number of replicas or workers proportionally increases the amount of CPU resources requested. If this setting is enabled and there are insufficient CPU resources, an error will be emitted. + /// Memory profile of Broker. + /// The status of the last operation. + /// A new instance for mocking. + public static BrokerProperties BrokerProperties(AdvancedSettings advanced = null, Cardinality cardinality = null, BrokerDiagnostics diagnostics = null, DiskBackedMessageBuffer diskBackedMessageBuffer = null, OperationalMode? generateResourceLimitsCpu = null, BrokerMemoryProfile? memoryProfile = null, ProvisioningState? provisioningState = null) + { + return new BrokerProperties( + advanced, + cardinality, + diagnostics, + diskBackedMessageBuffer, + generateResourceLimitsCpu != null ? new GenerateResourceLimits(generateResourceLimitsCpu, serializedAdditionalRawData: null) : null, + memoryProfile, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// The managed service identities assigned to this resource. + /// A new instance for mocking. + public static InstanceResourceData InstanceResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, InstanceProperties properties = null, ExtendedLocation extendedLocation = null, ManagedServiceIdentity identity = null) + { + tags ??= new Dictionary(); + + return new InstanceResourceData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + extendedLocation, + identity, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Detailed description of the Instance. + /// The status of the last operation. + /// The Azure IoT Operations version. + /// The reference to the Schema Registry for this AIO Instance. + /// A new instance for mocking. + public static InstanceProperties InstanceProperties(string description = null, ProvisioningState? provisioningState = null, string version = null, ResourceIdentifier schemaRegistryRefResourceId = null) + { + return new InstanceProperties(description, provisioningState, version, schemaRegistryRefResourceId != null ? new SchemaRegistryRef(schemaRegistryRefResourceId, serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResource.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResource.Serialization.cs new file mode 100644 index 000000000000..d5475abe9159 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class BrokerAuthenticationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + BrokerAuthenticationResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + BrokerAuthenticationResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResource.cs new file mode 100644 index 000000000000..591b603fc5cc --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResource.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A Class representing a BrokerAuthenticationResource 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 GetBrokerAuthenticationResource method. + /// Otherwise you can get one from its parent resource using the GetBrokerAuthenticationResource method. + /// + public partial class BrokerAuthenticationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instanceName. + /// The brokerName. + /// The authenticationName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authenticationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics; + private readonly BrokerAuthenticationRestOperations _brokerAuthenticationResourceBrokerAuthenticationRestClient; + private readonly BrokerAuthenticationResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IoTOperations/instances/brokers/authentications"; + + /// Initializes a new instance of the class for mocking. + protected BrokerAuthenticationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BrokerAuthenticationResource(ArmClient client, BrokerAuthenticationResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BrokerAuthenticationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string brokerAuthenticationResourceBrokerAuthenticationApiVersion); + _brokerAuthenticationResourceBrokerAuthenticationRestClient = new BrokerAuthenticationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, brokerAuthenticationResourceBrokerAuthenticationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual BrokerAuthenticationResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResource.Get"); + scope.Start(); + try + { + var response = await _brokerAuthenticationResourceBrokerAuthenticationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthenticationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResource.Get"); + scope.Start(); + try + { + var response = _brokerAuthenticationResourceBrokerAuthenticationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthenticationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResource.Delete"); + scope.Start(); + try + { + var response = await _brokerAuthenticationResourceBrokerAuthenticationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(_brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics, Pipeline, _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResource.Delete"); + scope.Start(); + try + { + var response = _brokerAuthenticationResourceBrokerAuthenticationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IoTOperationsArmOperation(_brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics, Pipeline, _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, BrokerAuthenticationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResource.Update"); + scope.Start(); + try + { + var response = await _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new BrokerAuthenticationResourceOperationSource(Client), _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics, Pipeline, _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, BrokerAuthenticationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResource.Update"); + scope.Start(); + try + { + var response = _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new BrokerAuthenticationResourceOperationSource(Client), _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics, Pipeline, _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceCollection.cs new file mode 100644 index 000000000000..94848cfa4f33 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// 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 GetBrokerAuthenticationResources method from an instance of . + /// + public partial class BrokerAuthenticationResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics; + private readonly BrokerAuthenticationRestOperations _brokerAuthenticationResourceBrokerAuthenticationRestClient; + + /// Initializes a new instance of the class for mocking. + protected BrokerAuthenticationResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal BrokerAuthenticationResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", BrokerAuthenticationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(BrokerAuthenticationResource.ResourceType, out string brokerAuthenticationResourceBrokerAuthenticationApiVersion); + _brokerAuthenticationResourceBrokerAuthenticationRestClient = new BrokerAuthenticationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, brokerAuthenticationResourceBrokerAuthenticationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != BrokerResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, BrokerResource.ResourceType), nameof(id)); + } + + /// + /// Create a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance broker authentication resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authenticationName, BrokerAuthenticationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new BrokerAuthenticationResourceOperationSource(Client), _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics, Pipeline, _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance broker authentication resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authenticationName, BrokerAuthenticationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new BrokerAuthenticationResourceOperationSource(Client), _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics, Pipeline, _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authentication resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResourceCollection.Get"); + scope.Start(); + try + { + var response = await _brokerAuthenticationResourceBrokerAuthenticationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthenticationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authentication resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResourceCollection.Get"); + scope.Start(); + try + { + var response = _brokerAuthenticationResourceBrokerAuthenticationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthenticationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List BrokerAuthenticationResource resources by BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BrokerAuthenticationResource(Client, BrokerAuthenticationResourceData.DeserializeBrokerAuthenticationResourceData(e)), _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics, Pipeline, "BrokerAuthenticationResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List BrokerAuthenticationResource resources by BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _brokerAuthenticationResourceBrokerAuthenticationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BrokerAuthenticationResource(Client, BrokerAuthenticationResourceData.DeserializeBrokerAuthenticationResourceData(e)), _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics, Pipeline, "BrokerAuthenticationResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authentication resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _brokerAuthenticationResourceBrokerAuthenticationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authentication resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResourceCollection.Exists"); + scope.Start(); + try + { + var response = _brokerAuthenticationResourceBrokerAuthenticationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authentication resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _brokerAuthenticationResourceBrokerAuthenticationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthenticationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authentication resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var scope = _brokerAuthenticationResourceBrokerAuthenticationClientDiagnostics.CreateScope("BrokerAuthenticationResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _brokerAuthenticationResourceBrokerAuthenticationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authenticationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthenticationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceData.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceData.Serialization.cs new file mode 100644 index 000000000000..c5a83019543b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceData.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class BrokerAuthenticationResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticationResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + } + + BrokerAuthenticationResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticationResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthenticationResourceData(document.RootElement, options); + } + + internal static BrokerAuthenticationResourceData DeserializeBrokerAuthenticationResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BrokerAuthenticationProperties properties = default; + ExtendedLocation extendedLocation = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BrokerAuthenticationProperties.DeserializeBrokerAuthenticationProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthenticationResourceData( + id, + name, + type, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthenticationResourceData)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthenticationResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthenticationResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthenticationResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceData.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceData.cs new file mode 100644 index 000000000000..7b6ef1b609e1 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthenticationResourceData.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A class representing the BrokerAuthenticationResource data model. + /// Instance broker authentication resource + /// + public partial class BrokerAuthenticationResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Edge location of the resource. + /// is null. + public BrokerAuthenticationResourceData(ExtendedLocation extendedLocation) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthenticationResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BrokerAuthenticationProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthenticationResourceData() + { + } + + /// The resource-specific properties for this resource. + public BrokerAuthenticationProperties Properties { get; set; } + /// Edge location of the resource. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResource.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResource.Serialization.cs new file mode 100644 index 000000000000..ee32487ae044 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class BrokerAuthorizationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + BrokerAuthorizationResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + BrokerAuthorizationResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResource.cs new file mode 100644 index 000000000000..58610983e2c1 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResource.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A Class representing a BrokerAuthorizationResource 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 GetBrokerAuthorizationResource method. + /// Otherwise you can get one from its parent resource using the GetBrokerAuthorizationResource method. + /// + public partial class BrokerAuthorizationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instanceName. + /// The brokerName. + /// The authorizationName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authorizationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics; + private readonly BrokerAuthorizationRestOperations _brokerAuthorizationResourceBrokerAuthorizationRestClient; + private readonly BrokerAuthorizationResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IoTOperations/instances/brokers/authorizations"; + + /// Initializes a new instance of the class for mocking. + protected BrokerAuthorizationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BrokerAuthorizationResource(ArmClient client, BrokerAuthorizationResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BrokerAuthorizationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string brokerAuthorizationResourceBrokerAuthorizationApiVersion); + _brokerAuthorizationResourceBrokerAuthorizationRestClient = new BrokerAuthorizationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, brokerAuthorizationResourceBrokerAuthorizationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual BrokerAuthorizationResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResource.Get"); + scope.Start(); + try + { + var response = await _brokerAuthorizationResourceBrokerAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthorizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResource.Get"); + scope.Start(); + try + { + var response = _brokerAuthorizationResourceBrokerAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthorizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResource.Delete"); + scope.Start(); + try + { + var response = await _brokerAuthorizationResourceBrokerAuthorizationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(_brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics, Pipeline, _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResource.Delete"); + scope.Start(); + try + { + var response = _brokerAuthorizationResourceBrokerAuthorizationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IoTOperationsArmOperation(_brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics, Pipeline, _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, BrokerAuthorizationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResource.Update"); + scope.Start(); + try + { + var response = await _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new BrokerAuthorizationResourceOperationSource(Client), _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics, Pipeline, _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, BrokerAuthorizationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResource.Update"); + scope.Start(); + try + { + var response = _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new BrokerAuthorizationResourceOperationSource(Client), _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics, Pipeline, _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceCollection.cs new file mode 100644 index 000000000000..ebd5264c0151 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// 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 GetBrokerAuthorizationResources method from an instance of . + /// + public partial class BrokerAuthorizationResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics; + private readonly BrokerAuthorizationRestOperations _brokerAuthorizationResourceBrokerAuthorizationRestClient; + + /// Initializes a new instance of the class for mocking. + protected BrokerAuthorizationResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal BrokerAuthorizationResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", BrokerAuthorizationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(BrokerAuthorizationResource.ResourceType, out string brokerAuthorizationResourceBrokerAuthorizationApiVersion); + _brokerAuthorizationResourceBrokerAuthorizationRestClient = new BrokerAuthorizationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, brokerAuthorizationResourceBrokerAuthorizationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != BrokerResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, BrokerResource.ResourceType), nameof(id)); + } + + /// + /// Create a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance broker authorization resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string authorizationName, BrokerAuthorizationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new BrokerAuthorizationResourceOperationSource(Client), _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics, Pipeline, _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance broker authorization resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string authorizationName, BrokerAuthorizationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new BrokerAuthorizationResourceOperationSource(Client), _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics, Pipeline, _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authorization resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResourceCollection.Get"); + scope.Start(); + try + { + var response = await _brokerAuthorizationResourceBrokerAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthorizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authorization resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResourceCollection.Get"); + scope.Start(); + try + { + var response = _brokerAuthorizationResourceBrokerAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthorizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List BrokerAuthorizationResource resources by BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BrokerAuthorizationResource(Client, BrokerAuthorizationResourceData.DeserializeBrokerAuthorizationResourceData(e)), _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics, Pipeline, "BrokerAuthorizationResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List BrokerAuthorizationResource resources by BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _brokerAuthorizationResourceBrokerAuthorizationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BrokerAuthorizationResource(Client, BrokerAuthorizationResourceData.DeserializeBrokerAuthorizationResourceData(e)), _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics, Pipeline, "BrokerAuthorizationResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authorization resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _brokerAuthorizationResourceBrokerAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authorization resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResourceCollection.Exists"); + scope.Start(); + try + { + var response = _brokerAuthorizationResourceBrokerAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authorization resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _brokerAuthorizationResourceBrokerAuthorizationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthorizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authorization resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var scope = _brokerAuthorizationResourceBrokerAuthorizationClientDiagnostics.CreateScope("BrokerAuthorizationResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _brokerAuthorizationResourceBrokerAuthorizationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, authorizationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BrokerAuthorizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceData.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceData.Serialization.cs new file mode 100644 index 000000000000..58c713cf6349 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceData.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class BrokerAuthorizationResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthorizationResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + } + + BrokerAuthorizationResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthorizationResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthorizationResourceData(document.RootElement, options); + } + + internal static BrokerAuthorizationResourceData DeserializeBrokerAuthorizationResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BrokerAuthorizationProperties properties = default; + ExtendedLocation extendedLocation = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BrokerAuthorizationProperties.DeserializeBrokerAuthorizationProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthorizationResourceData( + id, + name, + type, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthorizationResourceData)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthorizationResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthorizationResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthorizationResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceData.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceData.cs new file mode 100644 index 000000000000..006a048e3b06 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerAuthorizationResourceData.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A class representing the BrokerAuthorizationResource data model. + /// Instance broker authorizations resource + /// + public partial class BrokerAuthorizationResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Edge location of the resource. + /// is null. + public BrokerAuthorizationResourceData(ExtendedLocation extendedLocation) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthorizationResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BrokerAuthorizationProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthorizationResourceData() + { + } + + /// The resource-specific properties for this resource. + public BrokerAuthorizationProperties Properties { get; set; } + /// Edge location of the resource. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResource.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResource.Serialization.cs new file mode 100644 index 000000000000..e2cf75c6f20f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class BrokerListenerResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + BrokerListenerResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + BrokerListenerResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResource.cs new file mode 100644 index 000000000000..8fed3027791e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResource.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A Class representing a BrokerListenerResource 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 GetBrokerListenerResource method. + /// Otherwise you can get one from its parent resource using the GetBrokerListenerResource method. + /// + public partial class BrokerListenerResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instanceName. + /// The brokerName. + /// The listenerName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string listenerName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _brokerListenerResourceBrokerListenerClientDiagnostics; + private readonly BrokerListenerRestOperations _brokerListenerResourceBrokerListenerRestClient; + private readonly BrokerListenerResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IoTOperations/instances/brokers/listeners"; + + /// Initializes a new instance of the class for mocking. + protected BrokerListenerResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BrokerListenerResource(ArmClient client, BrokerListenerResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BrokerListenerResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _brokerListenerResourceBrokerListenerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string brokerListenerResourceBrokerListenerApiVersion); + _brokerListenerResourceBrokerListenerRestClient = new BrokerListenerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, brokerListenerResourceBrokerListenerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual BrokerListenerResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResource.Get"); + scope.Start(); + try + { + var response = await _brokerListenerResourceBrokerListenerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerListenerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResource.Get"); + scope.Start(); + try + { + var response = _brokerListenerResourceBrokerListenerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerListenerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResource.Delete"); + scope.Start(); + try + { + var response = await _brokerListenerResourceBrokerListenerRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(_brokerListenerResourceBrokerListenerClientDiagnostics, Pipeline, _brokerListenerResourceBrokerListenerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResource.Delete"); + scope.Start(); + try + { + var response = _brokerListenerResourceBrokerListenerRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IoTOperationsArmOperation(_brokerListenerResourceBrokerListenerClientDiagnostics, Pipeline, _brokerListenerResourceBrokerListenerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, BrokerListenerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResource.Update"); + scope.Start(); + try + { + var response = await _brokerListenerResourceBrokerListenerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new BrokerListenerResourceOperationSource(Client), _brokerListenerResourceBrokerListenerClientDiagnostics, Pipeline, _brokerListenerResourceBrokerListenerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, BrokerListenerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResource.Update"); + scope.Start(); + try + { + var response = _brokerListenerResourceBrokerListenerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new BrokerListenerResourceOperationSource(Client), _brokerListenerResourceBrokerListenerClientDiagnostics, Pipeline, _brokerListenerResourceBrokerListenerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceCollection.cs new file mode 100644 index 000000000000..487cfe41b51a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// 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 GetBrokerListenerResources method from an instance of . + /// + public partial class BrokerListenerResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _brokerListenerResourceBrokerListenerClientDiagnostics; + private readonly BrokerListenerRestOperations _brokerListenerResourceBrokerListenerRestClient; + + /// Initializes a new instance of the class for mocking. + protected BrokerListenerResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal BrokerListenerResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _brokerListenerResourceBrokerListenerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", BrokerListenerResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(BrokerListenerResource.ResourceType, out string brokerListenerResourceBrokerListenerApiVersion); + _brokerListenerResourceBrokerListenerRestClient = new BrokerListenerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, brokerListenerResourceBrokerListenerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != BrokerResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, BrokerResource.ResourceType), nameof(id)); + } + + /// + /// Create a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance broker listener resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string listenerName, BrokerListenerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _brokerListenerResourceBrokerListenerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new BrokerListenerResourceOperationSource(Client), _brokerListenerResourceBrokerListenerClientDiagnostics, Pipeline, _brokerListenerResourceBrokerListenerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance broker listener resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string listenerName, BrokerListenerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _brokerListenerResourceBrokerListenerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new BrokerListenerResourceOperationSource(Client), _brokerListenerResourceBrokerListenerClientDiagnostics, Pipeline, _brokerListenerResourceBrokerListenerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker listener resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResourceCollection.Get"); + scope.Start(); + try + { + var response = await _brokerListenerResourceBrokerListenerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerListenerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker listener resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResourceCollection.Get"); + scope.Start(); + try + { + var response = _brokerListenerResourceBrokerListenerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerListenerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List BrokerListenerResource resources by BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners + /// + /// + /// Operation Id + /// BrokerListenerResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _brokerListenerResourceBrokerListenerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _brokerListenerResourceBrokerListenerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BrokerListenerResource(Client, BrokerListenerResourceData.DeserializeBrokerListenerResourceData(e)), _brokerListenerResourceBrokerListenerClientDiagnostics, Pipeline, "BrokerListenerResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List BrokerListenerResource resources by BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners + /// + /// + /// Operation Id + /// BrokerListenerResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _brokerListenerResourceBrokerListenerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _brokerListenerResourceBrokerListenerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BrokerListenerResource(Client, BrokerListenerResourceData.DeserializeBrokerListenerResourceData(e)), _brokerListenerResourceBrokerListenerClientDiagnostics, Pipeline, "BrokerListenerResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker listener resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _brokerListenerResourceBrokerListenerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker listener resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResourceCollection.Exists"); + scope.Start(); + try + { + var response = _brokerListenerResourceBrokerListenerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker listener resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _brokerListenerResourceBrokerListenerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BrokerListenerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker listener resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var scope = _brokerListenerResourceBrokerListenerClientDiagnostics.CreateScope("BrokerListenerResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _brokerListenerResourceBrokerListenerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, listenerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BrokerListenerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceData.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceData.Serialization.cs new file mode 100644 index 000000000000..25188c8896ac --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceData.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class BrokerListenerResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerListenerResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + } + + BrokerListenerResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerListenerResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerListenerResourceData(document.RootElement, options); + } + + internal static BrokerListenerResourceData DeserializeBrokerListenerResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BrokerListenerProperties properties = default; + ExtendedLocation extendedLocation = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BrokerListenerProperties.DeserializeBrokerListenerProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerListenerResourceData( + id, + name, + type, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerListenerResourceData)} does not support writing '{options.Format}' format."); + } + } + + BrokerListenerResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerListenerResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerListenerResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceData.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceData.cs new file mode 100644 index 000000000000..e78c861ec340 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerListenerResourceData.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A class representing the BrokerListenerResource data model. + /// Instance broker resource + /// + public partial class BrokerListenerResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Edge location of the resource. + /// is null. + public BrokerListenerResourceData(ExtendedLocation extendedLocation) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// Keeps track of any properties unknown to the library. + internal BrokerListenerResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BrokerListenerProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerListenerResourceData() + { + } + + /// The resource-specific properties for this resource. + public BrokerListenerProperties Properties { get; set; } + /// Edge location of the resource. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResource.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResource.Serialization.cs new file mode 100644 index 000000000000..1c57df972270 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class BrokerResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + BrokerResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + BrokerResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResource.cs new file mode 100644 index 000000000000..5554687cbad8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResource.cs @@ -0,0 +1,554 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A Class representing a BrokerResource 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 GetBrokerResource method. + /// Otherwise you can get one from its parent resource using the GetBrokerResource method. + /// + public partial class BrokerResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instanceName. + /// The brokerName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _brokerResourceBrokerClientDiagnostics; + private readonly BrokerRestOperations _brokerResourceBrokerRestClient; + private readonly BrokerResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IoTOperations/instances/brokers"; + + /// Initializes a new instance of the class for mocking. + protected BrokerResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal BrokerResource(ArmClient client, BrokerResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal BrokerResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _brokerResourceBrokerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string brokerResourceBrokerApiVersion); + _brokerResourceBrokerRestClient = new BrokerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, brokerResourceBrokerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual BrokerResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of BrokerListenerResources in the BrokerResource. + /// An object representing collection of BrokerListenerResources and their operations over a BrokerListenerResource. + public virtual BrokerListenerResourceCollection GetBrokerListenerResources() + { + return GetCachedClient(client => new BrokerListenerResourceCollection(client, Id)); + } + + /// + /// Get a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker listener resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBrokerListenerResourceAsync(string listenerName, CancellationToken cancellationToken = default) + { + return await GetBrokerListenerResources().GetAsync(listenerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a BrokerListenerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/listeners/{listenerName} + /// + /// + /// Operation Id + /// BrokerListenerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker listener resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBrokerListenerResource(string listenerName, CancellationToken cancellationToken = default) + { + return GetBrokerListenerResources().Get(listenerName, cancellationToken); + } + + /// Gets a collection of BrokerAuthenticationResources in the BrokerResource. + /// An object representing collection of BrokerAuthenticationResources and their operations over a BrokerAuthenticationResource. + public virtual BrokerAuthenticationResourceCollection GetBrokerAuthenticationResources() + { + return GetCachedClient(client => new BrokerAuthenticationResourceCollection(client, Id)); + } + + /// + /// Get a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authentication resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBrokerAuthenticationResourceAsync(string authenticationName, CancellationToken cancellationToken = default) + { + return await GetBrokerAuthenticationResources().GetAsync(authenticationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a BrokerAuthenticationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authentications/{authenticationName} + /// + /// + /// Operation Id + /// BrokerAuthenticationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authentication resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBrokerAuthenticationResource(string authenticationName, CancellationToken cancellationToken = default) + { + return GetBrokerAuthenticationResources().Get(authenticationName, cancellationToken); + } + + /// Gets a collection of BrokerAuthorizationResources in the BrokerResource. + /// An object representing collection of BrokerAuthorizationResources and their operations over a BrokerAuthorizationResource. + public virtual BrokerAuthorizationResourceCollection GetBrokerAuthorizationResources() + { + return GetCachedClient(client => new BrokerAuthorizationResourceCollection(client, Id)); + } + + /// + /// Get a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authorization resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBrokerAuthorizationResourceAsync(string authorizationName, CancellationToken cancellationToken = default) + { + return await GetBrokerAuthorizationResources().GetAsync(authorizationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a BrokerAuthorizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName}/authorizations/{authorizationName} + /// + /// + /// Operation Id + /// BrokerAuthorizationResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance broker authorization resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBrokerAuthorizationResource(string authorizationName, CancellationToken cancellationToken = default) + { + return GetBrokerAuthorizationResources().Get(authorizationName, cancellationToken); + } + + /// + /// Get a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResource.Get"); + scope.Start(); + try + { + var response = await _brokerResourceBrokerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResource.Get"); + scope.Start(); + try + { + var response = _brokerResourceBrokerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResource.Delete"); + scope.Start(); + try + { + var response = await _brokerResourceBrokerRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(_brokerResourceBrokerClientDiagnostics, Pipeline, _brokerResourceBrokerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResource.Delete"); + scope.Start(); + try + { + var response = _brokerResourceBrokerRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IoTOperationsArmOperation(_brokerResourceBrokerClientDiagnostics, Pipeline, _brokerResourceBrokerRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, BrokerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResource.Update"); + scope.Start(); + try + { + var response = await _brokerResourceBrokerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new BrokerResourceOperationSource(Client), _brokerResourceBrokerClientDiagnostics, Pipeline, _brokerResourceBrokerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, BrokerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResource.Update"); + scope.Start(); + try + { + var response = _brokerResourceBrokerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new BrokerResourceOperationSource(Client), _brokerResourceBrokerClientDiagnostics, Pipeline, _brokerResourceBrokerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceCollection.cs new file mode 100644 index 000000000000..1a765171ea32 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// 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 GetBrokerResources method from an instance of . + /// + public partial class BrokerResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _brokerResourceBrokerClientDiagnostics; + private readonly BrokerRestOperations _brokerResourceBrokerRestClient; + + /// Initializes a new instance of the class for mocking. + protected BrokerResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal BrokerResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _brokerResourceBrokerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", BrokerResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(BrokerResource.ResourceType, out string brokerResourceBrokerApiVersion); + _brokerResourceBrokerRestClient = new BrokerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, brokerResourceBrokerApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != InstanceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, InstanceResource.ResourceType), nameof(id)); + } + + /// + /// Create a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of broker. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string brokerName, BrokerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _brokerResourceBrokerRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new BrokerResourceOperationSource(Client), _brokerResourceBrokerClientDiagnostics, Pipeline, _brokerResourceBrokerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of broker. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string brokerName, BrokerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _brokerResourceBrokerRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new BrokerResourceOperationSource(Client), _brokerResourceBrokerClientDiagnostics, Pipeline, _brokerResourceBrokerRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of broker. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResourceCollection.Get"); + scope.Start(); + try + { + var response = await _brokerResourceBrokerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of broker. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResourceCollection.Get"); + scope.Start(); + try + { + var response = _brokerResourceBrokerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new BrokerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List BrokerResource resources by InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers + /// + /// + /// Operation Id + /// BrokerResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _brokerResourceBrokerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _brokerResourceBrokerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new BrokerResource(Client, BrokerResourceData.DeserializeBrokerResourceData(e)), _brokerResourceBrokerClientDiagnostics, Pipeline, "BrokerResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List BrokerResource resources by InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers + /// + /// + /// Operation Id + /// BrokerResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _brokerResourceBrokerRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _brokerResourceBrokerRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new BrokerResource(Client, BrokerResourceData.DeserializeBrokerResourceData(e)), _brokerResourceBrokerClientDiagnostics, Pipeline, "BrokerResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of broker. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _brokerResourceBrokerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of broker. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResourceCollection.Exists"); + scope.Start(); + try + { + var response = _brokerResourceBrokerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of broker. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _brokerResourceBrokerRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BrokerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of broker. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var scope = _brokerResourceBrokerClientDiagnostics.CreateScope("BrokerResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _brokerResourceBrokerRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, brokerName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new BrokerResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceData.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceData.Serialization.cs new file mode 100644 index 000000000000..b4fccdeb96f6 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceData.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class BrokerResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + } + + BrokerResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerResourceData(document.RootElement, options); + } + + internal static BrokerResourceData DeserializeBrokerResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BrokerProperties properties = default; + ExtendedLocation extendedLocation = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = BrokerProperties.DeserializeBrokerProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerResourceData( + id, + name, + type, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerResourceData)} does not support writing '{options.Format}' format."); + } + } + + BrokerResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceData.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceData.cs new file mode 100644 index 000000000000..f53dd7c8822a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/BrokerResourceData.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A class representing the BrokerResource data model. + /// Instance broker resource + /// + public partial class BrokerResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Edge location of the resource. + /// is null. + public BrokerResourceData(ExtendedLocation extendedLocation) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// Keeps track of any properties unknown to the library. + internal BrokerResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BrokerProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerResourceData() + { + } + + /// The resource-specific properties for this resource. + public BrokerProperties Properties { get; set; } + /// Edge location of the resource. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResource.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResource.Serialization.cs new file mode 100644 index 000000000000..f76b1d2fb551 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class DataflowEndpointResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DataflowEndpointResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DataflowEndpointResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResource.cs new file mode 100644 index 000000000000..856adc1d84e3 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResource.cs @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A Class representing a DataflowEndpointResource 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 GetDataflowEndpointResource method. + /// Otherwise you can get one from its parent resource using the GetDataflowEndpointResource method. + /// + public partial class DataflowEndpointResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instanceName. + /// The dataflowEndpointName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instanceName, string dataflowEndpointName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataflowEndpointResourceDataflowEndpointClientDiagnostics; + private readonly DataflowEndpointRestOperations _dataflowEndpointResourceDataflowEndpointRestClient; + private readonly DataflowEndpointResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IoTOperations/instances/dataflowEndpoints"; + + /// Initializes a new instance of the class for mocking. + protected DataflowEndpointResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataflowEndpointResource(ArmClient client, DataflowEndpointResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal DataflowEndpointResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataflowEndpointResourceDataflowEndpointClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataflowEndpointResourceDataflowEndpointApiVersion); + _dataflowEndpointResourceDataflowEndpointRestClient = new DataflowEndpointRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataflowEndpointResourceDataflowEndpointApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DataflowEndpointResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResource.Get"); + scope.Start(); + try + { + var response = await _dataflowEndpointResourceDataflowEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResource.Get"); + scope.Start(); + try + { + var response = _dataflowEndpointResourceDataflowEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResource.Delete"); + scope.Start(); + try + { + var response = await _dataflowEndpointResourceDataflowEndpointRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(_dataflowEndpointResourceDataflowEndpointClientDiagnostics, Pipeline, _dataflowEndpointResourceDataflowEndpointRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResource.Delete"); + scope.Start(); + try + { + var response = _dataflowEndpointResourceDataflowEndpointRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IoTOperationsArmOperation(_dataflowEndpointResourceDataflowEndpointClientDiagnostics, Pipeline, _dataflowEndpointResourceDataflowEndpointRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataflowEndpointResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResource.Update"); + scope.Start(); + try + { + var response = await _dataflowEndpointResourceDataflowEndpointRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new DataflowEndpointResourceOperationSource(Client), _dataflowEndpointResourceDataflowEndpointClientDiagnostics, Pipeline, _dataflowEndpointResourceDataflowEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataflowEndpointResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResource.Update"); + scope.Start(); + try + { + var response = _dataflowEndpointResourceDataflowEndpointRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new DataflowEndpointResourceOperationSource(Client), _dataflowEndpointResourceDataflowEndpointClientDiagnostics, Pipeline, _dataflowEndpointResourceDataflowEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceCollection.cs new file mode 100644 index 000000000000..abe2074ba8f8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// 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 GetDataflowEndpointResources method from an instance of . + /// + public partial class DataflowEndpointResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataflowEndpointResourceDataflowEndpointClientDiagnostics; + private readonly DataflowEndpointRestOperations _dataflowEndpointResourceDataflowEndpointRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataflowEndpointResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal DataflowEndpointResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataflowEndpointResourceDataflowEndpointClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", DataflowEndpointResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataflowEndpointResource.ResourceType, out string dataflowEndpointResourceDataflowEndpointApiVersion); + _dataflowEndpointResourceDataflowEndpointRestClient = new DataflowEndpointRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataflowEndpointResourceDataflowEndpointApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != InstanceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, InstanceResource.ResourceType), nameof(id)); + } + + /// + /// Create a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance dataflowEndpoint resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dataflowEndpointName, DataflowEndpointResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataflowEndpointResourceDataflowEndpointRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new DataflowEndpointResourceOperationSource(Client), _dataflowEndpointResourceDataflowEndpointClientDiagnostics, Pipeline, _dataflowEndpointResourceDataflowEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance dataflowEndpoint resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dataflowEndpointName, DataflowEndpointResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataflowEndpointResourceDataflowEndpointRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new DataflowEndpointResourceOperationSource(Client), _dataflowEndpointResourceDataflowEndpointClientDiagnostics, Pipeline, _dataflowEndpointResourceDataflowEndpointRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowEndpoint resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResourceCollection.Get"); + scope.Start(); + try + { + var response = await _dataflowEndpointResourceDataflowEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowEndpoint resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResourceCollection.Get"); + scope.Start(); + try + { + var response = _dataflowEndpointResourceDataflowEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List DataflowEndpointResource resources by InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints + /// + /// + /// Operation Id + /// DataflowEndpointResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataflowEndpointResourceDataflowEndpointRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataflowEndpointResourceDataflowEndpointRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataflowEndpointResource(Client, DataflowEndpointResourceData.DeserializeDataflowEndpointResourceData(e)), _dataflowEndpointResourceDataflowEndpointClientDiagnostics, Pipeline, "DataflowEndpointResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List DataflowEndpointResource resources by InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints + /// + /// + /// Operation Id + /// DataflowEndpointResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataflowEndpointResourceDataflowEndpointRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataflowEndpointResourceDataflowEndpointRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataflowEndpointResource(Client, DataflowEndpointResourceData.DeserializeDataflowEndpointResourceData(e)), _dataflowEndpointResourceDataflowEndpointClientDiagnostics, Pipeline, "DataflowEndpointResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowEndpoint resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _dataflowEndpointResourceDataflowEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowEndpoint resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResourceCollection.Exists"); + scope.Start(); + try + { + var response = _dataflowEndpointResourceDataflowEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowEndpoint resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataflowEndpointResourceDataflowEndpointRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataflowEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowEndpoint resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var scope = _dataflowEndpointResourceDataflowEndpointClientDiagnostics.CreateScope("DataflowEndpointResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataflowEndpointResourceDataflowEndpointRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataflowEndpointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceData.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceData.Serialization.cs new file mode 100644 index 000000000000..09140862d3ba --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceData.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class DataflowEndpointResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + } + + DataflowEndpointResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointResourceData(document.RootElement, options); + } + + internal static DataflowEndpointResourceData DeserializeDataflowEndpointResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowEndpointProperties properties = default; + ExtendedLocation extendedLocation = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DataflowEndpointProperties.DeserializeDataflowEndpointProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointResourceData( + id, + name, + type, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointResourceData)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceData.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceData.cs new file mode 100644 index 000000000000..1ec697dfac10 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowEndpointResourceData.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A class representing the DataflowEndpointResource data model. + /// Instance dataflowEndpoint resource + /// + public partial class DataflowEndpointResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Edge location of the resource. + /// is null. + public DataflowEndpointResourceData(ExtendedLocation extendedLocation) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataflowEndpointProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointResourceData() + { + } + + /// The resource-specific properties for this resource. + public DataflowEndpointProperties Properties { get; set; } + /// Edge location of the resource. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResource.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResource.Serialization.cs new file mode 100644 index 000000000000..fb34f9925a03 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class DataflowProfileResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DataflowProfileResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DataflowProfileResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResource.cs new file mode 100644 index 000000000000..bfb6a20b23ee --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResource.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A Class representing a DataflowProfileResource 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 GetDataflowProfileResource method. + /// Otherwise you can get one from its parent resource using the GetDataflowProfileResource method. + /// + public partial class DataflowProfileResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instanceName. + /// The dataflowProfileName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataflowProfileResourceDataflowProfileClientDiagnostics; + private readonly DataflowProfileRestOperations _dataflowProfileResourceDataflowProfileRestClient; + private readonly DataflowProfileResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IoTOperations/instances/dataflowProfiles"; + + /// Initializes a new instance of the class for mocking. + protected DataflowProfileResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataflowProfileResource(ArmClient client, DataflowProfileResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal DataflowProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataflowProfileResourceDataflowProfileClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataflowProfileResourceDataflowProfileApiVersion); + _dataflowProfileResourceDataflowProfileRestClient = new DataflowProfileRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataflowProfileResourceDataflowProfileApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DataflowProfileResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of DataflowResources in the DataflowProfileResource. + /// An object representing collection of DataflowResources and their operations over a DataflowResource. + public virtual DataflowResourceCollection GetDataflowResources() + { + return GetCachedClient(client => new DataflowResourceCollection(client, Id)); + } + + /// + /// Get a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile dataflow resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataflowResourceAsync(string dataflowName, CancellationToken cancellationToken = default) + { + return await GetDataflowResources().GetAsync(dataflowName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile dataflow resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataflowResource(string dataflowName, CancellationToken cancellationToken = default) + { + return GetDataflowResources().Get(dataflowName, cancellationToken); + } + + /// + /// Get a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResource.Get"); + scope.Start(); + try + { + var response = await _dataflowProfileResourceDataflowProfileRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResource.Get"); + scope.Start(); + try + { + var response = _dataflowProfileResourceDataflowProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResource.Delete"); + scope.Start(); + try + { + var response = await _dataflowProfileResourceDataflowProfileRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(_dataflowProfileResourceDataflowProfileClientDiagnostics, Pipeline, _dataflowProfileResourceDataflowProfileRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResource.Delete"); + scope.Start(); + try + { + var response = _dataflowProfileResourceDataflowProfileRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IoTOperationsArmOperation(_dataflowProfileResourceDataflowProfileClientDiagnostics, Pipeline, _dataflowProfileResourceDataflowProfileRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataflowProfileResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResource.Update"); + scope.Start(); + try + { + var response = await _dataflowProfileResourceDataflowProfileRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new DataflowProfileResourceOperationSource(Client), _dataflowProfileResourceDataflowProfileClientDiagnostics, Pipeline, _dataflowProfileResourceDataflowProfileRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataflowProfileResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResource.Update"); + scope.Start(); + try + { + var response = _dataflowProfileResourceDataflowProfileRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new DataflowProfileResourceOperationSource(Client), _dataflowProfileResourceDataflowProfileClientDiagnostics, Pipeline, _dataflowProfileResourceDataflowProfileRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceCollection.cs new file mode 100644 index 000000000000..fd0382aea4b7 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// 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 GetDataflowProfileResources method from an instance of . + /// + public partial class DataflowProfileResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataflowProfileResourceDataflowProfileClientDiagnostics; + private readonly DataflowProfileRestOperations _dataflowProfileResourceDataflowProfileRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataflowProfileResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal DataflowProfileResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataflowProfileResourceDataflowProfileClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", DataflowProfileResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataflowProfileResource.ResourceType, out string dataflowProfileResourceDataflowProfileApiVersion); + _dataflowProfileResourceDataflowProfileRestClient = new DataflowProfileRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataflowProfileResourceDataflowProfileApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != InstanceResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, InstanceResource.ResourceType), nameof(id)); + } + + /// + /// Create a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance dataflowProfile resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dataflowProfileName, DataflowProfileResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataflowProfileResourceDataflowProfileRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new DataflowProfileResourceOperationSource(Client), _dataflowProfileResourceDataflowProfileClientDiagnostics, Pipeline, _dataflowProfileResourceDataflowProfileRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance dataflowProfile resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dataflowProfileName, DataflowProfileResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataflowProfileResourceDataflowProfileRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new DataflowProfileResourceOperationSource(Client), _dataflowProfileResourceDataflowProfileClientDiagnostics, Pipeline, _dataflowProfileResourceDataflowProfileRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResourceCollection.Get"); + scope.Start(); + try + { + var response = await _dataflowProfileResourceDataflowProfileRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResourceCollection.Get"); + scope.Start(); + try + { + var response = _dataflowProfileResourceDataflowProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List DataflowProfileResource resources by InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles + /// + /// + /// Operation Id + /// DataflowProfileResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataflowProfileResourceDataflowProfileRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataflowProfileResourceDataflowProfileRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataflowProfileResource(Client, DataflowProfileResourceData.DeserializeDataflowProfileResourceData(e)), _dataflowProfileResourceDataflowProfileClientDiagnostics, Pipeline, "DataflowProfileResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List DataflowProfileResource resources by InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles + /// + /// + /// Operation Id + /// DataflowProfileResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataflowProfileResourceDataflowProfileRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataflowProfileResourceDataflowProfileRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataflowProfileResource(Client, DataflowProfileResourceData.DeserializeDataflowProfileResourceData(e)), _dataflowProfileResourceDataflowProfileClientDiagnostics, Pipeline, "DataflowProfileResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _dataflowProfileResourceDataflowProfileRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResourceCollection.Exists"); + scope.Start(); + try + { + var response = _dataflowProfileResourceDataflowProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataflowProfileResourceDataflowProfileRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataflowProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var scope = _dataflowProfileResourceDataflowProfileClientDiagnostics.CreateScope("DataflowProfileResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataflowProfileResourceDataflowProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dataflowProfileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataflowProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceData.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceData.Serialization.cs new file mode 100644 index 000000000000..c2da85c79547 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceData.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class DataflowProfileResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowProfileResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + } + + DataflowProfileResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowProfileResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowProfileResourceData(document.RootElement, options); + } + + internal static DataflowProfileResourceData DeserializeDataflowProfileResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowProfileProperties properties = default; + ExtendedLocation extendedLocation = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DataflowProfileProperties.DeserializeDataflowProfileProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowProfileResourceData( + id, + name, + type, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowProfileResourceData)} does not support writing '{options.Format}' format."); + } + } + + DataflowProfileResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowProfileResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowProfileResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceData.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceData.cs new file mode 100644 index 000000000000..84ffbdd6b712 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowProfileResourceData.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A class representing the DataflowProfileResource data model. + /// Instance dataflowProfile resource + /// + public partial class DataflowProfileResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Edge location of the resource. + /// is null. + public DataflowProfileResourceData(ExtendedLocation extendedLocation) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// Keeps track of any properties unknown to the library. + internal DataflowProfileResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataflowProfileProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowProfileResourceData() + { + } + + /// The resource-specific properties for this resource. + public DataflowProfileProperties Properties { get; set; } + /// Edge location of the resource. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResource.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResource.Serialization.cs new file mode 100644 index 000000000000..fc198d94f68a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class DataflowResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DataflowResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DataflowResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResource.cs new file mode 100644 index 000000000000..98912f7f5fa9 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResource.cs @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A Class representing a DataflowResource 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 GetDataflowResource method. + /// Otherwise you can get one from its parent resource using the GetDataflowResource method. + /// + public partial class DataflowResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instanceName. + /// The dataflowProfileName. + /// The dataflowName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, string dataflowName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataflowResourceDataflowClientDiagnostics; + private readonly DataflowRestOperations _dataflowResourceDataflowRestClient; + private readonly DataflowResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IoTOperations/instances/dataflowProfiles/dataflows"; + + /// Initializes a new instance of the class for mocking. + protected DataflowResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataflowResource(ArmClient client, DataflowResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal DataflowResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataflowResourceDataflowClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataflowResourceDataflowApiVersion); + _dataflowResourceDataflowRestClient = new DataflowRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataflowResourceDataflowApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DataflowResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResource.Get"); + scope.Start(); + try + { + var response = await _dataflowResourceDataflowRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResource.Get"); + scope.Start(); + try + { + var response = _dataflowResourceDataflowRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResource.Delete"); + scope.Start(); + try + { + var response = await _dataflowResourceDataflowRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(_dataflowResourceDataflowClientDiagnostics, Pipeline, _dataflowResourceDataflowRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResource.Delete"); + scope.Start(); + try + { + var response = _dataflowResourceDataflowRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new IoTOperationsArmOperation(_dataflowResourceDataflowClientDiagnostics, Pipeline, _dataflowResourceDataflowRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataflowResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResource.Update"); + scope.Start(); + try + { + var response = await _dataflowResourceDataflowRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new DataflowResourceOperationSource(Client), _dataflowResourceDataflowClientDiagnostics, Pipeline, _dataflowResourceDataflowRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataflowResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResource.Update"); + scope.Start(); + try + { + var response = _dataflowResourceDataflowRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new DataflowResourceOperationSource(Client), _dataflowResourceDataflowClientDiagnostics, Pipeline, _dataflowResourceDataflowRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceCollection.cs new file mode 100644 index 000000000000..89b1779de4a0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// 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 GetDataflowResources method from an instance of . + /// + public partial class DataflowResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataflowResourceDataflowClientDiagnostics; + private readonly DataflowRestOperations _dataflowResourceDataflowRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataflowResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal DataflowResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataflowResourceDataflowClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", DataflowResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataflowResource.ResourceType, out string dataflowResourceDataflowApiVersion); + _dataflowResourceDataflowRestClient = new DataflowRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataflowResourceDataflowApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataflowProfileResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataflowProfileResource.ResourceType), nameof(id)); + } + + /// + /// Create a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance dataflowProfile dataflow resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dataflowName, DataflowResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataflowResourceDataflowRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new DataflowResourceOperationSource(Client), _dataflowResourceDataflowClientDiagnostics, Pipeline, _dataflowResourceDataflowRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of Instance dataflowProfile dataflow resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dataflowName, DataflowResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataflowResourceDataflowRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new DataflowResourceOperationSource(Client), _dataflowResourceDataflowClientDiagnostics, Pipeline, _dataflowResourceDataflowRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile dataflow resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResourceCollection.Get"); + scope.Start(); + try + { + var response = await _dataflowResourceDataflowRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a DataflowResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile dataflow resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResourceCollection.Get"); + scope.Start(); + try + { + var response = _dataflowResourceDataflowRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List DataflowResource resources by DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows + /// + /// + /// Operation Id + /// DataflowResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataflowResourceDataflowRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataflowResourceDataflowRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataflowResource(Client, DataflowResourceData.DeserializeDataflowResourceData(e)), _dataflowResourceDataflowClientDiagnostics, Pipeline, "DataflowResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List DataflowResource resources by DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows + /// + /// + /// Operation Id + /// DataflowResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataflowResourceDataflowRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataflowResourceDataflowRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataflowResource(Client, DataflowResourceData.DeserializeDataflowResourceData(e)), _dataflowResourceDataflowClientDiagnostics, Pipeline, "DataflowResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile dataflow resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _dataflowResourceDataflowRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile dataflow resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResourceCollection.Exists"); + scope.Start(); + try + { + var response = _dataflowResourceDataflowRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile dataflow resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dataflowResourceDataflowRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName}/dataflows/{dataflowName} + /// + /// + /// Operation Id + /// DataflowResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile dataflow resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var scope = _dataflowResourceDataflowClientDiagnostics.CreateScope("DataflowResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dataflowResourceDataflowRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataflowName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DataflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceData.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceData.Serialization.cs new file mode 100644 index 000000000000..e9dd69141122 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceData.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class DataflowResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + } + + DataflowResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowResourceData(document.RootElement, options); + } + + internal static DataflowResourceData DeserializeDataflowResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowProperties properties = default; + ExtendedLocation extendedLocation = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DataflowProperties.DeserializeDataflowProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowResourceData( + id, + name, + type, + systemData, + properties, + extendedLocation, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowResourceData)} does not support writing '{options.Format}' format."); + } + } + + DataflowResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceData.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceData.cs new file mode 100644 index 000000000000..13f7d477956c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/DataflowResourceData.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A class representing the DataflowResource data model. + /// Instance dataflowProfile dataflow resource + /// + public partial class DataflowResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Edge location of the resource. + /// is null. + public DataflowResourceData(ExtendedLocation extendedLocation) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// Keeps track of any properties unknown to the library. + internal DataflowResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataflowProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowResourceData() + { + } + + /// The resource-specific properties for this resource. + public DataflowProperties Properties { get; set; } + /// Edge location of the resource. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/IoTOperationsExtensions.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/IoTOperationsExtensions.cs new file mode 100644 index 000000000000..d7dd9431b76f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/IoTOperationsExtensions.cs @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.IoTOperations +{ + /// A class to add extension methods to Azure.ResourceManager.IoTOperations. + public static partial class IoTOperationsExtensions + { + private static MockableIoTOperationsArmClient GetMockableIoTOperationsArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableIoTOperationsArmClient(client0)); + } + + private static MockableIoTOperationsResourceGroupResource GetMockableIoTOperationsResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableIoTOperationsResourceGroupResource(client, resource.Id)); + } + + private static MockableIoTOperationsSubscriptionResource GetMockableIoTOperationsSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableIoTOperationsSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static InstanceResource GetInstanceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableIoTOperationsArmClient(client).GetInstanceResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static BrokerResource GetBrokerResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableIoTOperationsArmClient(client).GetBrokerResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static BrokerListenerResource GetBrokerListenerResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableIoTOperationsArmClient(client).GetBrokerListenerResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static BrokerAuthenticationResource GetBrokerAuthenticationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableIoTOperationsArmClient(client).GetBrokerAuthenticationResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static BrokerAuthorizationResource GetBrokerAuthorizationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableIoTOperationsArmClient(client).GetBrokerAuthorizationResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DataflowProfileResource GetDataflowProfileResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableIoTOperationsArmClient(client).GetDataflowProfileResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DataflowResource GetDataflowResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableIoTOperationsArmClient(client).GetDataflowResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DataflowEndpointResource GetDataflowEndpointResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableIoTOperationsArmClient(client).GetDataflowEndpointResource(id); + } + + /// + /// Gets a collection of InstanceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of InstanceResources and their operations over a InstanceResource. + public static InstanceResourceCollection GetInstanceResources(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableIoTOperationsResourceGroupResource(resourceGroupResource).GetInstanceResources(); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of instance. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetInstanceResourceAsync(this ResourceGroupResource resourceGroupResource, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableIoTOperationsResourceGroupResource(resourceGroupResource).GetInstanceResourceAsync(instanceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of instance. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetInstanceResource(this ResourceGroupResource resourceGroupResource, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableIoTOperationsResourceGroupResource(resourceGroupResource).GetInstanceResource(instanceName, cancellationToken); + } + + /// + /// List InstanceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTOperations/instances + /// + /// + /// Operation Id + /// InstanceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance 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. + public static AsyncPageable GetInstanceResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableIoTOperationsSubscriptionResource(subscriptionResource).GetInstanceResourcesAsync(cancellationToken); + } + + /// + /// List InstanceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTOperations/instances + /// + /// + /// Operation Id + /// InstanceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetInstanceResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableIoTOperationsSubscriptionResource(subscriptionResource).GetInstanceResources(cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsArmClient.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsArmClient.cs new file mode 100644 index 000000000000..00ca2a20d7e9 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsArmClient.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableIoTOperationsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableIoTOperationsArmClient() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableIoTOperationsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableIoTOperationsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual InstanceResource GetInstanceResource(ResourceIdentifier id) + { + InstanceResource.ValidateResourceId(id); + return new InstanceResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BrokerResource GetBrokerResource(ResourceIdentifier id) + { + BrokerResource.ValidateResourceId(id); + return new BrokerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BrokerListenerResource GetBrokerListenerResource(ResourceIdentifier id) + { + BrokerListenerResource.ValidateResourceId(id); + return new BrokerListenerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BrokerAuthenticationResource GetBrokerAuthenticationResource(ResourceIdentifier id) + { + BrokerAuthenticationResource.ValidateResourceId(id); + return new BrokerAuthenticationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual BrokerAuthorizationResource GetBrokerAuthorizationResource(ResourceIdentifier id) + { + BrokerAuthorizationResource.ValidateResourceId(id); + return new BrokerAuthorizationResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataflowProfileResource GetDataflowProfileResource(ResourceIdentifier id) + { + DataflowProfileResource.ValidateResourceId(id); + return new DataflowProfileResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataflowResource GetDataflowResource(ResourceIdentifier id) + { + DataflowResource.ValidateResourceId(id); + return new DataflowResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DataflowEndpointResource GetDataflowEndpointResource(ResourceIdentifier id) + { + DataflowEndpointResource.ValidateResourceId(id); + return new DataflowEndpointResource(Client, id); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsResourceGroupResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsResourceGroupResource.cs new file mode 100644 index 000000000000..59476d7c1265 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableIoTOperationsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableIoTOperationsResourceGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableIoTOperationsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of InstanceResources in the ResourceGroupResource. + /// An object representing collection of InstanceResources and their operations over a InstanceResource. + public virtual InstanceResourceCollection GetInstanceResources() + { + return GetCachedClient(client => new InstanceResourceCollection(client, Id)); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetInstanceResourceAsync(string instanceName, CancellationToken cancellationToken = default) + { + return await GetInstanceResources().GetAsync(instanceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of instance. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetInstanceResource(string instanceName, CancellationToken cancellationToken = default) + { + return GetInstanceResources().Get(instanceName, cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsSubscriptionResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsSubscriptionResource.cs new file mode 100644 index 000000000000..fbbfc1b50a1e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Extensions/MockableIoTOperationsSubscriptionResource.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableIoTOperationsSubscriptionResource : ArmResource + { + private ClientDiagnostics _instanceResourceInstanceClientDiagnostics; + private InstanceRestOperations _instanceResourceInstanceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableIoTOperationsSubscriptionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableIoTOperationsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics InstanceResourceInstanceClientDiagnostics => _instanceResourceInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.IoTOperations", InstanceResource.ResourceType.Namespace, Diagnostics); + private InstanceRestOperations InstanceResourceInstanceRestClient => _instanceResourceInstanceRestClient ??= new InstanceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstanceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List InstanceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTOperations/instances + /// + /// + /// Operation Id + /// InstanceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetInstanceResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstanceResourceInstanceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstanceResourceInstanceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstanceResource(Client, InstanceResourceData.DeserializeInstanceResourceData(e)), InstanceResourceInstanceClientDiagnostics, Pipeline, "MockableIoTOperationsSubscriptionResource.GetInstanceResources", "value", "nextLink", cancellationToken); + } + + /// + /// List InstanceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.IoTOperations/instances + /// + /// + /// Operation Id + /// InstanceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetInstanceResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstanceResourceInstanceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstanceResourceInstanceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstanceResource(Client, InstanceResourceData.DeserializeInstanceResourceData(e)), InstanceResourceInstanceClientDiagnostics, Pipeline, "MockableIoTOperationsSubscriptionResource.GetInstanceResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResource.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResource.Serialization.cs new file mode 100644 index 000000000000..2daa5a465cdc --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class InstanceResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + InstanceResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + InstanceResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResource.cs new file mode 100644 index 000000000000..49ec5916443b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResource.cs @@ -0,0 +1,906 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A Class representing an InstanceResource along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetInstanceResource method. + /// Otherwise you can get one from its parent resource using the GetInstanceResource method. + /// + public partial class InstanceResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instanceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instanceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _instanceResourceInstanceClientDiagnostics; + private readonly InstanceRestOperations _instanceResourceInstanceRestClient; + private readonly InstanceResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.IoTOperations/instances"; + + /// Initializes a new instance of the class for mocking. + protected InstanceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal InstanceResource(ArmClient client, InstanceResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal InstanceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _instanceResourceInstanceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string instanceResourceInstanceApiVersion); + _instanceResourceInstanceRestClient = new InstanceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, instanceResourceInstanceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual InstanceResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of BrokerResources in the InstanceResource. + /// An object representing collection of BrokerResources and their operations over a BrokerResource. + public virtual BrokerResourceCollection GetBrokerResources() + { + return GetCachedClient(client => new BrokerResourceCollection(client, Id)); + } + + /// + /// Get a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of broker. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetBrokerResourceAsync(string brokerName, CancellationToken cancellationToken = default) + { + return await GetBrokerResources().GetAsync(brokerName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a BrokerResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/brokers/{brokerName} + /// + /// + /// Operation Id + /// BrokerResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of broker. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetBrokerResource(string brokerName, CancellationToken cancellationToken = default) + { + return GetBrokerResources().Get(brokerName, cancellationToken); + } + + /// Gets a collection of DataflowProfileResources in the InstanceResource. + /// An object representing collection of DataflowProfileResources and their operations over a DataflowProfileResource. + public virtual DataflowProfileResourceCollection GetDataflowProfileResources() + { + return GetCachedClient(client => new DataflowProfileResourceCollection(client, Id)); + } + + /// + /// Get a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataflowProfileResourceAsync(string dataflowProfileName, CancellationToken cancellationToken = default) + { + return await GetDataflowProfileResources().GetAsync(dataflowProfileName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a DataflowProfileResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowProfiles/{dataflowProfileName} + /// + /// + /// Operation Id + /// DataflowProfileResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataflowProfileResource(string dataflowProfileName, CancellationToken cancellationToken = default) + { + return GetDataflowProfileResources().Get(dataflowProfileName, cancellationToken); + } + + /// Gets a collection of DataflowEndpointResources in the InstanceResource. + /// An object representing collection of DataflowEndpointResources and their operations over a DataflowEndpointResource. + public virtual DataflowEndpointResourceCollection GetDataflowEndpointResources() + { + return GetCachedClient(client => new DataflowEndpointResourceCollection(client, Id)); + } + + /// + /// Get a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowEndpoint resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDataflowEndpointResourceAsync(string dataflowEndpointName, CancellationToken cancellationToken = default) + { + return await GetDataflowEndpointResources().GetAsync(dataflowEndpointName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a DataflowEndpointResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName}/dataflowEndpoints/{dataflowEndpointName} + /// + /// + /// Operation Id + /// DataflowEndpointResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of Instance dataflowEndpoint resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDataflowEndpointResource(string dataflowEndpointName, CancellationToken cancellationToken = default) + { + return GetDataflowEndpointResources().Get(dataflowEndpointName, cancellationToken); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.Get"); + scope.Start(); + try + { + var response = await _instanceResourceInstanceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.Get"); + scope.Start(); + try + { + var response = _instanceResourceInstanceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.Delete"); + scope.Start(); + try + { + var response = await _instanceResourceInstanceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(_instanceResourceInstanceClientDiagnostics, Pipeline, _instanceResourceInstanceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Delete + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.Delete"); + scope.Start(); + try + { + var response = _instanceResourceInstanceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new IoTOperationsArmOperation(_instanceResourceInstanceClientDiagnostics, Pipeline, _instanceResourceInstanceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Update + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(InstanceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.Update"); + scope.Start(); + try + { + var response = await _instanceResourceInstanceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Update + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(InstanceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.Update"); + scope.Start(); + try + { + var response = _instanceResourceInstanceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _instanceResourceInstanceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new InstanceResourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _instanceResourceInstanceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new InstanceResourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _instanceResourceInstanceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new InstanceResourcePatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _instanceResourceInstanceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new InstanceResourcePatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _instanceResourceInstanceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new InstanceResourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _instanceResourceInstanceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new InstanceResourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceCollection.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceCollection.cs new file mode 100644 index 000000000000..f81654aab3b9 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetInstanceResources method from an instance of . + /// + public partial class InstanceResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _instanceResourceInstanceClientDiagnostics; + private readonly InstanceRestOperations _instanceResourceInstanceRestClient; + + /// Initializes a new instance of the class for mocking. + protected InstanceResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal InstanceResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _instanceResourceInstanceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.IoTOperations", InstanceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(InstanceResource.ResourceType, out string instanceResourceInstanceApiVersion); + _instanceResourceInstanceRestClient = new InstanceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, instanceResourceInstanceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of instance. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string instanceName, InstanceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _instanceResourceInstanceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, instanceName, data, cancellationToken).ConfigureAwait(false); + var operation = new IoTOperationsArmOperation(new InstanceResourceOperationSource(Client), _instanceResourceInstanceClientDiagnostics, Pipeline, _instanceResourceInstanceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, instanceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of instance. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string instanceName, InstanceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _instanceResourceInstanceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, instanceName, data, cancellationToken); + var operation = new IoTOperationsArmOperation(new InstanceResourceOperationSource(Client), _instanceResourceInstanceClientDiagnostics, Pipeline, _instanceResourceInstanceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, instanceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResourceCollection.Get"); + scope.Start(); + try + { + var response = await _instanceResourceInstanceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, instanceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResourceCollection.Get"); + scope.Start(); + try + { + var response = _instanceResourceInstanceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, instanceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List InstanceResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances + /// + /// + /// Operation Id + /// InstanceResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _instanceResourceInstanceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _instanceResourceInstanceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstanceResource(Client, InstanceResourceData.DeserializeInstanceResourceData(e)), _instanceResourceInstanceClientDiagnostics, Pipeline, "InstanceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List InstanceResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances + /// + /// + /// Operation Id + /// InstanceResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _instanceResourceInstanceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _instanceResourceInstanceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstanceResource(Client, InstanceResourceData.DeserializeInstanceResourceData(e)), _instanceResourceInstanceClientDiagnostics, Pipeline, "InstanceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _instanceResourceInstanceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, instanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResourceCollection.Exists"); + scope.Start(); + try + { + var response = _instanceResourceInstanceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, instanceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _instanceResourceInstanceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, instanceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTOperations/instances/{instanceName} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of instance. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var scope = _instanceResourceInstanceClientDiagnostics.CreateScope("InstanceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _instanceResourceInstanceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, instanceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceData.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceData.Serialization.cs new file mode 100644 index 000000000000..b08e0c7d7bbb --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceData.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + public partial class InstanceResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InstanceResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + writer.WritePropertyName("extendedLocation"u8); + writer.WriteObjectValue(ExtendedLocation, options); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + } + + InstanceResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InstanceResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceResourceData(document.RootElement, options); + } + + internal static InstanceResourceData DeserializeInstanceResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InstanceProperties properties = default; + ExtendedLocation extendedLocation = default; + ManagedServiceIdentity identity = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = InstanceProperties.DeserializeInstanceProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value, options); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InstanceResourceData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + extendedLocation, + identity, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InstanceResourceData)} does not support writing '{options.Format}' format."); + } + } + + InstanceResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInstanceResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstanceResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceData.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceData.cs new file mode 100644 index 000000000000..dc09f776f48e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/InstanceResourceData.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.IoTOperations.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + /// + /// A class representing the InstanceResource data model. + /// A Instance resource is a logical container for a set of child resources. + /// + public partial class InstanceResourceData : 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; + + /// Initializes a new instance of . + /// The location. + /// Edge location of the resource. + /// is null. + public InstanceResourceData(AzureLocation location, ExtendedLocation extendedLocation) : base(location) + { + Argument.AssertNotNull(extendedLocation, nameof(extendedLocation)); + + ExtendedLocation = extendedLocation; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// Edge location of the resource. + /// The managed service identities assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal InstanceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, InstanceProperties properties, ExtendedLocation extendedLocation, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + ExtendedLocation = extendedLocation; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InstanceResourceData() + { + } + + /// The resource-specific properties for this resource. + public InstanceProperties Properties { get; set; } + /// Edge location of the resource. + public ExtendedLocation ExtendedLocation { get; set; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Argument.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..0ec4444a51f6 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..4b585e4ae23c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ChangeTrackingList.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..dec119e3255e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..6239700cd422 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// 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.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal static class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var 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(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + 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"); + } + + public static string GetRequiredString(this JsonElement element) + { + var 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}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Optional.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..2f37e2116697 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.IoTOperations +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..a829e34d2020 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + 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; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerAuthenticationResourceOperationSource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerAuthenticationResourceOperationSource.cs new file mode 100644 index 000000000000..b8f106f34973 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerAuthenticationResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class BrokerAuthenticationResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal BrokerAuthenticationResourceOperationSource(ArmClient client) + { + _client = client; + } + + BrokerAuthenticationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = BrokerAuthenticationResourceData.DeserializeBrokerAuthenticationResourceData(document.RootElement); + return new BrokerAuthenticationResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = BrokerAuthenticationResourceData.DeserializeBrokerAuthenticationResourceData(document.RootElement); + return new BrokerAuthenticationResource(_client, data); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerAuthorizationResourceOperationSource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerAuthorizationResourceOperationSource.cs new file mode 100644 index 000000000000..5312441a1085 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerAuthorizationResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class BrokerAuthorizationResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal BrokerAuthorizationResourceOperationSource(ArmClient client) + { + _client = client; + } + + BrokerAuthorizationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = BrokerAuthorizationResourceData.DeserializeBrokerAuthorizationResourceData(document.RootElement); + return new BrokerAuthorizationResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = BrokerAuthorizationResourceData.DeserializeBrokerAuthorizationResourceData(document.RootElement); + return new BrokerAuthorizationResource(_client, data); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerListenerResourceOperationSource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerListenerResourceOperationSource.cs new file mode 100644 index 000000000000..c2d9454983fc --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerListenerResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class BrokerListenerResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal BrokerListenerResourceOperationSource(ArmClient client) + { + _client = client; + } + + BrokerListenerResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = BrokerListenerResourceData.DeserializeBrokerListenerResourceData(document.RootElement); + return new BrokerListenerResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = BrokerListenerResourceData.DeserializeBrokerListenerResourceData(document.RootElement); + return new BrokerListenerResource(_client, data); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerResourceOperationSource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerResourceOperationSource.cs new file mode 100644 index 000000000000..59d7a6f98f32 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/BrokerResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class BrokerResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal BrokerResourceOperationSource(ArmClient client) + { + _client = client; + } + + BrokerResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = BrokerResourceData.DeserializeBrokerResourceData(document.RootElement); + return new BrokerResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = BrokerResourceData.DeserializeBrokerResourceData(document.RootElement); + return new BrokerResource(_client, data); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowEndpointResourceOperationSource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowEndpointResourceOperationSource.cs new file mode 100644 index 000000000000..e90184329f66 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowEndpointResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class DataflowEndpointResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DataflowEndpointResourceOperationSource(ArmClient client) + { + _client = client; + } + + DataflowEndpointResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DataflowEndpointResourceData.DeserializeDataflowEndpointResourceData(document.RootElement); + return new DataflowEndpointResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DataflowEndpointResourceData.DeserializeDataflowEndpointResourceData(document.RootElement); + return new DataflowEndpointResource(_client, data); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowProfileResourceOperationSource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowProfileResourceOperationSource.cs new file mode 100644 index 000000000000..ea2ad439a143 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowProfileResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class DataflowProfileResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DataflowProfileResourceOperationSource(ArmClient client) + { + _client = client; + } + + DataflowProfileResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DataflowProfileResourceData.DeserializeDataflowProfileResourceData(document.RootElement); + return new DataflowProfileResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DataflowProfileResourceData.DeserializeDataflowProfileResourceData(document.RootElement); + return new DataflowProfileResource(_client, data); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowResourceOperationSource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowResourceOperationSource.cs new file mode 100644 index 000000000000..10270263937d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/DataflowResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class DataflowResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DataflowResourceOperationSource(ArmClient client) + { + _client = client; + } + + DataflowResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DataflowResourceData.DeserializeDataflowResourceData(document.RootElement); + return new DataflowResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DataflowResourceData.DeserializeDataflowResourceData(document.RootElement); + return new DataflowResource(_client, data); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/InstanceResourceOperationSource.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/InstanceResourceOperationSource.cs new file mode 100644 index 000000000000..e3e16d0a7f8d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/InstanceResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations +{ + internal class InstanceResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal InstanceResourceOperationSource(ArmClient client) + { + _client = client; + } + + InstanceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return new InstanceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return new InstanceResource(_client, data); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/IoTOperationsArmOperation.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/IoTOperationsArmOperation.cs new file mode 100644 index 000000000000..1fe85ac9e64e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/IoTOperationsArmOperation.cs @@ -0,0 +1,94 @@ +// 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.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ +#pragma warning disable SA1649 // File name should match first type name + internal class IoTOperationsArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of IoTOperationsArmOperation for mocking. + protected IoTOperationsArmOperation() + { + } + + internal IoTOperationsArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal IoTOperationsArmOperation(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) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "IoTOperationsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/IoTOperationsArmOperationOfT.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/IoTOperationsArmOperationOfT.cs new file mode 100644 index 000000000000..5faed18fa995 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/LongRunningOperation/IoTOperationsArmOperationOfT.cs @@ -0,0 +1,100 @@ +// 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.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ +#pragma warning disable SA1649 // File name should match first type name + internal class IoTOperationsArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of IoTOperationsArmOperation for mocking. + protected IoTOperationsArmOperation() + { + } + + internal IoTOperationsArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal IoTOperationsArmOperation(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) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "IoTOperationsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + 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 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AdvancedSettings.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AdvancedSettings.Serialization.cs new file mode 100644 index 000000000000..ae6ee231be6d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AdvancedSettings.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class AdvancedSettings : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedSettings)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Clients)) + { + writer.WritePropertyName("clients"u8); + writer.WriteObjectValue(Clients, options); + } + if (Optional.IsDefined(EncryptInternalTraffic)) + { + writer.WritePropertyName("encryptInternalTraffic"u8); + writer.WriteStringValue(EncryptInternalTraffic.Value.ToString()); + } + if (Optional.IsDefined(InternalCerts)) + { + writer.WritePropertyName("internalCerts"u8); + writer.WriteObjectValue(InternalCerts, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AdvancedSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AdvancedSettings)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAdvancedSettings(document.RootElement, options); + } + + internal static AdvancedSettings DeserializeAdvancedSettings(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ClientConfig clients = default; + OperationalMode? encryptInternalTraffic = default; + CertManagerCertOptions internalCerts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clients"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clients = ClientConfig.DeserializeClientConfig(property.Value, options); + continue; + } + if (property.NameEquals("encryptInternalTraffic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryptInternalTraffic = new OperationalMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("internalCerts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + internalCerts = CertManagerCertOptions.DeserializeCertManagerCertOptions(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AdvancedSettings(clients, encryptInternalTraffic, internalCerts, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AdvancedSettings)} does not support writing '{options.Format}' format."); + } + } + + AdvancedSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAdvancedSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AdvancedSettings)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AdvancedSettings.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AdvancedSettings.cs new file mode 100644 index 000000000000..c4a28a3c7846 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AdvancedSettings.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Advanced Settings. + public partial class AdvancedSettings + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AdvancedSettings() + { + } + + /// Initializes a new instance of . + /// Configurations related to All Clients. + /// The setting to enable or disable encryption of internal Traffic. + /// Certificate rotation and private key configuration. + /// Keeps track of any properties unknown to the library. + internal AdvancedSettings(ClientConfig clients, OperationalMode? encryptInternalTraffic, CertManagerCertOptions internalCerts, IDictionary serializedAdditionalRawData) + { + Clients = clients; + EncryptInternalTraffic = encryptInternalTraffic; + InternalCerts = internalCerts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Configurations related to All Clients. + public ClientConfig Clients { get; set; } + /// The setting to enable or disable encryption of internal Traffic. + public OperationalMode? EncryptInternalTraffic { get; set; } + /// Certificate rotation and private key configuration. + public CertManagerCertOptions InternalCerts { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationConfig.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationConfig.Serialization.cs new file mode 100644 index 000000000000..2a6baee83fb9 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationConfig.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class AuthorizationConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AuthorizationConfig)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Cache)) + { + writer.WritePropertyName("cache"u8); + writer.WriteStringValue(Cache.Value.ToString()); + } + if (Optional.IsCollectionDefined(Rules)) + { + writer.WritePropertyName("rules"u8); + writer.WriteStartArray(); + foreach (var item in Rules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AuthorizationConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AuthorizationConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationConfig(document.RootElement, options); + } + + internal static AuthorizationConfig DeserializeAuthorizationConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OperationalMode? cache = default; + IList rules = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("cache"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cache = new OperationalMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("rules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuthorizationRule.DeserializeAuthorizationRule(item, options)); + } + rules = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AuthorizationConfig(cache, rules ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AuthorizationConfig)} does not support writing '{options.Format}' format."); + } + } + + AuthorizationConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAuthorizationConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AuthorizationConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationConfig.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationConfig.cs new file mode 100644 index 000000000000..07b0d0a02bb6 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationConfig.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker AuthorizationConfig properties. + public partial class AuthorizationConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AuthorizationConfig() + { + Rules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Enable caching of the authorization rules. + /// The authorization rules to follow. If no rule is set, but Authorization Resource is used that would mean DenyAll. + /// Keeps track of any properties unknown to the library. + internal AuthorizationConfig(OperationalMode? cache, IList rules, IDictionary serializedAdditionalRawData) + { + Cache = cache; + Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Enable caching of the authorization rules. + public OperationalMode? Cache { get; set; } + /// The authorization rules to follow. If no rule is set, but Authorization Resource is used that would mean DenyAll. + public IList Rules { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationRule.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationRule.Serialization.cs new file mode 100644 index 000000000000..3a47dc062d1a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationRule.Serialization.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class AuthorizationRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AuthorizationRule)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("brokerResources"u8); + writer.WriteStartArray(); + foreach (var item in BrokerResources) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("principals"u8); + writer.WriteObjectValue(Principals, options); + if (Optional.IsCollectionDefined(StateStoreResources)) + { + writer.WritePropertyName("stateStoreResources"u8); + writer.WriteStartArray(); + foreach (var item in StateStoreResources) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AuthorizationRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AuthorizationRule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAuthorizationRule(document.RootElement, options); + } + + internal static AuthorizationRule DeserializeAuthorizationRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList brokerResources = default; + PrincipalDefinition principals = default; + IList stateStoreResources = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("brokerResources"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BrokerResourceRule.DeserializeBrokerResourceRule(item, options)); + } + brokerResources = array; + continue; + } + if (property.NameEquals("principals"u8)) + { + principals = PrincipalDefinition.DeserializePrincipalDefinition(property.Value, options); + continue; + } + if (property.NameEquals("stateStoreResources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StateStoreResourceRule.DeserializeStateStoreResourceRule(item, options)); + } + stateStoreResources = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AuthorizationRule(brokerResources, principals, stateStoreResources ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AuthorizationRule)} does not support writing '{options.Format}' format."); + } + } + + AuthorizationRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAuthorizationRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AuthorizationRule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationRule.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationRule.cs new file mode 100644 index 000000000000..0092827c06b4 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/AuthorizationRule.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// AuthorizationConfig Rule Properties. + public partial class AuthorizationRule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Give access to Broker methods and topics. + /// Give access to clients based on the following properties. + /// or is null. + public AuthorizationRule(IEnumerable brokerResources, PrincipalDefinition principals) + { + Argument.AssertNotNull(brokerResources, nameof(brokerResources)); + Argument.AssertNotNull(principals, nameof(principals)); + + BrokerResources = brokerResources.ToList(); + Principals = principals; + StateStoreResources = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Give access to Broker methods and topics. + /// Give access to clients based on the following properties. + /// Give access to state store resources. + /// Keeps track of any properties unknown to the library. + internal AuthorizationRule(IList brokerResources, PrincipalDefinition principals, IList stateStoreResources, IDictionary serializedAdditionalRawData) + { + BrokerResources = brokerResources; + Principals = principals; + StateStoreResources = stateStoreResources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AuthorizationRule() + { + } + + /// Give access to Broker methods and topics. + public IList BrokerResources { get; } + /// Give access to clients based on the following properties. + public PrincipalDefinition Principals { get; set; } + /// Give access to state store resources. + public IList StateStoreResources { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BackendChain.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BackendChain.Serialization.cs new file mode 100644 index 000000000000..f0c8f61e1dac --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BackendChain.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BackendChain : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackendChain)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("partitions"u8); + writer.WriteNumberValue(Partitions); + writer.WritePropertyName("redundancyFactor"u8); + writer.WriteNumberValue(RedundancyFactor); + if (Optional.IsDefined(Workers)) + { + writer.WritePropertyName("workers"u8); + writer.WriteNumberValue(Workers.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BackendChain IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BackendChain)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBackendChain(document.RootElement, options); + } + + internal static BackendChain DeserializeBackendChain(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int partitions = default; + int redundancyFactor = default; + int? workers = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("partitions"u8)) + { + partitions = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("redundancyFactor"u8)) + { + redundancyFactor = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("workers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + workers = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BackendChain(partitions, redundancyFactor, workers, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BackendChain)} does not support writing '{options.Format}' format."); + } + } + + BackendChain IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBackendChain(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BackendChain)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BackendChain.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BackendChain.cs new file mode 100644 index 000000000000..b0b9f8497ef8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BackendChain.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Desired properties of the backend instances of the broker. + public partial class BackendChain + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The desired number of physical backend partitions. + /// The desired numbers of backend replicas (pods) in a physical partition. + public BackendChain(int partitions, int redundancyFactor) + { + Partitions = partitions; + RedundancyFactor = redundancyFactor; + } + + /// Initializes a new instance of . + /// The desired number of physical backend partitions. + /// The desired numbers of backend replicas (pods) in a physical partition. + /// Number of logical backend workers per replica (pod). + /// Keeps track of any properties unknown to the library. + internal BackendChain(int partitions, int redundancyFactor, int? workers, IDictionary serializedAdditionalRawData) + { + Partitions = partitions; + RedundancyFactor = redundancyFactor; + Workers = workers; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BackendChain() + { + } + + /// The desired number of physical backend partitions. + public int Partitions { get; set; } + /// The desired numbers of backend replicas (pods) in a physical partition. + public int RedundancyFactor { get; set; } + /// Number of logical backend workers per replica (pod). + public int? Workers { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BatchingConfiguration.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BatchingConfiguration.Serialization.cs new file mode 100644 index 000000000000..3aa86397134e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BatchingConfiguration.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BatchingConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BatchingConfiguration)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LatencySeconds)) + { + writer.WritePropertyName("latencySeconds"u8); + writer.WriteNumberValue(LatencySeconds.Value); + } + if (Optional.IsDefined(MaxMessages)) + { + writer.WritePropertyName("maxMessages"u8); + writer.WriteNumberValue(MaxMessages.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BatchingConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BatchingConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBatchingConfiguration(document.RootElement, options); + } + + internal static BatchingConfiguration DeserializeBatchingConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? latencySeconds = default; + int? maxMessages = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("latencySeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + latencySeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxMessages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxMessages = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BatchingConfiguration(latencySeconds, maxMessages, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BatchingConfiguration)} does not support writing '{options.Format}' format."); + } + } + + BatchingConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBatchingConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BatchingConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BatchingConfiguration.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BatchingConfiguration.cs new file mode 100644 index 000000000000..7add4c05aa00 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BatchingConfiguration.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Batching configuration. + public partial class BatchingConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public BatchingConfiguration() + { + } + + /// Initializes a new instance of . + /// Batching latency in seconds. + /// Maximum number of messages in a batch. + /// Keeps track of any properties unknown to the library. + internal BatchingConfiguration(int? latencySeconds, int? maxMessages, IDictionary serializedAdditionalRawData) + { + LatencySeconds = latencySeconds; + MaxMessages = maxMessages; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Batching latency in seconds. + public int? LatencySeconds { get; set; } + /// Maximum number of messages in a batch. + public int? MaxMessages { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationMethod.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationMethod.cs new file mode 100644 index 000000000000..8d6f045172de --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationMethod.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Authentication Mode. + public readonly partial struct BrokerAuthenticationMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BrokerAuthenticationMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CustomValue = "Custom"; + private const string ServiceAccountTokenValue = "ServiceAccountToken"; + private const string X509Value = "X509"; + + /// Custom authentication configuration. + public static BrokerAuthenticationMethod Custom { get; } = new BrokerAuthenticationMethod(CustomValue); + /// ServiceAccountToken authentication configuration. + public static BrokerAuthenticationMethod ServiceAccountToken { get; } = new BrokerAuthenticationMethod(ServiceAccountTokenValue); + /// X.509 authentication configuration. + public static BrokerAuthenticationMethod X509 { get; } = new BrokerAuthenticationMethod(X509Value); + /// Determines if two values are the same. + public static bool operator ==(BrokerAuthenticationMethod left, BrokerAuthenticationMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BrokerAuthenticationMethod left, BrokerAuthenticationMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator BrokerAuthenticationMethod(string value) => new BrokerAuthenticationMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BrokerAuthenticationMethod other && Equals(other); + /// + public bool Equals(BrokerAuthenticationMethod 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationProperties.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationProperties.Serialization.cs new file mode 100644 index 000000000000..f949ccc5e43d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationProperties.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerAuthenticationProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticationProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("authenticationMethods"u8); + writer.WriteStartArray(); + foreach (var item in AuthenticationMethods) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthenticationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthenticationProperties(document.RootElement, options); + } + + internal static BrokerAuthenticationProperties DeserializeBrokerAuthenticationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList authenticationMethods = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authenticationMethods"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BrokerAuthenticatorMethods.DeserializeBrokerAuthenticatorMethods(item, options)); + } + authenticationMethods = array; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthenticationProperties(authenticationMethods, provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthenticationProperties)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthenticationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthenticationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthenticationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationProperties.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationProperties.cs new file mode 100644 index 000000000000..413753cb59e1 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationProperties.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// BrokerAuthentication Resource properties. + public partial class BrokerAuthenticationProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Defines a set of Broker authentication methods to be used on `BrokerListeners`. For each array element one authenticator type supported. + /// is null. + public BrokerAuthenticationProperties(IEnumerable authenticationMethods) + { + Argument.AssertNotNull(authenticationMethods, nameof(authenticationMethods)); + + AuthenticationMethods = authenticationMethods.ToList(); + } + + /// Initializes a new instance of . + /// Defines a set of Broker authentication methods to be used on `BrokerListeners`. For each array element one authenticator type supported. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthenticationProperties(IList authenticationMethods, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + AuthenticationMethods = authenticationMethods; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthenticationProperties() + { + } + + /// Defines a set of Broker authentication methods to be used on `BrokerListeners`. For each array element one authenticator type supported. + public IList AuthenticationMethods { get; } + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationResourceListResult.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationResourceListResult.Serialization.cs new file mode 100644 index 000000000000..ec74c8c35d81 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class BrokerAuthenticationResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticationResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthenticationResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticationResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthenticationResourceListResult(document.RootElement, options); + } + + internal static BrokerAuthenticationResourceListResult DeserializeBrokerAuthenticationResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BrokerAuthenticationResourceData.DeserializeBrokerAuthenticationResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthenticationResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthenticationResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthenticationResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthenticationResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthenticationResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationResourceListResult.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationResourceListResult.cs new file mode 100644 index 000000000000..ba558a4df5b4 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticationResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The response of a BrokerAuthenticationResource list operation. + internal partial class BrokerAuthenticationResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The BrokerAuthenticationResource items on this page. + /// is null. + internal BrokerAuthenticationResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The BrokerAuthenticationResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthenticationResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthenticationResourceListResult() + { + } + + /// The BrokerAuthenticationResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorCustomAuth.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorCustomAuth.Serialization.cs new file mode 100644 index 000000000000..acb8c0adf083 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorCustomAuth.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class BrokerAuthenticatorCustomAuth : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorCustomAuth)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("x509"u8); + writer.WriteObjectValue(X509, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthenticatorCustomAuth IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorCustomAuth)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthenticatorCustomAuth(document.RootElement, options); + } + + internal static BrokerAuthenticatorCustomAuth DeserializeBrokerAuthenticatorCustomAuth(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + X509ManualCertificate x509 = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("x509"u8)) + { + x509 = X509ManualCertificate.DeserializeX509ManualCertificate(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthenticatorCustomAuth(x509, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorCustomAuth)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthenticatorCustomAuth IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthenticatorCustomAuth(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorCustomAuth)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorCustomAuth.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorCustomAuth.cs new file mode 100644 index 000000000000..f37c7232a43c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorCustomAuth.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Custom Authentication properties. + internal partial class BrokerAuthenticatorCustomAuth + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// X509 Custom Auth type details. + /// is null. + public BrokerAuthenticatorCustomAuth(X509ManualCertificate x509) + { + Argument.AssertNotNull(x509, nameof(x509)); + + X509 = x509; + } + + /// Initializes a new instance of . + /// X509 Custom Auth type details. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthenticatorCustomAuth(X509ManualCertificate x509, IDictionary serializedAdditionalRawData) + { + X509 = x509; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthenticatorCustomAuth() + { + } + + /// X509 Custom Auth type details. + internal X509ManualCertificate X509 { get; set; } + /// Kubernetes secret containing an X.509 client certificate. This is a reference to the secret through an identifying name, not the secret itself. + public string X509SecretRef + { + get => X509 is null ? default : X509.SecretRef; + set => X509 = new X509ManualCertificate(value); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodCustom.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodCustom.Serialization.cs new file mode 100644 index 000000000000..344557c4956f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodCustom.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.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerAuthenticatorMethodCustom : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodCustom)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Auth)) + { + writer.WritePropertyName("auth"u8); + writer.WriteObjectValue(Auth, options); + } + if (Optional.IsDefined(CaCertConfigMap)) + { + writer.WritePropertyName("caCertConfigMap"u8); + writer.WriteStringValue(CaCertConfigMap); + } + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint.AbsoluteUri); + if (Optional.IsCollectionDefined(Headers)) + { + writer.WritePropertyName("headers"u8); + writer.WriteStartObject(); + foreach (var item in Headers) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthenticatorMethodCustom IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodCustom)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthenticatorMethodCustom(document.RootElement, options); + } + + internal static BrokerAuthenticatorMethodCustom DeserializeBrokerAuthenticatorMethodCustom(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BrokerAuthenticatorCustomAuth auth = default; + string caCertConfigMap = default; + Uri endpoint = default; + IDictionary headers = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("auth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + auth = BrokerAuthenticatorCustomAuth.DeserializeBrokerAuthenticatorCustomAuth(property.Value, options); + continue; + } + if (property.NameEquals("caCertConfigMap"u8)) + { + caCertConfigMap = property.Value.GetString(); + continue; + } + if (property.NameEquals("endpoint"u8)) + { + endpoint = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("headers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + headers = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthenticatorMethodCustom(auth, caCertConfigMap, endpoint, headers ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodCustom)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthenticatorMethodCustom IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthenticatorMethodCustom(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodCustom)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodCustom.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodCustom.cs new file mode 100644 index 000000000000..e2d9ff6e5ff3 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodCustom.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Custom method for BrokerAuthentication. + public partial class BrokerAuthenticatorMethodCustom + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Endpoint of the custom authentication server. Must be an HTTPS endpoint. + /// is null. + public BrokerAuthenticatorMethodCustom(Uri endpoint) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + + Endpoint = endpoint; + Headers = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Optional authentication needed for authenticating with the custom authentication server. + /// Optional CA certificate for validating the custom authentication server's certificate. + /// Endpoint of the custom authentication server. Must be an HTTPS endpoint. + /// Additional HTTP headers to pass to the custom authentication server. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthenticatorMethodCustom(BrokerAuthenticatorCustomAuth auth, string caCertConfigMap, Uri endpoint, IDictionary headers, IDictionary serializedAdditionalRawData) + { + Auth = auth; + CaCertConfigMap = caCertConfigMap; + Endpoint = endpoint; + Headers = headers; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthenticatorMethodCustom() + { + } + + /// Optional authentication needed for authenticating with the custom authentication server. + internal BrokerAuthenticatorCustomAuth Auth { get; set; } + /// Kubernetes secret containing an X.509 client certificate. This is a reference to the secret through an identifying name, not the secret itself. + public string X509SecretRef + { + get => Auth is null ? default : Auth.X509SecretRef; + set => Auth = new BrokerAuthenticatorCustomAuth(value); + } + + /// Optional CA certificate for validating the custom authentication server's certificate. + public string CaCertConfigMap { get; set; } + /// Endpoint of the custom authentication server. Must be an HTTPS endpoint. + public Uri Endpoint { get; set; } + /// Additional HTTP headers to pass to the custom authentication server. + public IDictionary Headers { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodSat.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodSat.Serialization.cs new file mode 100644 index 000000000000..87463cf3588a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodSat.Serialization.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class BrokerAuthenticatorMethodSat : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodSat)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("audiences"u8); + writer.WriteStartArray(); + foreach (var item in Audiences) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthenticatorMethodSat IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodSat)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthenticatorMethodSat(document.RootElement, options); + } + + internal static BrokerAuthenticatorMethodSat DeserializeBrokerAuthenticatorMethodSat(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList audiences = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("audiences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + audiences = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthenticatorMethodSat(audiences, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodSat)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthenticatorMethodSat IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthenticatorMethodSat(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodSat)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodSat.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodSat.cs new file mode 100644 index 000000000000..8b6667d9fc9d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodSat.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Service Account Token for BrokerAuthentication. + internal partial class BrokerAuthenticatorMethodSat + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of allowed audience. + /// is null. + public BrokerAuthenticatorMethodSat(IEnumerable audiences) + { + Argument.AssertNotNull(audiences, nameof(audiences)); + + Audiences = audiences.ToList(); + } + + /// Initializes a new instance of . + /// List of allowed audience. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthenticatorMethodSat(IList audiences, IDictionary serializedAdditionalRawData) + { + Audiences = audiences; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthenticatorMethodSat() + { + } + + /// List of allowed audience. + public IList Audiences { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509.Serialization.cs new file mode 100644 index 000000000000..5bdf454858d8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerAuthenticatorMethodX509 : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodX509)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(AuthorizationAttributes)) + { + writer.WritePropertyName("authorizationAttributes"u8); + writer.WriteStartObject(); + foreach (var item in AuthorizationAttributes) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(TrustedClientCaCert)) + { + writer.WritePropertyName("trustedClientCaCert"u8); + writer.WriteStringValue(TrustedClientCaCert); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthenticatorMethodX509 IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodX509)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthenticatorMethodX509(document.RootElement, options); + } + + internal static BrokerAuthenticatorMethodX509 DeserializeBrokerAuthenticatorMethodX509(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary authorizationAttributes = default; + string trustedClientCaCert = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authorizationAttributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, BrokerAuthenticatorMethodX509Attributes.DeserializeBrokerAuthenticatorMethodX509Attributes(property0.Value, options)); + } + authorizationAttributes = dictionary; + continue; + } + if (property.NameEquals("trustedClientCaCert"u8)) + { + trustedClientCaCert = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthenticatorMethodX509(authorizationAttributes ?? new ChangeTrackingDictionary(), trustedClientCaCert, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodX509)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthenticatorMethodX509 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthenticatorMethodX509(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodX509)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509.cs new file mode 100644 index 000000000000..d34e965e3ae1 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// X509 for BrokerAuthentication. + public partial class BrokerAuthenticatorMethodX509 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public BrokerAuthenticatorMethodX509() + { + AuthorizationAttributes = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// X509 authorization attributes properties. + /// Name of the trusted client ca cert resource. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthenticatorMethodX509(IDictionary authorizationAttributes, string trustedClientCaCert, IDictionary serializedAdditionalRawData) + { + AuthorizationAttributes = authorizationAttributes; + TrustedClientCaCert = trustedClientCaCert; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// X509 authorization attributes properties. + public IDictionary AuthorizationAttributes { get; } + /// Name of the trusted client ca cert resource. + public string TrustedClientCaCert { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509Attributes.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509Attributes.Serialization.cs new file mode 100644 index 000000000000..c9e77d0e55cf --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509Attributes.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.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerAuthenticatorMethodX509Attributes : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodX509Attributes)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("attributes"u8); + writer.WriteStartObject(); + foreach (var item in Attributes) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + writer.WritePropertyName("subject"u8); + writer.WriteStringValue(Subject); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthenticatorMethodX509Attributes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodX509Attributes)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthenticatorMethodX509Attributes(document.RootElement, options); + } + + internal static BrokerAuthenticatorMethodX509Attributes DeserializeBrokerAuthenticatorMethodX509Attributes(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary attributes = default; + string subject = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attributes"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + attributes = dictionary; + continue; + } + if (property.NameEquals("subject"u8)) + { + subject = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthenticatorMethodX509Attributes(attributes, subject, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodX509Attributes)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthenticatorMethodX509Attributes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthenticatorMethodX509Attributes(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethodX509Attributes)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509Attributes.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509Attributes.cs new file mode 100644 index 000000000000..abe670d40495 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethodX509Attributes.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// BrokerAuthenticatorMethodX509Attributes properties. + public partial class BrokerAuthenticatorMethodX509Attributes + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Attributes object. + /// Subject of the X509 attribute. + /// or is null. + public BrokerAuthenticatorMethodX509Attributes(IDictionary attributes, string subject) + { + Argument.AssertNotNull(attributes, nameof(attributes)); + Argument.AssertNotNull(subject, nameof(subject)); + + Attributes = attributes; + Subject = subject; + } + + /// Initializes a new instance of . + /// Attributes object. + /// Subject of the X509 attribute. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthenticatorMethodX509Attributes(IDictionary attributes, string subject, IDictionary serializedAdditionalRawData) + { + Attributes = attributes; + Subject = subject; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthenticatorMethodX509Attributes() + { + } + + /// Attributes object. + public IDictionary Attributes { get; } + /// Subject of the X509 attribute. + public string Subject { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethods.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethods.Serialization.cs new file mode 100644 index 000000000000..555221400c12 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethods.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerAuthenticatorMethods : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethods)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.ToString()); + if (Optional.IsDefined(CustomSettings)) + { + writer.WritePropertyName("customSettings"u8); + writer.WriteObjectValue(CustomSettings, options); + } + if (Optional.IsDefined(ServiceAccountTokenSettings)) + { + writer.WritePropertyName("serviceAccountTokenSettings"u8); + writer.WriteObjectValue(ServiceAccountTokenSettings, options); + } + if (Optional.IsDefined(X509Settings)) + { + writer.WritePropertyName("x509Settings"u8); + writer.WriteObjectValue(X509Settings, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthenticatorMethods IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethods)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthenticatorMethods(document.RootElement, options); + } + + internal static BrokerAuthenticatorMethods DeserializeBrokerAuthenticatorMethods(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BrokerAuthenticationMethod method = default; + BrokerAuthenticatorMethodCustom customSettings = default; + BrokerAuthenticatorMethodSat serviceAccountTokenSettings = default; + BrokerAuthenticatorMethodX509 x509Settings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("method"u8)) + { + method = new BrokerAuthenticationMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("customSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customSettings = BrokerAuthenticatorMethodCustom.DeserializeBrokerAuthenticatorMethodCustom(property.Value, options); + continue; + } + if (property.NameEquals("serviceAccountTokenSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceAccountTokenSettings = BrokerAuthenticatorMethodSat.DeserializeBrokerAuthenticatorMethodSat(property.Value, options); + continue; + } + if (property.NameEquals("x509Settings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + x509Settings = BrokerAuthenticatorMethodX509.DeserializeBrokerAuthenticatorMethodX509(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthenticatorMethods(method, customSettings, serviceAccountTokenSettings, x509Settings, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethods)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthenticatorMethods IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthenticatorMethods(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthenticatorMethods)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethods.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethods.cs new file mode 100644 index 000000000000..1959b155b27c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthenticatorMethods.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Set of broker authentication policies. Only one method is supported for each entry. + public partial class BrokerAuthenticatorMethods + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Custom authentication configuration. + public BrokerAuthenticatorMethods(BrokerAuthenticationMethod method) + { + Method = method; + } + + /// Initializes a new instance of . + /// Custom authentication configuration. + /// Custom authentication configuration. + /// ServiceAccountToken authentication configuration. + /// X.509 authentication configuration. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthenticatorMethods(BrokerAuthenticationMethod method, BrokerAuthenticatorMethodCustom customSettings, BrokerAuthenticatorMethodSat serviceAccountTokenSettings, BrokerAuthenticatorMethodX509 x509Settings, IDictionary serializedAdditionalRawData) + { + Method = method; + CustomSettings = customSettings; + ServiceAccountTokenSettings = serviceAccountTokenSettings; + X509Settings = x509Settings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthenticatorMethods() + { + } + + /// Custom authentication configuration. + public BrokerAuthenticationMethod Method { get; set; } + /// Custom authentication configuration. + public BrokerAuthenticatorMethodCustom CustomSettings { get; set; } + /// ServiceAccountToken authentication configuration. + internal BrokerAuthenticatorMethodSat ServiceAccountTokenSettings { get; set; } + /// List of allowed audience. + public IList ServiceAccountTokenAudiences + { + get => ServiceAccountTokenSettings is null ? default : ServiceAccountTokenSettings.Audiences; + set => ServiceAccountTokenSettings = new BrokerAuthenticatorMethodSat(value); + } + + /// X.509 authentication configuration. + public BrokerAuthenticatorMethodX509 X509Settings { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationProperties.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationProperties.Serialization.cs new file mode 100644 index 000000000000..bd670aba5f18 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationProperties.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerAuthorizationProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthorizationProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("authorizationPolicies"u8); + writer.WriteObjectValue(AuthorizationPolicies, options); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthorizationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthorizationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthorizationProperties(document.RootElement, options); + } + + internal static BrokerAuthorizationProperties DeserializeBrokerAuthorizationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AuthorizationConfig authorizationPolicies = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authorizationPolicies"u8)) + { + authorizationPolicies = AuthorizationConfig.DeserializeAuthorizationConfig(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthorizationProperties(authorizationPolicies, provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthorizationProperties)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthorizationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthorizationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthorizationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationProperties.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationProperties.cs new file mode 100644 index 000000000000..760e3a3dac6c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationProperties.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// BrokerAuthorization Resource properties. + public partial class BrokerAuthorizationProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The list of authorization policies supported by the Authorization Resource. + /// is null. + public BrokerAuthorizationProperties(AuthorizationConfig authorizationPolicies) + { + Argument.AssertNotNull(authorizationPolicies, nameof(authorizationPolicies)); + + AuthorizationPolicies = authorizationPolicies; + } + + /// Initializes a new instance of . + /// The list of authorization policies supported by the Authorization Resource. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthorizationProperties(AuthorizationConfig authorizationPolicies, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + AuthorizationPolicies = authorizationPolicies; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthorizationProperties() + { + } + + /// The list of authorization policies supported by the Authorization Resource. + public AuthorizationConfig AuthorizationPolicies { get; set; } + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationResourceListResult.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationResourceListResult.Serialization.cs new file mode 100644 index 000000000000..e339f8a8e2f5 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class BrokerAuthorizationResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthorizationResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerAuthorizationResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerAuthorizationResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerAuthorizationResourceListResult(document.RootElement, options); + } + + internal static BrokerAuthorizationResourceListResult DeserializeBrokerAuthorizationResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BrokerAuthorizationResourceData.DeserializeBrokerAuthorizationResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerAuthorizationResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerAuthorizationResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + BrokerAuthorizationResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerAuthorizationResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerAuthorizationResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationResourceListResult.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationResourceListResult.cs new file mode 100644 index 000000000000..faac07e07534 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerAuthorizationResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The response of a BrokerAuthorizationResource list operation. + internal partial class BrokerAuthorizationResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The BrokerAuthorizationResource items on this page. + /// is null. + internal BrokerAuthorizationResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The BrokerAuthorizationResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal BrokerAuthorizationResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerAuthorizationResourceListResult() + { + } + + /// The BrokerAuthorizationResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerDiagnostics.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerDiagnostics.Serialization.cs new file mode 100644 index 000000000000..c2f354fcd1b8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerDiagnostics.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.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerDiagnostics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerDiagnostics)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Logs)) + { + writer.WritePropertyName("logs"u8); + writer.WriteObjectValue(Logs, options); + } + if (Optional.IsDefined(Metrics)) + { + writer.WritePropertyName("metrics"u8); + writer.WriteObjectValue(Metrics, options); + } + if (Optional.IsDefined(SelfCheck)) + { + writer.WritePropertyName("selfCheck"u8); + writer.WriteObjectValue(SelfCheck, options); + } + if (Optional.IsDefined(Traces)) + { + writer.WritePropertyName("traces"u8); + writer.WriteObjectValue(Traces, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerDiagnostics IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerDiagnostics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerDiagnostics(document.RootElement, options); + } + + internal static BrokerDiagnostics DeserializeBrokerDiagnostics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DiagnosticsLogs logs = default; + Metrics metrics = default; + SelfCheck selfCheck = default; + Traces traces = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("logs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logs = DiagnosticsLogs.DeserializeDiagnosticsLogs(property.Value, options); + continue; + } + if (property.NameEquals("metrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metrics = Metrics.DeserializeMetrics(property.Value, options); + continue; + } + if (property.NameEquals("selfCheck"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + selfCheck = SelfCheck.DeserializeSelfCheck(property.Value, options); + continue; + } + if (property.NameEquals("traces"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + traces = Traces.DeserializeTraces(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerDiagnostics(logs, metrics, selfCheck, traces, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerDiagnostics)} does not support writing '{options.Format}' format."); + } + } + + BrokerDiagnostics IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerDiagnostics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerDiagnostics)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerDiagnostics.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerDiagnostics.cs new file mode 100644 index 000000000000..8e1a7722fd06 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerDiagnostics.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Diagnostic Setting properties. + public partial class BrokerDiagnostics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public BrokerDiagnostics() + { + } + + /// Initializes a new instance of . + /// Diagnostic log settings for the resource. + /// The metrics settings for the resource. + /// The self check properties. + /// The trace properties. + /// Keeps track of any properties unknown to the library. + internal BrokerDiagnostics(DiagnosticsLogs logs, Metrics metrics, SelfCheck selfCheck, Traces traces, IDictionary serializedAdditionalRawData) + { + Logs = logs; + Metrics = metrics; + SelfCheck = selfCheck; + Traces = traces; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Diagnostic log settings for the resource. + internal DiagnosticsLogs Logs { get; set; } + /// The log level. Examples - 'debug', 'info', 'warn', 'error', 'trace'. + public string LogsLevel + { + get => Logs is null ? default : Logs.Level; + set + { + if (Logs is null) + Logs = new DiagnosticsLogs(); + Logs.Level = value; + } + } + + /// The metrics settings for the resource. + internal Metrics Metrics { get; set; } + /// The prometheus port to expose the metrics. + public int? MetricsPrometheusPort + { + get => Metrics is null ? default : Metrics.PrometheusPort; + set + { + if (Metrics is null) + Metrics = new Metrics(); + Metrics.PrometheusPort = value; + } + } + + /// The self check properties. + public SelfCheck SelfCheck { get; set; } + /// The trace properties. + public Traces Traces { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerProperties.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerProperties.Serialization.cs new file mode 100644 index 000000000000..8c6411ec07f2 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerProperties.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerListenerProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerListenerProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ServiceName)) + { + writer.WritePropertyName("serviceName"u8); + writer.WriteStringValue(ServiceName); + } + writer.WritePropertyName("ports"u8); + writer.WriteStartArray(); + foreach (var item in Ports) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(ServiceType)) + { + writer.WritePropertyName("serviceType"u8); + writer.WriteStringValue(ServiceType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerListenerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerListenerProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerListenerProperties(document.RootElement, options); + } + + internal static BrokerListenerProperties DeserializeBrokerListenerProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string serviceName = default; + IList ports = default; + ServiceType? serviceType = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("serviceName"u8)) + { + serviceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("ports"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ListenerPort.DeserializeListenerPort(item, options)); + } + ports = array; + continue; + } + if (property.NameEquals("serviceType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceType = new ServiceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerListenerProperties(serviceName, ports, serviceType, provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerListenerProperties)} does not support writing '{options.Format}' format."); + } + } + + BrokerListenerProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerListenerProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerListenerProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerProperties.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerProperties.cs new file mode 100644 index 000000000000..db42f23bfbab --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerProperties.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Defines a Broker listener. A listener is a collection of ports on which the broker accepts connections from clients. + public partial class BrokerListenerProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Ports on which this listener accepts client connections. + /// is null. + public BrokerListenerProperties(IEnumerable ports) + { + Argument.AssertNotNull(ports, nameof(ports)); + + Ports = ports.ToList(); + } + + /// Initializes a new instance of . + /// Kubernetes Service name of this listener. + /// Ports on which this listener accepts client connections. + /// Kubernetes Service type of this listener. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal BrokerListenerProperties(string serviceName, IList ports, ServiceType? serviceType, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + ServiceName = serviceName; + Ports = ports; + ServiceType = serviceType; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerListenerProperties() + { + } + + /// Kubernetes Service name of this listener. + public string ServiceName { get; set; } + /// Ports on which this listener accepts client connections. + public IList Ports { get; } + /// Kubernetes Service type of this listener. + public ServiceType? ServiceType { get; set; } + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerResourceListResult.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerResourceListResult.Serialization.cs new file mode 100644 index 000000000000..e0e694dd041b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class BrokerListenerResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerListenerResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerListenerResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerListenerResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerListenerResourceListResult(document.RootElement, options); + } + + internal static BrokerListenerResourceListResult DeserializeBrokerListenerResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BrokerListenerResourceData.DeserializeBrokerListenerResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerListenerResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerListenerResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + BrokerListenerResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerListenerResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerListenerResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerResourceListResult.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerResourceListResult.cs new file mode 100644 index 000000000000..aa31f24de421 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerListenerResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The response of a BrokerListenerResource list operation. + internal partial class BrokerListenerResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The BrokerListenerResource items on this page. + /// is null. + internal BrokerListenerResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The BrokerListenerResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal BrokerListenerResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerListenerResourceListResult() + { + } + + /// The BrokerListenerResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerMemoryProfile.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerMemoryProfile.cs new file mode 100644 index 000000000000..c58ee8361f26 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerMemoryProfile.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The memory profile settings of the Broker. + public readonly partial struct BrokerMemoryProfile : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BrokerMemoryProfile(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TinyValue = "Tiny"; + private const string LowValue = "Low"; + private const string MediumValue = "Medium"; + private const string HighValue = "High"; + + /// Tiny memory profile. + public static BrokerMemoryProfile Tiny { get; } = new BrokerMemoryProfile(TinyValue); + /// Low memory profile. + public static BrokerMemoryProfile Low { get; } = new BrokerMemoryProfile(LowValue); + /// Medium memory profile. + public static BrokerMemoryProfile Medium { get; } = new BrokerMemoryProfile(MediumValue); + /// High memory profile. + public static BrokerMemoryProfile High { get; } = new BrokerMemoryProfile(HighValue); + /// Determines if two values are the same. + public static bool operator ==(BrokerMemoryProfile left, BrokerMemoryProfile right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BrokerMemoryProfile left, BrokerMemoryProfile right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator BrokerMemoryProfile(string value) => new BrokerMemoryProfile(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BrokerMemoryProfile other && Equals(other); + /// + public bool Equals(BrokerMemoryProfile 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProperties.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProperties.Serialization.cs new file mode 100644 index 000000000000..0d3d22aacfb8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProperties.Serialization.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Advanced)) + { + writer.WritePropertyName("advanced"u8); + writer.WriteObjectValue(Advanced, options); + } + if (Optional.IsDefined(Cardinality)) + { + writer.WritePropertyName("cardinality"u8); + writer.WriteObjectValue(Cardinality, options); + } + if (Optional.IsDefined(Diagnostics)) + { + writer.WritePropertyName("diagnostics"u8); + writer.WriteObjectValue(Diagnostics, options); + } + if (Optional.IsDefined(DiskBackedMessageBuffer)) + { + writer.WritePropertyName("diskBackedMessageBuffer"u8); + writer.WriteObjectValue(DiskBackedMessageBuffer, options); + } + if (Optional.IsDefined(GenerateResourceLimits)) + { + writer.WritePropertyName("generateResourceLimits"u8); + writer.WriteObjectValue(GenerateResourceLimits, options); + } + if (Optional.IsDefined(MemoryProfile)) + { + writer.WritePropertyName("memoryProfile"u8); + writer.WriteStringValue(MemoryProfile.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerProperties(document.RootElement, options); + } + + internal static BrokerProperties DeserializeBrokerProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AdvancedSettings advanced = default; + Cardinality cardinality = default; + BrokerDiagnostics diagnostics = default; + DiskBackedMessageBuffer diskBackedMessageBuffer = default; + GenerateResourceLimits generateResourceLimits = default; + BrokerMemoryProfile? memoryProfile = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("advanced"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + advanced = AdvancedSettings.DeserializeAdvancedSettings(property.Value, options); + continue; + } + if (property.NameEquals("cardinality"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cardinality = Cardinality.DeserializeCardinality(property.Value, options); + continue; + } + if (property.NameEquals("diagnostics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diagnostics = BrokerDiagnostics.DeserializeBrokerDiagnostics(property.Value, options); + continue; + } + if (property.NameEquals("diskBackedMessageBuffer"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskBackedMessageBuffer = DiskBackedMessageBuffer.DeserializeDiskBackedMessageBuffer(property.Value, options); + continue; + } + if (property.NameEquals("generateResourceLimits"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + generateResourceLimits = GenerateResourceLimits.DeserializeGenerateResourceLimits(property.Value, options); + continue; + } + if (property.NameEquals("memoryProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + memoryProfile = new BrokerMemoryProfile(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerProperties( + advanced, + cardinality, + diagnostics, + diskBackedMessageBuffer, + generateResourceLimits, + memoryProfile, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerProperties)} does not support writing '{options.Format}' format."); + } + } + + BrokerProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProperties.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProperties.cs new file mode 100644 index 000000000000..0c87125f7b86 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProperties.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Resource properties. + public partial class BrokerProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public BrokerProperties() + { + } + + /// Initializes a new instance of . + /// Advanced settings of Broker. + /// The cardinality details of the broker. + /// Spec defines the desired identities of Broker diagnostics settings. + /// Settings of Disk Backed Message Buffer. + /// This setting controls whether Kubernetes CPU resource limits are requested. Increasing the number of replicas or workers proportionally increases the amount of CPU resources requested. If this setting is enabled and there are insufficient CPU resources, an error will be emitted. + /// Memory profile of Broker. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal BrokerProperties(AdvancedSettings advanced, Cardinality cardinality, BrokerDiagnostics diagnostics, DiskBackedMessageBuffer diskBackedMessageBuffer, GenerateResourceLimits generateResourceLimits, BrokerMemoryProfile? memoryProfile, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + Advanced = advanced; + Cardinality = cardinality; + Diagnostics = diagnostics; + DiskBackedMessageBuffer = diskBackedMessageBuffer; + GenerateResourceLimits = generateResourceLimits; + MemoryProfile = memoryProfile; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Advanced settings of Broker. + public AdvancedSettings Advanced { get; set; } + /// The cardinality details of the broker. + public Cardinality Cardinality { get; set; } + /// Spec defines the desired identities of Broker diagnostics settings. + public BrokerDiagnostics Diagnostics { get; set; } + /// Settings of Disk Backed Message Buffer. + public DiskBackedMessageBuffer DiskBackedMessageBuffer { get; set; } + /// This setting controls whether Kubernetes CPU resource limits are requested. Increasing the number of replicas or workers proportionally increases the amount of CPU resources requested. If this setting is enabled and there are insufficient CPU resources, an error will be emitted. + internal GenerateResourceLimits GenerateResourceLimits { get; set; } + /// The toggle to enable/disable cpu resource limits. + public OperationalMode? GenerateResourceLimitsCpu + { + get => GenerateResourceLimits is null ? default : GenerateResourceLimits.Cpu; + set + { + if (GenerateResourceLimits is null) + GenerateResourceLimits = new GenerateResourceLimits(); + GenerateResourceLimits.Cpu = value; + } + } + + /// Memory profile of Broker. + public BrokerMemoryProfile? MemoryProfile { get; set; } + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProtocolType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProtocolType.cs new file mode 100644 index 000000000000..93a8e15acaa5 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerProtocolType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Protocol types. + public readonly partial struct BrokerProtocolType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BrokerProtocolType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MqttValue = "Mqtt"; + private const string WebSocketsValue = "WebSockets"; + + /// protocol broker. + public static BrokerProtocolType Mqtt { get; } = new BrokerProtocolType(MqttValue); + /// protocol websocket. + public static BrokerProtocolType WebSockets { get; } = new BrokerProtocolType(WebSocketsValue); + /// Determines if two values are the same. + public static bool operator ==(BrokerProtocolType left, BrokerProtocolType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BrokerProtocolType left, BrokerProtocolType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator BrokerProtocolType(string value) => new BrokerProtocolType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BrokerProtocolType other && Equals(other); + /// + public bool Equals(BrokerProtocolType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceDefinitionMethod.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceDefinitionMethod.cs new file mode 100644 index 000000000000..32bcef3a7c16 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceDefinitionMethod.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// BrokerResourceDefinitionMethods methods allowed. + public readonly partial struct BrokerResourceDefinitionMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BrokerResourceDefinitionMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConnectValue = "Connect"; + private const string PublishValue = "Publish"; + private const string SubscribeValue = "Subscribe"; + + /// Allowed Connecting to Broker. + public static BrokerResourceDefinitionMethod Connect { get; } = new BrokerResourceDefinitionMethod(ConnectValue); + /// Allowed Publishing to Broker. + public static BrokerResourceDefinitionMethod Publish { get; } = new BrokerResourceDefinitionMethod(PublishValue); + /// Allowed Subscribing to Broker. + public static BrokerResourceDefinitionMethod Subscribe { get; } = new BrokerResourceDefinitionMethod(SubscribeValue); + /// Determines if two values are the same. + public static bool operator ==(BrokerResourceDefinitionMethod left, BrokerResourceDefinitionMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BrokerResourceDefinitionMethod left, BrokerResourceDefinitionMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator BrokerResourceDefinitionMethod(string value) => new BrokerResourceDefinitionMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BrokerResourceDefinitionMethod other && Equals(other); + /// + public bool Equals(BrokerResourceDefinitionMethod 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceListResult.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceListResult.Serialization.cs new file mode 100644 index 000000000000..8f231bdd7e0a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class BrokerResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerResourceListResult(document.RootElement, options); + } + + internal static BrokerResourceListResult DeserializeBrokerResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BrokerResourceData.DeserializeBrokerResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + BrokerResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceListResult.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceListResult.cs new file mode 100644 index 000000000000..5ca0e501f447 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The response of a BrokerResource list operation. + internal partial class BrokerResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The BrokerResource items on this page. + /// is null. + internal BrokerResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The BrokerResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal BrokerResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerResourceListResult() + { + } + + /// The BrokerResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceRule.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceRule.Serialization.cs new file mode 100644 index 000000000000..e2a71afcd226 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceRule.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class BrokerResourceRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerResourceRule)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.ToString()); + if (Optional.IsCollectionDefined(ClientIds)) + { + writer.WritePropertyName("clientIds"u8); + writer.WriteStartArray(); + foreach (var item in ClientIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Topics)) + { + writer.WritePropertyName("topics"u8); + writer.WriteStartArray(); + foreach (var item in Topics) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BrokerResourceRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BrokerResourceRule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBrokerResourceRule(document.RootElement, options); + } + + internal static BrokerResourceRule DeserializeBrokerResourceRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BrokerResourceDefinitionMethod method = default; + IList clientIds = default; + IList topics = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("method"u8)) + { + method = new BrokerResourceDefinitionMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("clientIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + clientIds = array; + continue; + } + if (property.NameEquals("topics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + topics = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BrokerResourceRule(method, clientIds ?? new ChangeTrackingList(), topics ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BrokerResourceRule)} does not support writing '{options.Format}' format."); + } + } + + BrokerResourceRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBrokerResourceRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BrokerResourceRule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceRule.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceRule.cs new file mode 100644 index 000000000000..a288fbf48e58 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/BrokerResourceRule.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Resource Rule properties. This defines the objects that represent the actions or topics, such as - method.Connect, method.Publish, etc. + public partial class BrokerResourceRule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Give access for a Broker method (i.e., Connect, Subscribe, or Publish). + public BrokerResourceRule(BrokerResourceDefinitionMethod method) + { + Method = method; + ClientIds = new ChangeTrackingList(); + Topics = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Give access for a Broker method (i.e., Connect, Subscribe, or Publish). + /// A list of client IDs that match the clients. The client IDs are case-sensitive and must match the client IDs provided by the clients during connection. This subfield may be set if the method is Connect. + /// A list of topics or topic patterns that match the topics that the clients can publish or subscribe to. This subfield is required if the method is Publish or Subscribe. + /// Keeps track of any properties unknown to the library. + internal BrokerResourceRule(BrokerResourceDefinitionMethod method, IList clientIds, IList topics, IDictionary serializedAdditionalRawData) + { + Method = method; + ClientIds = clientIds; + Topics = topics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal BrokerResourceRule() + { + } + + /// Give access for a Broker method (i.e., Connect, Subscribe, or Publish). + public BrokerResourceDefinitionMethod Method { get; set; } + /// A list of client IDs that match the clients. The client IDs are case-sensitive and must match the client IDs provided by the clients during connection. This subfield may be set if the method is Connect. + public IList ClientIds { get; } + /// A list of topics or topic patterns that match the topics that the clients can publish or subscribe to. This subfield is required if the method is Publish or Subscribe. + public IList Topics { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Cardinality.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Cardinality.Serialization.cs new file mode 100644 index 000000000000..8528595f127d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Cardinality.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class Cardinality : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Cardinality)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("backendChain"u8); + writer.WriteObjectValue(BackendChain, options); + writer.WritePropertyName("frontend"u8); + writer.WriteObjectValue(Frontend, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Cardinality IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Cardinality)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCardinality(document.RootElement, options); + } + + internal static Cardinality DeserializeCardinality(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BackendChain backendChain = default; + Frontend frontend = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("backendChain"u8)) + { + backendChain = BackendChain.DeserializeBackendChain(property.Value, options); + continue; + } + if (property.NameEquals("frontend"u8)) + { + frontend = Frontend.DeserializeFrontend(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Cardinality(backendChain, frontend, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Cardinality)} does not support writing '{options.Format}' format."); + } + } + + Cardinality IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCardinality(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Cardinality)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Cardinality.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Cardinality.cs new file mode 100644 index 000000000000..7e2d3b673870 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Cardinality.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Cardinality properties. + public partial class Cardinality + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The backend broker desired properties. + /// The frontend desired properties. + /// or is null. + public Cardinality(BackendChain backendChain, Frontend frontend) + { + Argument.AssertNotNull(backendChain, nameof(backendChain)); + Argument.AssertNotNull(frontend, nameof(frontend)); + + BackendChain = backendChain; + Frontend = frontend; + } + + /// Initializes a new instance of . + /// The backend broker desired properties. + /// The frontend desired properties. + /// Keeps track of any properties unknown to the library. + internal Cardinality(BackendChain backendChain, Frontend frontend, IDictionary serializedAdditionalRawData) + { + BackendChain = backendChain; + Frontend = frontend; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Cardinality() + { + } + + /// The backend broker desired properties. + public BackendChain BackendChain { get; set; } + /// The frontend desired properties. + public Frontend Frontend { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertOptions.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertOptions.Serialization.cs new file mode 100644 index 000000000000..f3fbb2688587 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertOptions.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class CertManagerCertOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CertManagerCertOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("duration"u8); + writer.WriteStringValue(Duration); + writer.WritePropertyName("renewBefore"u8); + writer.WriteStringValue(RenewBefore); + writer.WritePropertyName("privateKey"u8); + writer.WriteObjectValue(PrivateKey, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CertManagerCertOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CertManagerCertOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCertManagerCertOptions(document.RootElement, options); + } + + internal static CertManagerCertOptions DeserializeCertManagerCertOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string duration = default; + string renewBefore = default; + CertManagerPrivateKey privateKey = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("duration"u8)) + { + duration = property.Value.GetString(); + continue; + } + if (property.NameEquals("renewBefore"u8)) + { + renewBefore = property.Value.GetString(); + continue; + } + if (property.NameEquals("privateKey"u8)) + { + privateKey = CertManagerPrivateKey.DeserializeCertManagerPrivateKey(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CertManagerCertOptions(duration, renewBefore, privateKey, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CertManagerCertOptions)} does not support writing '{options.Format}' format."); + } + } + + CertManagerCertOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCertManagerCertOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CertManagerCertOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertOptions.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertOptions.cs new file mode 100644 index 000000000000..67a42b027dfb --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertOptions.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Cert Manager Cert properties. + public partial class CertManagerCertOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Lifetime of certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + /// When to begin renewing certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + /// Configuration of certificate private key. + /// , or is null. + public CertManagerCertOptions(string duration, string renewBefore, CertManagerPrivateKey privateKey) + { + Argument.AssertNotNull(duration, nameof(duration)); + Argument.AssertNotNull(renewBefore, nameof(renewBefore)); + Argument.AssertNotNull(privateKey, nameof(privateKey)); + + Duration = duration; + RenewBefore = renewBefore; + PrivateKey = privateKey; + } + + /// Initializes a new instance of . + /// Lifetime of certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + /// When to begin renewing certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + /// Configuration of certificate private key. + /// Keeps track of any properties unknown to the library. + internal CertManagerCertOptions(string duration, string renewBefore, CertManagerPrivateKey privateKey, IDictionary serializedAdditionalRawData) + { + Duration = duration; + RenewBefore = renewBefore; + PrivateKey = privateKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CertManagerCertOptions() + { + } + + /// Lifetime of certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + public string Duration { get; set; } + /// When to begin renewing certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + public string RenewBefore { get; set; } + /// Configuration of certificate private key. + public CertManagerPrivateKey PrivateKey { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertificateSpec.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertificateSpec.Serialization.cs new file mode 100644 index 000000000000..3df840f47648 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertificateSpec.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class CertManagerCertificateSpec : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CertManagerCertificateSpec)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteStringValue(Duration); + } + if (Optional.IsDefined(SecretName)) + { + writer.WritePropertyName("secretName"u8); + writer.WriteStringValue(SecretName); + } + if (Optional.IsDefined(RenewBefore)) + { + writer.WritePropertyName("renewBefore"u8); + writer.WriteStringValue(RenewBefore); + } + writer.WritePropertyName("issuerRef"u8); + writer.WriteObjectValue(IssuerRef, options); + if (Optional.IsDefined(PrivateKey)) + { + writer.WritePropertyName("privateKey"u8); + writer.WriteObjectValue(PrivateKey, options); + } + if (Optional.IsDefined(San)) + { + writer.WritePropertyName("san"u8); + writer.WriteObjectValue(San, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CertManagerCertificateSpec IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CertManagerCertificateSpec)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCertManagerCertificateSpec(document.RootElement, options); + } + + internal static CertManagerCertificateSpec DeserializeCertManagerCertificateSpec(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string duration = default; + string secretName = default; + string renewBefore = default; + CertManagerIssuerRef issuerRef = default; + CertManagerPrivateKey privateKey = default; + SanForCert san = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("duration"u8)) + { + duration = property.Value.GetString(); + continue; + } + if (property.NameEquals("secretName"u8)) + { + secretName = property.Value.GetString(); + continue; + } + if (property.NameEquals("renewBefore"u8)) + { + renewBefore = property.Value.GetString(); + continue; + } + if (property.NameEquals("issuerRef"u8)) + { + issuerRef = CertManagerIssuerRef.DeserializeCertManagerIssuerRef(property.Value, options); + continue; + } + if (property.NameEquals("privateKey"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateKey = CertManagerPrivateKey.DeserializeCertManagerPrivateKey(property.Value, options); + continue; + } + if (property.NameEquals("san"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + san = SanForCert.DeserializeSanForCert(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CertManagerCertificateSpec( + duration, + secretName, + renewBefore, + issuerRef, + privateKey, + san, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CertManagerCertificateSpec)} does not support writing '{options.Format}' format."); + } + } + + CertManagerCertificateSpec IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCertManagerCertificateSpec(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CertManagerCertificateSpec)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertificateSpec.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertificateSpec.cs new file mode 100644 index 000000000000..dde57dbe48c7 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerCertificateSpec.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Automatic TLS server certificate management with cert-manager. + public partial class CertManagerCertificateSpec + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// cert-manager issuerRef. + /// is null. + public CertManagerCertificateSpec(CertManagerIssuerRef issuerRef) + { + Argument.AssertNotNull(issuerRef, nameof(issuerRef)); + + IssuerRef = issuerRef; + } + + /// Initializes a new instance of . + /// Lifetime of certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + /// Secret for storing server certificate. Any existing data will be overwritten. This is a reference to the secret through an identifying name, not the secret itself. + /// When to begin renewing certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + /// cert-manager issuerRef. + /// Type of certificate private key. + /// Additional Subject Alternative Names (SANs) to include in the certificate. + /// Keeps track of any properties unknown to the library. + internal CertManagerCertificateSpec(string duration, string secretName, string renewBefore, CertManagerIssuerRef issuerRef, CertManagerPrivateKey privateKey, SanForCert san, IDictionary serializedAdditionalRawData) + { + Duration = duration; + SecretName = secretName; + RenewBefore = renewBefore; + IssuerRef = issuerRef; + PrivateKey = privateKey; + San = san; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CertManagerCertificateSpec() + { + } + + /// Lifetime of certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + public string Duration { get; set; } + /// Secret for storing server certificate. Any existing data will be overwritten. This is a reference to the secret through an identifying name, not the secret itself. + public string SecretName { get; set; } + /// When to begin renewing certificate. Must be specified using a Go time.Duration format (h|m|s). E.g. 240h for 240 hours and 45m for 45 minutes. + public string RenewBefore { get; set; } + /// cert-manager issuerRef. + public CertManagerIssuerRef IssuerRef { get; set; } + /// Type of certificate private key. + public CertManagerPrivateKey PrivateKey { get; set; } + /// Additional Subject Alternative Names (SANs) to include in the certificate. + public SanForCert San { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerKind.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerKind.cs new file mode 100644 index 000000000000..3b15b25daea4 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// CertManagerIssuerKind properties. + public readonly partial struct CertManagerIssuerKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CertManagerIssuerKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IssuerValue = "Issuer"; + private const string ClusterIssuerValue = "ClusterIssuer"; + + /// Issuer kind. + public static CertManagerIssuerKind Issuer { get; } = new CertManagerIssuerKind(IssuerValue); + /// ClusterIssuer kind. + public static CertManagerIssuerKind ClusterIssuer { get; } = new CertManagerIssuerKind(ClusterIssuerValue); + /// Determines if two values are the same. + public static bool operator ==(CertManagerIssuerKind left, CertManagerIssuerKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CertManagerIssuerKind left, CertManagerIssuerKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CertManagerIssuerKind(string value) => new CertManagerIssuerKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CertManagerIssuerKind other && Equals(other); + /// + public bool Equals(CertManagerIssuerKind 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerRef.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerRef.Serialization.cs new file mode 100644 index 000000000000..bee8c18c3e3e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerRef.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class CertManagerIssuerRef : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CertManagerIssuerRef)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("group"u8); + writer.WriteStringValue(Group); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CertManagerIssuerRef IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CertManagerIssuerRef)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCertManagerIssuerRef(document.RootElement, options); + } + + internal static CertManagerIssuerRef DeserializeCertManagerIssuerRef(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string group = default; + CertManagerIssuerKind kind = default; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("group"u8)) + { + group = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new CertManagerIssuerKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CertManagerIssuerRef(group, kind, name, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CertManagerIssuerRef)} does not support writing '{options.Format}' format."); + } + } + + CertManagerIssuerRef IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCertManagerIssuerRef(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CertManagerIssuerRef)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerRef.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerRef.cs new file mode 100644 index 000000000000..1a05a25db0ff --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerIssuerRef.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Cert-Manager issuerRef properties. + public partial class CertManagerIssuerRef + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// group of issuer. + /// kind of issuer (Issuer or ClusterIssuer). + /// name of issuer. + /// or is null. + public CertManagerIssuerRef(string group, CertManagerIssuerKind kind, string name) + { + Argument.AssertNotNull(group, nameof(group)); + Argument.AssertNotNull(name, nameof(name)); + + Group = group; + Kind = kind; + Name = name; + } + + /// Initializes a new instance of . + /// group of issuer. + /// kind of issuer (Issuer or ClusterIssuer). + /// name of issuer. + /// Keeps track of any properties unknown to the library. + internal CertManagerIssuerRef(string group, CertManagerIssuerKind kind, string name, IDictionary serializedAdditionalRawData) + { + Group = group; + Kind = kind; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CertManagerIssuerRef() + { + } + + /// group of issuer. + public string Group { get; set; } + /// kind of issuer (Issuer or ClusterIssuer). + public CertManagerIssuerKind Kind { get; set; } + /// name of issuer. + public string Name { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerPrivateKey.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerPrivateKey.Serialization.cs new file mode 100644 index 000000000000..cb61666cb083 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerPrivateKey.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class CertManagerPrivateKey : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CertManagerPrivateKey)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("algorithm"u8); + writer.WriteStringValue(Algorithm.ToString()); + writer.WritePropertyName("rotationPolicy"u8); + writer.WriteStringValue(RotationPolicy.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CertManagerPrivateKey IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CertManagerPrivateKey)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCertManagerPrivateKey(document.RootElement, options); + } + + internal static CertManagerPrivateKey DeserializeCertManagerPrivateKey(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PrivateKeyAlgorithm algorithm = default; + PrivateKeyRotationPolicy rotationPolicy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("algorithm"u8)) + { + algorithm = new PrivateKeyAlgorithm(property.Value.GetString()); + continue; + } + if (property.NameEquals("rotationPolicy"u8)) + { + rotationPolicy = new PrivateKeyRotationPolicy(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CertManagerPrivateKey(algorithm, rotationPolicy, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CertManagerPrivateKey)} does not support writing '{options.Format}' format."); + } + } + + CertManagerPrivateKey IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCertManagerPrivateKey(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CertManagerPrivateKey)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerPrivateKey.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerPrivateKey.cs new file mode 100644 index 000000000000..35eec05009f0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CertManagerPrivateKey.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Cert Manager private key properties. + public partial class CertManagerPrivateKey + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// algorithm for private key. + /// cert-manager private key rotationPolicy. + public CertManagerPrivateKey(PrivateKeyAlgorithm algorithm, PrivateKeyRotationPolicy rotationPolicy) + { + Algorithm = algorithm; + RotationPolicy = rotationPolicy; + } + + /// Initializes a new instance of . + /// algorithm for private key. + /// cert-manager private key rotationPolicy. + /// Keeps track of any properties unknown to the library. + internal CertManagerPrivateKey(PrivateKeyAlgorithm algorithm, PrivateKeyRotationPolicy rotationPolicy, IDictionary serializedAdditionalRawData) + { + Algorithm = algorithm; + RotationPolicy = rotationPolicy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CertManagerPrivateKey() + { + } + + /// algorithm for private key. + public PrivateKeyAlgorithm Algorithm { get; set; } + /// cert-manager private key rotationPolicy. + public PrivateKeyRotationPolicy RotationPolicy { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ClientConfig.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ClientConfig.Serialization.cs new file mode 100644 index 000000000000..53b7e9916483 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ClientConfig.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class ClientConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClientConfig)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(MaxSessionExpirySeconds)) + { + writer.WritePropertyName("maxSessionExpirySeconds"u8); + writer.WriteNumberValue(MaxSessionExpirySeconds.Value); + } + if (Optional.IsDefined(MaxMessageExpirySeconds)) + { + writer.WritePropertyName("maxMessageExpirySeconds"u8); + writer.WriteNumberValue(MaxMessageExpirySeconds.Value); + } + if (Optional.IsDefined(MaxPacketSizeBytes)) + { + writer.WritePropertyName("maxPacketSizeBytes"u8); + writer.WriteNumberValue(MaxPacketSizeBytes.Value); + } + if (Optional.IsDefined(SubscriberQueueLimit)) + { + writer.WritePropertyName("subscriberQueueLimit"u8); + writer.WriteObjectValue(SubscriberQueueLimit, options); + } + if (Optional.IsDefined(MaxReceiveMaximum)) + { + writer.WritePropertyName("maxReceiveMaximum"u8); + writer.WriteNumberValue(MaxReceiveMaximum.Value); + } + if (Optional.IsDefined(MaxKeepAliveSeconds)) + { + writer.WritePropertyName("maxKeepAliveSeconds"u8); + writer.WriteNumberValue(MaxKeepAliveSeconds.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ClientConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClientConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeClientConfig(document.RootElement, options); + } + + internal static ClientConfig DeserializeClientConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? maxSessionExpirySeconds = default; + int? maxMessageExpirySeconds = default; + int? maxPacketSizeBytes = default; + SubscriberQueueLimit subscriberQueueLimit = default; + int? maxReceiveMaximum = default; + int? maxKeepAliveSeconds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("maxSessionExpirySeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxSessionExpirySeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxMessageExpirySeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxMessageExpirySeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxPacketSizeBytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxPacketSizeBytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("subscriberQueueLimit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriberQueueLimit = SubscriberQueueLimit.DeserializeSubscriberQueueLimit(property.Value, options); + continue; + } + if (property.NameEquals("maxReceiveMaximum"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxReceiveMaximum = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxKeepAliveSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxKeepAliveSeconds = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ClientConfig( + maxSessionExpirySeconds, + maxMessageExpirySeconds, + maxPacketSizeBytes, + subscriberQueueLimit, + maxReceiveMaximum, + maxKeepAliveSeconds, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ClientConfig)} does not support writing '{options.Format}' format."); + } + } + + ClientConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeClientConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ClientConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ClientConfig.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ClientConfig.cs new file mode 100644 index 000000000000..ebfcf5bbd08d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ClientConfig.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The settings of Client Config. + public partial class ClientConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ClientConfig() + { + } + + /// Initializes a new instance of . + /// Upper bound of Session Expiry Interval, in seconds. + /// Upper bound of Message Expiry Interval, in seconds. + /// Max message size for a packet in Bytes. + /// The limit on the number of queued messages for a subscriber. + /// Upper bound of Receive Maximum that a client can request in the CONNECT packet. + /// Upper bound of a client's Keep Alive, in seconds. + /// Keeps track of any properties unknown to the library. + internal ClientConfig(int? maxSessionExpirySeconds, int? maxMessageExpirySeconds, int? maxPacketSizeBytes, SubscriberQueueLimit subscriberQueueLimit, int? maxReceiveMaximum, int? maxKeepAliveSeconds, IDictionary serializedAdditionalRawData) + { + MaxSessionExpirySeconds = maxSessionExpirySeconds; + MaxMessageExpirySeconds = maxMessageExpirySeconds; + MaxPacketSizeBytes = maxPacketSizeBytes; + SubscriberQueueLimit = subscriberQueueLimit; + MaxReceiveMaximum = maxReceiveMaximum; + MaxKeepAliveSeconds = maxKeepAliveSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Upper bound of Session Expiry Interval, in seconds. + public int? MaxSessionExpirySeconds { get; set; } + /// Upper bound of Message Expiry Interval, in seconds. + public int? MaxMessageExpirySeconds { get; set; } + /// Max message size for a packet in Bytes. + public int? MaxPacketSizeBytes { get; set; } + /// The limit on the number of queued messages for a subscriber. + public SubscriberQueueLimit SubscriberQueueLimit { get; set; } + /// Upper bound of Receive Maximum that a client can request in the CONNECT packet. + public int? MaxReceiveMaximum { get; set; } + /// Upper bound of a client's Keep Alive, in seconds. + public int? MaxKeepAliveSeconds { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CloudEventAttributeType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CloudEventAttributeType.cs new file mode 100644 index 000000000000..07e184c2b88f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/CloudEventAttributeType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// How to map events to the cloud. + public readonly partial struct CloudEventAttributeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CloudEventAttributeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PropagateValue = "Propagate"; + private const string CreateOrRemapValue = "CreateOrRemap"; + + /// Propagate type. + public static CloudEventAttributeType Propagate { get; } = new CloudEventAttributeType(PropagateValue); + /// CreateOrRemap type. + public static CloudEventAttributeType CreateOrRemap { get; } = new CloudEventAttributeType(CreateOrRemapValue); + /// Determines if two values are the same. + public static bool operator ==(CloudEventAttributeType left, CloudEventAttributeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CloudEventAttributeType left, CloudEventAttributeType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CloudEventAttributeType(string value) => new CloudEventAttributeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CloudEventAttributeType other && Equals(other); + /// + public bool Equals(CloudEventAttributeType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataExplorerAuthMethod.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataExplorerAuthMethod.cs new file mode 100644 index 000000000000..497e5a24a524 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataExplorerAuthMethod.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Data Explorer Authentication Method properties. + public readonly partial struct DataExplorerAuthMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataExplorerAuthMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedManagedIdentityValue = "SystemAssignedManagedIdentity"; + private const string UserAssignedManagedIdentityValue = "UserAssignedManagedIdentity"; + + /// SystemAssignedManagedIdentity type. + public static DataExplorerAuthMethod SystemAssignedManagedIdentity { get; } = new DataExplorerAuthMethod(SystemAssignedManagedIdentityValue); + /// UserAssignedManagedIdentity type. + public static DataExplorerAuthMethod UserAssignedManagedIdentity { get; } = new DataExplorerAuthMethod(UserAssignedManagedIdentityValue); + /// Determines if two values are the same. + public static bool operator ==(DataExplorerAuthMethod left, DataExplorerAuthMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataExplorerAuthMethod left, DataExplorerAuthMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataExplorerAuthMethod(string value) => new DataExplorerAuthMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataExplorerAuthMethod other && Equals(other); + /// + public bool Equals(DataExplorerAuthMethod 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataLakeStorageAuthMethod.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataLakeStorageAuthMethod.cs new file mode 100644 index 000000000000..a922c04fa468 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataLakeStorageAuthMethod.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Data Lake Storage Authentication Method properties. + public readonly partial struct DataLakeStorageAuthMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataLakeStorageAuthMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedManagedIdentityValue = "SystemAssignedManagedIdentity"; + private const string UserAssignedManagedIdentityValue = "UserAssignedManagedIdentity"; + private const string AccessTokenValue = "AccessToken"; + + /// SystemAssignedManagedIdentity type. + public static DataLakeStorageAuthMethod SystemAssignedManagedIdentity { get; } = new DataLakeStorageAuthMethod(SystemAssignedManagedIdentityValue); + /// UserAssignedManagedIdentity type. + public static DataLakeStorageAuthMethod UserAssignedManagedIdentity { get; } = new DataLakeStorageAuthMethod(UserAssignedManagedIdentityValue); + /// AccessToken Option. + public static DataLakeStorageAuthMethod AccessToken { get; } = new DataLakeStorageAuthMethod(AccessTokenValue); + /// Determines if two values are the same. + public static bool operator ==(DataLakeStorageAuthMethod left, DataLakeStorageAuthMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataLakeStorageAuthMethod left, DataLakeStorageAuthMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataLakeStorageAuthMethod(string value) => new DataLakeStorageAuthMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataLakeStorageAuthMethod other && Equals(other); + /// + public bool Equals(DataLakeStorageAuthMethod 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationDataset.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationDataset.Serialization.cs new file mode 100644 index 000000000000..32fdd41ed448 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationDataset.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowBuiltInTransformationDataset : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationDataset)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(SchemaRef)) + { + writer.WritePropertyName("schemaRef"u8); + writer.WriteStringValue(SchemaRef); + } + writer.WritePropertyName("inputs"u8); + writer.WriteStartArray(); + foreach (var item in Inputs) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Expression)) + { + writer.WritePropertyName("expression"u8); + writer.WriteStringValue(Expression); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowBuiltInTransformationDataset IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationDataset)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowBuiltInTransformationDataset(document.RootElement, options); + } + + internal static DataflowBuiltInTransformationDataset DeserializeDataflowBuiltInTransformationDataset(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + string description = default; + string schemaRef = default; + IList inputs = default; + string expression = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("schemaRef"u8)) + { + schemaRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("inputs"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + inputs = array; + continue; + } + if (property.NameEquals("expression"u8)) + { + expression = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowBuiltInTransformationDataset( + key, + description, + schemaRef, + inputs, + expression, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationDataset)} does not support writing '{options.Format}' format."); + } + } + + DataflowBuiltInTransformationDataset IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowBuiltInTransformationDataset(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationDataset)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationDataset.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationDataset.cs new file mode 100644 index 000000000000..0270fee0286a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationDataset.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow BuiltIn Transformation dataset properties. + public partial class DataflowBuiltInTransformationDataset + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The key of the dataset. + /// List of fields for enriching from the Broker State Store. + /// or is null. + public DataflowBuiltInTransformationDataset(string key, IEnumerable inputs) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(inputs, nameof(inputs)); + + Key = key; + Inputs = inputs.ToList(); + } + + /// Initializes a new instance of . + /// The key of the dataset. + /// A user provided optional description of the dataset. + /// The reference to the schema that describes the dataset. Allowed: JSON Schema/draft-7. + /// List of fields for enriching from the Broker State Store. + /// Condition to enrich data from Broker State Store. Example: $1 < 0 || $1 > $2 (Assuming inputs section $1 and $2 are provided). + /// Keeps track of any properties unknown to the library. + internal DataflowBuiltInTransformationDataset(string key, string description, string schemaRef, IList inputs, string expression, IDictionary serializedAdditionalRawData) + { + Key = key; + Description = description; + SchemaRef = schemaRef; + Inputs = inputs; + Expression = expression; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowBuiltInTransformationDataset() + { + } + + /// The key of the dataset. + public string Key { get; set; } + /// A user provided optional description of the dataset. + public string Description { get; set; } + /// The reference to the schema that describes the dataset. Allowed: JSON Schema/draft-7. + public string SchemaRef { get; set; } + /// List of fields for enriching from the Broker State Store. + public IList Inputs { get; } + /// Condition to enrich data from Broker State Store. Example: $1 < 0 || $1 > $2 (Assuming inputs section $1 and $2 are provided). + public string Expression { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationFilter.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationFilter.Serialization.cs new file mode 100644 index 000000000000..a9df943a83ec --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationFilter.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowBuiltInTransformationFilter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationFilter)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.Value.ToString()); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("inputs"u8); + writer.WriteStartArray(); + foreach (var item in Inputs) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("expression"u8); + writer.WriteStringValue(Expression); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowBuiltInTransformationFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowBuiltInTransformationFilter(document.RootElement, options); + } + + internal static DataflowBuiltInTransformationFilter DeserializeDataflowBuiltInTransformationFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FilterType? type = default; + string description = default; + IList inputs = default; + string expression = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new FilterType(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("inputs"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + inputs = array; + continue; + } + if (property.NameEquals("expression"u8)) + { + expression = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowBuiltInTransformationFilter(type, description, inputs, expression, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationFilter)} does not support writing '{options.Format}' format."); + } + } + + DataflowBuiltInTransformationFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowBuiltInTransformationFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationFilter.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationFilter.cs new file mode 100644 index 000000000000..c95447d44c52 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationFilter.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow BuiltIn Transformation filter properties. + public partial class DataflowBuiltInTransformationFilter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of fields for filtering in JSON path expression. + /// Condition to filter data. Can reference input fields with {n} where n is the index of the input field starting from 1. Example: $1 < 0 || $1 > $2 (Assuming inputs section $1 and $2 are provided). + /// or is null. + public DataflowBuiltInTransformationFilter(IEnumerable inputs, string expression) + { + Argument.AssertNotNull(inputs, nameof(inputs)); + Argument.AssertNotNull(expression, nameof(expression)); + + Inputs = inputs.ToList(); + Expression = expression; + } + + /// Initializes a new instance of . + /// The type of dataflow operation. + /// A user provided optional description of the filter. + /// List of fields for filtering in JSON path expression. + /// Condition to filter data. Can reference input fields with {n} where n is the index of the input field starting from 1. Example: $1 < 0 || $1 > $2 (Assuming inputs section $1 and $2 are provided). + /// Keeps track of any properties unknown to the library. + internal DataflowBuiltInTransformationFilter(FilterType? type, string description, IList inputs, string expression, IDictionary serializedAdditionalRawData) + { + Type = type; + Description = description; + Inputs = inputs; + Expression = expression; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowBuiltInTransformationFilter() + { + } + + /// The type of dataflow operation. + public FilterType? Type { get; set; } + /// A user provided optional description of the filter. + public string Description { get; set; } + /// List of fields for filtering in JSON path expression. + public IList Inputs { get; } + /// Condition to filter data. Can reference input fields with {n} where n is the index of the input field starting from 1. Example: $1 < 0 || $1 > $2 (Assuming inputs section $1 and $2 are provided). + public string Expression { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationMap.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationMap.Serialization.cs new file mode 100644 index 000000000000..2bd8204665dc --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationMap.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowBuiltInTransformationMap : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationMap)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.Value.ToString()); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("inputs"u8); + writer.WriteStartArray(); + foreach (var item in Inputs) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Expression)) + { + writer.WritePropertyName("expression"u8); + writer.WriteStringValue(Expression); + } + writer.WritePropertyName("output"u8); + writer.WriteStringValue(Output); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowBuiltInTransformationMap IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationMap)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowBuiltInTransformationMap(document.RootElement, options); + } + + internal static DataflowBuiltInTransformationMap DeserializeDataflowBuiltInTransformationMap(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowMappingType? type = default; + string description = default; + IList inputs = default; + string expression = default; + string output = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new DataflowMappingType(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("inputs"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + inputs = array; + continue; + } + if (property.NameEquals("expression"u8)) + { + expression = property.Value.GetString(); + continue; + } + if (property.NameEquals("output"u8)) + { + output = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowBuiltInTransformationMap( + type, + description, + inputs, + expression, + output, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationMap)} does not support writing '{options.Format}' format."); + } + } + + DataflowBuiltInTransformationMap IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowBuiltInTransformationMap(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationMap)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationMap.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationMap.cs new file mode 100644 index 000000000000..b8af2195825c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationMap.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow BuiltIn Transformation map properties. + public partial class DataflowBuiltInTransformationMap + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of fields for mapping in JSON path expression. + /// Where and how the input fields to be organized in the output record. + /// or is null. + public DataflowBuiltInTransformationMap(IEnumerable inputs, string output) + { + Argument.AssertNotNull(inputs, nameof(inputs)); + Argument.AssertNotNull(output, nameof(output)); + + Inputs = inputs.ToList(); + Output = output; + } + + /// Initializes a new instance of . + /// Type of transformation. + /// A user provided optional description of the mapping function. + /// List of fields for mapping in JSON path expression. + /// Modify the inputs field(s) to the final output field. Example: $1 * 2.2 (Assuming inputs section $1 is provided). + /// Where and how the input fields to be organized in the output record. + /// Keeps track of any properties unknown to the library. + internal DataflowBuiltInTransformationMap(DataflowMappingType? type, string description, IList inputs, string expression, string output, IDictionary serializedAdditionalRawData) + { + Type = type; + Description = description; + Inputs = inputs; + Expression = expression; + Output = output; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowBuiltInTransformationMap() + { + } + + /// Type of transformation. + public DataflowMappingType? Type { get; set; } + /// A user provided optional description of the mapping function. + public string Description { get; set; } + /// List of fields for mapping in JSON path expression. + public IList Inputs { get; } + /// Modify the inputs field(s) to the final output field. Example: $1 * 2.2 (Assuming inputs section $1 is provided). + public string Expression { get; set; } + /// Where and how the input fields to be organized in the output record. + public string Output { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationSettings.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationSettings.Serialization.cs new file mode 100644 index 000000000000..d557ce13973f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationSettings.Serialization.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowBuiltInTransformationSettings : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationSettings)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SerializationFormat)) + { + writer.WritePropertyName("serializationFormat"u8); + writer.WriteStringValue(SerializationFormat.Value.ToString()); + } + if (Optional.IsDefined(SchemaRef)) + { + writer.WritePropertyName("schemaRef"u8); + writer.WriteStringValue(SchemaRef); + } + if (Optional.IsCollectionDefined(Datasets)) + { + writer.WritePropertyName("datasets"u8); + writer.WriteStartArray(); + foreach (var item in Datasets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Filter)) + { + writer.WritePropertyName("filter"u8); + writer.WriteStartArray(); + foreach (var item in Filter) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Map)) + { + writer.WritePropertyName("map"u8); + writer.WriteStartArray(); + foreach (var item in Map) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowBuiltInTransformationSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationSettings)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowBuiltInTransformationSettings(document.RootElement, options); + } + + internal static DataflowBuiltInTransformationSettings DeserializeDataflowBuiltInTransformationSettings(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TransformationSerializationFormat? serializationFormat = default; + string schemaRef = default; + IList datasets = default; + IList filter = default; + IList map = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("serializationFormat"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serializationFormat = new TransformationSerializationFormat(property.Value.GetString()); + continue; + } + if (property.NameEquals("schemaRef"u8)) + { + schemaRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("datasets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataflowBuiltInTransformationDataset.DeserializeDataflowBuiltInTransformationDataset(item, options)); + } + datasets = array; + continue; + } + if (property.NameEquals("filter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataflowBuiltInTransformationFilter.DeserializeDataflowBuiltInTransformationFilter(item, options)); + } + filter = array; + continue; + } + if (property.NameEquals("map"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataflowBuiltInTransformationMap.DeserializeDataflowBuiltInTransformationMap(item, options)); + } + map = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowBuiltInTransformationSettings( + serializationFormat, + schemaRef, + datasets ?? new ChangeTrackingList(), + filter ?? new ChangeTrackingList(), + map ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationSettings)} does not support writing '{options.Format}' format."); + } + } + + DataflowBuiltInTransformationSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowBuiltInTransformationSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowBuiltInTransformationSettings)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationSettings.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationSettings.cs new file mode 100644 index 000000000000..a97cbd5a1ea8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowBuiltInTransformationSettings.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow BuiltIn Transformation properties. + public partial class DataflowBuiltInTransformationSettings + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DataflowBuiltInTransformationSettings() + { + Datasets = new ChangeTrackingList(); + Filter = new ChangeTrackingList(); + Map = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Serialization format. Optional; defaults to JSON. Allowed value JSON Schema/draft-7, Parquet. Default: Json. + /// Reference to the schema that describes the output of the transformation. + /// Enrich data from Broker State Store. Dataset references a key in Broker State Store. + /// Filters input record or datapoints based on condition. + /// Maps input to output message. + /// Keeps track of any properties unknown to the library. + internal DataflowBuiltInTransformationSettings(TransformationSerializationFormat? serializationFormat, string schemaRef, IList datasets, IList filter, IList map, IDictionary serializedAdditionalRawData) + { + SerializationFormat = serializationFormat; + SchemaRef = schemaRef; + Datasets = datasets; + Filter = filter; + Map = map; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Serialization format. Optional; defaults to JSON. Allowed value JSON Schema/draft-7, Parquet. Default: Json. + public TransformationSerializationFormat? SerializationFormat { get; set; } + /// Reference to the schema that describes the output of the transformation. + public string SchemaRef { get; set; } + /// Enrich data from Broker State Store. Dataset references a key in Broker State Store. + public IList Datasets { get; } + /// Filters input record or datapoints based on condition. + public IList Filter { get; } + /// Maps input to output message. + public IList Map { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowDestinationOperationSettings.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowDestinationOperationSettings.Serialization.cs new file mode 100644 index 000000000000..757f166251cd --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowDestinationOperationSettings.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowDestinationOperationSettings : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowDestinationOperationSettings)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("endpointRef"u8); + writer.WriteStringValue(EndpointRef); + writer.WritePropertyName("dataDestination"u8); + writer.WriteStringValue(DataDestination); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowDestinationOperationSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowDestinationOperationSettings)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowDestinationOperationSettings(document.RootElement, options); + } + + internal static DataflowDestinationOperationSettings DeserializeDataflowDestinationOperationSettings(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string endpointRef = default; + string dataDestination = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("endpointRef"u8)) + { + endpointRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataDestination"u8)) + { + dataDestination = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowDestinationOperationSettings(endpointRef, dataDestination, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowDestinationOperationSettings)} does not support writing '{options.Format}' format."); + } + } + + DataflowDestinationOperationSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowDestinationOperationSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowDestinationOperationSettings)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowDestinationOperationSettings.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowDestinationOperationSettings.cs new file mode 100644 index 000000000000..288b6a1c4c26 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowDestinationOperationSettings.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow Destination Operation properties. + public partial class DataflowDestinationOperationSettings + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Reference to the Endpoint CR. Can be of Broker, Kafka, Fabric, ADLS, ADX type. + /// Destination location, can be a topic or table name. Supports dynamic values with $topic, $systemProperties, $userProperties, $payload, $context, and $subscription. + /// or is null. + public DataflowDestinationOperationSettings(string endpointRef, string dataDestination) + { + Argument.AssertNotNull(endpointRef, nameof(endpointRef)); + Argument.AssertNotNull(dataDestination, nameof(dataDestination)); + + EndpointRef = endpointRef; + DataDestination = dataDestination; + } + + /// Initializes a new instance of . + /// Reference to the Endpoint CR. Can be of Broker, Kafka, Fabric, ADLS, ADX type. + /// Destination location, can be a topic or table name. Supports dynamic values with $topic, $systemProperties, $userProperties, $payload, $context, and $subscription. + /// Keeps track of any properties unknown to the library. + internal DataflowDestinationOperationSettings(string endpointRef, string dataDestination, IDictionary serializedAdditionalRawData) + { + EndpointRef = endpointRef; + DataDestination = dataDestination; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowDestinationOperationSettings() + { + } + + /// Reference to the Endpoint CR. Can be of Broker, Kafka, Fabric, ADLS, ADX type. + public string EndpointRef { get; set; } + /// Destination location, can be a topic or table name. Supports dynamic values with $topic, $systemProperties, $userProperties, $payload, $context, and $subscription. + public string DataDestination { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationAccessToken.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationAccessToken.Serialization.cs new file mode 100644 index 000000000000..a545c3c3551b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationAccessToken.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class DataflowEndpointAuthenticationAccessToken : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationAccessToken)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("secretRef"u8); + writer.WriteStringValue(SecretRef); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointAuthenticationAccessToken IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationAccessToken)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointAuthenticationAccessToken(document.RootElement, options); + } + + internal static DataflowEndpointAuthenticationAccessToken DeserializeDataflowEndpointAuthenticationAccessToken(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string secretRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretRef"u8)) + { + secretRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointAuthenticationAccessToken(secretRef, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationAccessToken)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointAuthenticationAccessToken IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointAuthenticationAccessToken(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationAccessToken)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationAccessToken.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationAccessToken.cs new file mode 100644 index 000000000000..69bea2335018 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationAccessToken.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Authentication Access Token properties. + internal partial class DataflowEndpointAuthenticationAccessToken + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Token secret name. + /// is null. + public DataflowEndpointAuthenticationAccessToken(string secretRef) + { + Argument.AssertNotNull(secretRef, nameof(secretRef)); + + SecretRef = secretRef; + } + + /// Initializes a new instance of . + /// Token secret name. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointAuthenticationAccessToken(string secretRef, IDictionary serializedAdditionalRawData) + { + SecretRef = secretRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointAuthenticationAccessToken() + { + } + + /// Token secret name. + public string SecretRef { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSasl.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSasl.Serialization.cs new file mode 100644 index 000000000000..30e1f18b036b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSasl.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointAuthenticationSasl : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationSasl)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("saslType"u8); + writer.WriteStringValue(SaslType.ToString()); + writer.WritePropertyName("secretRef"u8); + writer.WriteStringValue(SecretRef); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointAuthenticationSasl IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationSasl)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointAuthenticationSasl(document.RootElement, options); + } + + internal static DataflowEndpointAuthenticationSasl DeserializeDataflowEndpointAuthenticationSasl(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowEndpointAuthenticationSaslType saslType = default; + string secretRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("saslType"u8)) + { + saslType = new DataflowEndpointAuthenticationSaslType(property.Value.GetString()); + continue; + } + if (property.NameEquals("secretRef"u8)) + { + secretRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointAuthenticationSasl(saslType, secretRef, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationSasl)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointAuthenticationSasl IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointAuthenticationSasl(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationSasl)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSasl.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSasl.cs new file mode 100644 index 000000000000..8fd546f5c26c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSasl.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Authentication Sasl properties. + public partial class DataflowEndpointAuthenticationSasl + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Type of SASL authentication. Can be PLAIN, SCRAM-SHA-256, or SCRAM-SHA-512. + /// Token secret name. + /// is null. + public DataflowEndpointAuthenticationSasl(DataflowEndpointAuthenticationSaslType saslType, string secretRef) + { + Argument.AssertNotNull(secretRef, nameof(secretRef)); + + SaslType = saslType; + SecretRef = secretRef; + } + + /// Initializes a new instance of . + /// Type of SASL authentication. Can be PLAIN, SCRAM-SHA-256, or SCRAM-SHA-512. + /// Token secret name. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointAuthenticationSasl(DataflowEndpointAuthenticationSaslType saslType, string secretRef, IDictionary serializedAdditionalRawData) + { + SaslType = saslType; + SecretRef = secretRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointAuthenticationSasl() + { + } + + /// Type of SASL authentication. Can be PLAIN, SCRAM-SHA-256, or SCRAM-SHA-512. + public DataflowEndpointAuthenticationSaslType SaslType { get; set; } + /// Token secret name. + public string SecretRef { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSaslType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSaslType.cs new file mode 100644 index 000000000000..fadb844f7b05 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSaslType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Authentication Sasl Type properties. + public readonly partial struct DataflowEndpointAuthenticationSaslType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataflowEndpointAuthenticationSaslType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PlainValue = "Plain"; + private const string ScramSha256Value = "ScramSha256"; + private const string ScramSha512Value = "ScramSha512"; + + /// PLAIN Type. + public static DataflowEndpointAuthenticationSaslType Plain { get; } = new DataflowEndpointAuthenticationSaslType(PlainValue); + /// SCRAM_SHA_256 Type. + public static DataflowEndpointAuthenticationSaslType ScramSha256 { get; } = new DataflowEndpointAuthenticationSaslType(ScramSha256Value); + /// SCRAM_SHA_512 Type. + public static DataflowEndpointAuthenticationSaslType ScramSha512 { get; } = new DataflowEndpointAuthenticationSaslType(ScramSha512Value); + /// Determines if two values are the same. + public static bool operator ==(DataflowEndpointAuthenticationSaslType left, DataflowEndpointAuthenticationSaslType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataflowEndpointAuthenticationSaslType left, DataflowEndpointAuthenticationSaslType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataflowEndpointAuthenticationSaslType(string value) => new DataflowEndpointAuthenticationSaslType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataflowEndpointAuthenticationSaslType other && Equals(other); + /// + public bool Equals(DataflowEndpointAuthenticationSaslType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationServiceAccountToken.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationServiceAccountToken.Serialization.cs new file mode 100644 index 000000000000..0713ffa31087 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationServiceAccountToken.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class DataflowEndpointAuthenticationServiceAccountToken : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationServiceAccountToken)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("audience"u8); + writer.WriteStringValue(Audience); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointAuthenticationServiceAccountToken IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationServiceAccountToken)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointAuthenticationServiceAccountToken(document.RootElement, options); + } + + internal static DataflowEndpointAuthenticationServiceAccountToken DeserializeDataflowEndpointAuthenticationServiceAccountToken(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string audience = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("audience"u8)) + { + audience = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointAuthenticationServiceAccountToken(audience, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationServiceAccountToken)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointAuthenticationServiceAccountToken IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointAuthenticationServiceAccountToken(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationServiceAccountToken)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationServiceAccountToken.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationServiceAccountToken.cs new file mode 100644 index 000000000000..38bee6a4d38f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationServiceAccountToken.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Service Account Token for BrokerAuthentication. + internal partial class DataflowEndpointAuthenticationServiceAccountToken + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Audience of the service account. Optional, defaults to the broker internal service account audience. + /// is null. + public DataflowEndpointAuthenticationServiceAccountToken(string audience) + { + Argument.AssertNotNull(audience, nameof(audience)); + + Audience = audience; + } + + /// Initializes a new instance of . + /// Audience of the service account. Optional, defaults to the broker internal service account audience. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointAuthenticationServiceAccountToken(string audience, IDictionary serializedAdditionalRawData) + { + Audience = audience; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointAuthenticationServiceAccountToken() + { + } + + /// Audience of the service account. Optional, defaults to the broker internal service account audience. + public string Audience { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSystemAssignedManagedIdentity.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSystemAssignedManagedIdentity.Serialization.cs new file mode 100644 index 000000000000..983c2139b52c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSystemAssignedManagedIdentity.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class DataflowEndpointAuthenticationSystemAssignedManagedIdentity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationSystemAssignedManagedIdentity)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Audience)) + { + writer.WritePropertyName("audience"u8); + writer.WriteStringValue(Audience); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointAuthenticationSystemAssignedManagedIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationSystemAssignedManagedIdentity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointAuthenticationSystemAssignedManagedIdentity(document.RootElement, options); + } + + internal static DataflowEndpointAuthenticationSystemAssignedManagedIdentity DeserializeDataflowEndpointAuthenticationSystemAssignedManagedIdentity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string audience = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("audience"u8)) + { + audience = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointAuthenticationSystemAssignedManagedIdentity(audience, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationSystemAssignedManagedIdentity)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointAuthenticationSystemAssignedManagedIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointAuthenticationSystemAssignedManagedIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationSystemAssignedManagedIdentity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSystemAssignedManagedIdentity.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSystemAssignedManagedIdentity.cs new file mode 100644 index 000000000000..3cc95969dc1c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationSystemAssignedManagedIdentity.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Authentication SystemAssignedManagedIdentity properties. + internal partial class DataflowEndpointAuthenticationSystemAssignedManagedIdentity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DataflowEndpointAuthenticationSystemAssignedManagedIdentity() + { + } + + /// Initializes a new instance of . + /// Audience of the service to authenticate against. Optional; defaults to the audience for Service host configuration. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointAuthenticationSystemAssignedManagedIdentity(string audience, IDictionary serializedAdditionalRawData) + { + Audience = audience; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Audience of the service to authenticate against. Optional; defaults to the audience for Service host configuration. + public string Audience { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationUserAssignedManagedIdentity.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationUserAssignedManagedIdentity.Serialization.cs new file mode 100644 index 000000000000..637cf7a40d66 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationUserAssignedManagedIdentity.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.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointAuthenticationUserAssignedManagedIdentity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationUserAssignedManagedIdentity)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointAuthenticationUserAssignedManagedIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationUserAssignedManagedIdentity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointAuthenticationUserAssignedManagedIdentity(document.RootElement, options); + } + + internal static DataflowEndpointAuthenticationUserAssignedManagedIdentity DeserializeDataflowEndpointAuthenticationUserAssignedManagedIdentity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientId = default; + string scope = default; + string tenantId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("scope"u8)) + { + scope = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId"u8)) + { + tenantId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointAuthenticationUserAssignedManagedIdentity(clientId, scope, tenantId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationUserAssignedManagedIdentity)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointAuthenticationUserAssignedManagedIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointAuthenticationUserAssignedManagedIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationUserAssignedManagedIdentity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationUserAssignedManagedIdentity.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationUserAssignedManagedIdentity.cs new file mode 100644 index 000000000000..b7f15357a13c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationUserAssignedManagedIdentity.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Authentication UserAssignedManagedIdentity properties. + public partial class DataflowEndpointAuthenticationUserAssignedManagedIdentity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Client ID for the user-assigned managed identity. + /// Tenant ID. + /// or is null. + public DataflowEndpointAuthenticationUserAssignedManagedIdentity(string clientId, string tenantId) + { + Argument.AssertNotNull(clientId, nameof(clientId)); + Argument.AssertNotNull(tenantId, nameof(tenantId)); + + ClientId = clientId; + TenantId = tenantId; + } + + /// Initializes a new instance of . + /// Client ID for the user-assigned managed identity. + /// Resource identifier (application ID URI) of the resource, affixed with the .default suffix. + /// Tenant ID. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointAuthenticationUserAssignedManagedIdentity(string clientId, string scope, string tenantId, IDictionary serializedAdditionalRawData) + { + ClientId = clientId; + Scope = scope; + TenantId = tenantId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointAuthenticationUserAssignedManagedIdentity() + { + } + + /// Client ID for the user-assigned managed identity. + public string ClientId { get; set; } + /// Resource identifier (application ID URI) of the resource, affixed with the .default suffix. + public string Scope { get; set; } + /// Tenant ID. + public string TenantId { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationX509.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationX509.Serialization.cs new file mode 100644 index 000000000000..c6b0ff0271e2 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationX509.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class DataflowEndpointAuthenticationX509 : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationX509)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("secretRef"u8); + writer.WriteStringValue(SecretRef); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointAuthenticationX509 IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationX509)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointAuthenticationX509(document.RootElement, options); + } + + internal static DataflowEndpointAuthenticationX509 DeserializeDataflowEndpointAuthenticationX509(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string secretRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretRef"u8)) + { + secretRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointAuthenticationX509(secretRef, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationX509)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointAuthenticationX509 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointAuthenticationX509(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointAuthenticationX509)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationX509.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationX509.cs new file mode 100644 index 000000000000..f63afc4b2e8b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointAuthenticationX509.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Authentication X509 properties. + internal partial class DataflowEndpointAuthenticationX509 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Secret reference of the X.509 certificate. + /// is null. + public DataflowEndpointAuthenticationX509(string secretRef) + { + Argument.AssertNotNull(secretRef, nameof(secretRef)); + + SecretRef = secretRef; + } + + /// Initializes a new instance of . + /// Secret reference of the X.509 certificate. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointAuthenticationX509(string secretRef, IDictionary serializedAdditionalRawData) + { + SecretRef = secretRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointAuthenticationX509() + { + } + + /// Secret reference of the X.509 certificate. + public string SecretRef { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorer.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorer.Serialization.cs new file mode 100644 index 000000000000..40a7a40291d0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorer.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointDataExplorer : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointDataExplorer)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("authentication"u8); + writer.WriteObjectValue(Authentication, options); + writer.WritePropertyName("database"u8); + writer.WriteStringValue(Database); + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + if (Optional.IsDefined(Batching)) + { + writer.WritePropertyName("batching"u8); + writer.WriteObjectValue(Batching, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointDataExplorer IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointDataExplorer)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointDataExplorer(document.RootElement, options); + } + + internal static DataflowEndpointDataExplorer DeserializeDataflowEndpointDataExplorer(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowEndpointDataExplorerAuthentication authentication = default; + string database = default; + string host = default; + BatchingConfiguration batching = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authentication"u8)) + { + authentication = DataflowEndpointDataExplorerAuthentication.DeserializeDataflowEndpointDataExplorerAuthentication(property.Value, options); + continue; + } + if (property.NameEquals("database"u8)) + { + database = property.Value.GetString(); + continue; + } + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("batching"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + batching = BatchingConfiguration.DeserializeBatchingConfiguration(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointDataExplorer(authentication, database, host, batching, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointDataExplorer)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointDataExplorer IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointDataExplorer(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointDataExplorer)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorer.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorer.cs new file mode 100644 index 000000000000..4157303e6339 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorer.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Azure Data Explorer endpoint properties. + public partial class DataflowEndpointDataExplorer + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Authentication configuration. NOTE - only authentication property is allowed per entry. + /// Database name. + /// Host of the Azure Data Explorer in the form of <cluster>.<region>.kusto.windows.net . + /// , or is null. + public DataflowEndpointDataExplorer(DataflowEndpointDataExplorerAuthentication authentication, string database, string host) + { + Argument.AssertNotNull(authentication, nameof(authentication)); + Argument.AssertNotNull(database, nameof(database)); + Argument.AssertNotNull(host, nameof(host)); + + Authentication = authentication; + Database = database; + Host = host; + } + + /// Initializes a new instance of . + /// Authentication configuration. NOTE - only authentication property is allowed per entry. + /// Database name. + /// Host of the Azure Data Explorer in the form of <cluster>.<region>.kusto.windows.net . + /// Azure Data Explorer endpoint batching configuration. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointDataExplorer(DataflowEndpointDataExplorerAuthentication authentication, string database, string host, BatchingConfiguration batching, IDictionary serializedAdditionalRawData) + { + Authentication = authentication; + Database = database; + Host = host; + Batching = batching; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointDataExplorer() + { + } + + /// Authentication configuration. NOTE - only authentication property is allowed per entry. + public DataflowEndpointDataExplorerAuthentication Authentication { get; set; } + /// Database name. + public string Database { get; set; } + /// Host of the Azure Data Explorer in the form of <cluster>.<region>.kusto.windows.net . + public string Host { get; set; } + /// Azure Data Explorer endpoint batching configuration. + public BatchingConfiguration Batching { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorerAuthentication.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorerAuthentication.Serialization.cs new file mode 100644 index 000000000000..d880fd96c7b8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorerAuthentication.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointDataExplorerAuthentication : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointDataExplorerAuthentication)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.ToString()); + if (Optional.IsDefined(SystemAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("systemAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(SystemAssignedManagedIdentitySettings, options); + } + if (Optional.IsDefined(UserAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("userAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(UserAssignedManagedIdentitySettings, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointDataExplorerAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointDataExplorerAuthentication)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointDataExplorerAuthentication(document.RootElement, options); + } + + internal static DataflowEndpointDataExplorerAuthentication DeserializeDataflowEndpointDataExplorerAuthentication(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataExplorerAuthMethod method = default; + DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings = default; + DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("method"u8)) + { + method = new DataExplorerAuthMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemAssignedManagedIdentitySettings = DataflowEndpointAuthenticationSystemAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationSystemAssignedManagedIdentity(property.Value, options); + continue; + } + if (property.NameEquals("userAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userAssignedManagedIdentitySettings = DataflowEndpointAuthenticationUserAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationUserAssignedManagedIdentity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointDataExplorerAuthentication(method, systemAssignedManagedIdentitySettings, userAssignedManagedIdentitySettings, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointDataExplorerAuthentication)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointDataExplorerAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointDataExplorerAuthentication(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointDataExplorerAuthentication)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorerAuthentication.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorerAuthentication.cs new file mode 100644 index 000000000000..f3689bcf3d01 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataExplorerAuthentication.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Azure Data Explorer Authentication properties. NOTE - only authentication property is allowed per entry. + public partial class DataflowEndpointDataExplorerAuthentication + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Mode of Authentication. + public DataflowEndpointDataExplorerAuthentication(DataExplorerAuthMethod method) + { + Method = method; + } + + /// Initializes a new instance of . + /// Mode of Authentication. + /// System-assigned managed identity authentication. + /// User-assigned managed identity authentication. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointDataExplorerAuthentication(DataExplorerAuthMethod method, DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings, DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings, IDictionary serializedAdditionalRawData) + { + Method = method; + SystemAssignedManagedIdentitySettings = systemAssignedManagedIdentitySettings; + UserAssignedManagedIdentitySettings = userAssignedManagedIdentitySettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointDataExplorerAuthentication() + { + } + + /// Mode of Authentication. + public DataExplorerAuthMethod Method { get; set; } + /// System-assigned managed identity authentication. + internal DataflowEndpointAuthenticationSystemAssignedManagedIdentity SystemAssignedManagedIdentitySettings { get; set; } + /// Audience of the service to authenticate against. Optional; defaults to the audience for Service host configuration. + public string SystemAssignedManagedIdentityAudience + { + get => SystemAssignedManagedIdentitySettings is null ? default : SystemAssignedManagedIdentitySettings.Audience; + set + { + if (SystemAssignedManagedIdentitySettings is null) + SystemAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationSystemAssignedManagedIdentity(); + SystemAssignedManagedIdentitySettings.Audience = value; + } + } + + /// User-assigned managed identity authentication. + public DataflowEndpointAuthenticationUserAssignedManagedIdentity UserAssignedManagedIdentitySettings { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorage.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorage.Serialization.cs new file mode 100644 index 000000000000..eb39d00d6d60 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorage.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointDataLakeStorage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointDataLakeStorage)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("authentication"u8); + writer.WriteObjectValue(Authentication, options); + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + if (Optional.IsDefined(Batching)) + { + writer.WritePropertyName("batching"u8); + writer.WriteObjectValue(Batching, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointDataLakeStorage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointDataLakeStorage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointDataLakeStorage(document.RootElement, options); + } + + internal static DataflowEndpointDataLakeStorage DeserializeDataflowEndpointDataLakeStorage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowEndpointDataLakeStorageAuthentication authentication = default; + string host = default; + BatchingConfiguration batching = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authentication"u8)) + { + authentication = DataflowEndpointDataLakeStorageAuthentication.DeserializeDataflowEndpointDataLakeStorageAuthentication(property.Value, options); + continue; + } + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("batching"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + batching = BatchingConfiguration.DeserializeBatchingConfiguration(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointDataLakeStorage(authentication, host, batching, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointDataLakeStorage)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointDataLakeStorage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointDataLakeStorage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointDataLakeStorage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorage.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorage.cs new file mode 100644 index 000000000000..fd9b7983bc2a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorage.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Azure Data Lake endpoint properties. + public partial class DataflowEndpointDataLakeStorage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Authentication configuration. NOTE - only authentication property is allowed per entry. + /// Host of the Azure Data Lake in the form of <account>.blob.core.windows.net . + /// or is null. + public DataflowEndpointDataLakeStorage(DataflowEndpointDataLakeStorageAuthentication authentication, string host) + { + Argument.AssertNotNull(authentication, nameof(authentication)); + Argument.AssertNotNull(host, nameof(host)); + + Authentication = authentication; + Host = host; + } + + /// Initializes a new instance of . + /// Authentication configuration. NOTE - only authentication property is allowed per entry. + /// Host of the Azure Data Lake in the form of <account>.blob.core.windows.net . + /// Azure Data Lake endpoint batching configuration. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointDataLakeStorage(DataflowEndpointDataLakeStorageAuthentication authentication, string host, BatchingConfiguration batching, IDictionary serializedAdditionalRawData) + { + Authentication = authentication; + Host = host; + Batching = batching; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointDataLakeStorage() + { + } + + /// Authentication configuration. NOTE - only authentication property is allowed per entry. + public DataflowEndpointDataLakeStorageAuthentication Authentication { get; set; } + /// Host of the Azure Data Lake in the form of <account>.blob.core.windows.net . + public string Host { get; set; } + /// Azure Data Lake endpoint batching configuration. + public BatchingConfiguration Batching { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorageAuthentication.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorageAuthentication.Serialization.cs new file mode 100644 index 000000000000..c136c71c281e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorageAuthentication.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointDataLakeStorageAuthentication : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointDataLakeStorageAuthentication)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.ToString()); + if (Optional.IsDefined(AccessTokenSettings)) + { + writer.WritePropertyName("accessTokenSettings"u8); + writer.WriteObjectValue(AccessTokenSettings, options); + } + if (Optional.IsDefined(SystemAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("systemAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(SystemAssignedManagedIdentitySettings, options); + } + if (Optional.IsDefined(UserAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("userAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(UserAssignedManagedIdentitySettings, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointDataLakeStorageAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointDataLakeStorageAuthentication)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointDataLakeStorageAuthentication(document.RootElement, options); + } + + internal static DataflowEndpointDataLakeStorageAuthentication DeserializeDataflowEndpointDataLakeStorageAuthentication(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataLakeStorageAuthMethod method = default; + DataflowEndpointAuthenticationAccessToken accessTokenSettings = default; + DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings = default; + DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("method"u8)) + { + method = new DataLakeStorageAuthMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("accessTokenSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + accessTokenSettings = DataflowEndpointAuthenticationAccessToken.DeserializeDataflowEndpointAuthenticationAccessToken(property.Value, options); + continue; + } + if (property.NameEquals("systemAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemAssignedManagedIdentitySettings = DataflowEndpointAuthenticationSystemAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationSystemAssignedManagedIdentity(property.Value, options); + continue; + } + if (property.NameEquals("userAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userAssignedManagedIdentitySettings = DataflowEndpointAuthenticationUserAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationUserAssignedManagedIdentity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointDataLakeStorageAuthentication(method, accessTokenSettings, systemAssignedManagedIdentitySettings, userAssignedManagedIdentitySettings, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointDataLakeStorageAuthentication)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointDataLakeStorageAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointDataLakeStorageAuthentication(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointDataLakeStorageAuthentication)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorageAuthentication.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorageAuthentication.cs new file mode 100644 index 000000000000..71c0da722356 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointDataLakeStorageAuthentication.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Azure Data Lake endpoint Authentication properties. NOTE Enum - Only one method is supported for one entry. + public partial class DataflowEndpointDataLakeStorageAuthentication + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Mode of Authentication. + public DataflowEndpointDataLakeStorageAuthentication(DataLakeStorageAuthMethod method) + { + Method = method; + } + + /// Initializes a new instance of . + /// Mode of Authentication. + /// SAS token authentication. + /// System-assigned managed identity authentication. + /// User-assigned managed identity authentication. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointDataLakeStorageAuthentication(DataLakeStorageAuthMethod method, DataflowEndpointAuthenticationAccessToken accessTokenSettings, DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings, DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings, IDictionary serializedAdditionalRawData) + { + Method = method; + AccessTokenSettings = accessTokenSettings; + SystemAssignedManagedIdentitySettings = systemAssignedManagedIdentitySettings; + UserAssignedManagedIdentitySettings = userAssignedManagedIdentitySettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointDataLakeStorageAuthentication() + { + } + + /// Mode of Authentication. + public DataLakeStorageAuthMethod Method { get; set; } + /// SAS token authentication. + internal DataflowEndpointAuthenticationAccessToken AccessTokenSettings { get; set; } + /// Token secret name. + public string AccessTokenSecretRef + { + get => AccessTokenSettings is null ? default : AccessTokenSettings.SecretRef; + set => AccessTokenSettings = new DataflowEndpointAuthenticationAccessToken(value); + } + + /// System-assigned managed identity authentication. + internal DataflowEndpointAuthenticationSystemAssignedManagedIdentity SystemAssignedManagedIdentitySettings { get; set; } + /// Audience of the service to authenticate against. Optional; defaults to the audience for Service host configuration. + public string SystemAssignedManagedIdentityAudience + { + get => SystemAssignedManagedIdentitySettings is null ? default : SystemAssignedManagedIdentitySettings.Audience; + set + { + if (SystemAssignedManagedIdentitySettings is null) + SystemAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationSystemAssignedManagedIdentity(); + SystemAssignedManagedIdentitySettings.Audience = value; + } + } + + /// User-assigned managed identity authentication. + public DataflowEndpointAuthenticationUserAssignedManagedIdentity UserAssignedManagedIdentitySettings { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLake.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLake.Serialization.cs new file mode 100644 index 000000000000..9a36553b36dc --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLake.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointFabricOneLake : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLake)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("authentication"u8); + writer.WriteObjectValue(Authentication, options); + writer.WritePropertyName("names"u8); + writer.WriteObjectValue(Names, options); + writer.WritePropertyName("oneLakePathType"u8); + writer.WriteStringValue(OneLakePathType.ToString()); + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + if (Optional.IsDefined(Batching)) + { + writer.WritePropertyName("batching"u8); + writer.WriteObjectValue(Batching, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointFabricOneLake IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLake)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointFabricOneLake(document.RootElement, options); + } + + internal static DataflowEndpointFabricOneLake DeserializeDataflowEndpointFabricOneLake(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowEndpointFabricOneLakeAuthentication authentication = default; + DataflowEndpointFabricOneLakeNames names = default; + DataflowEndpointFabricPathType oneLakePathType = default; + string host = default; + BatchingConfiguration batching = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authentication"u8)) + { + authentication = DataflowEndpointFabricOneLakeAuthentication.DeserializeDataflowEndpointFabricOneLakeAuthentication(property.Value, options); + continue; + } + if (property.NameEquals("names"u8)) + { + names = DataflowEndpointFabricOneLakeNames.DeserializeDataflowEndpointFabricOneLakeNames(property.Value, options); + continue; + } + if (property.NameEquals("oneLakePathType"u8)) + { + oneLakePathType = new DataflowEndpointFabricPathType(property.Value.GetString()); + continue; + } + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("batching"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + batching = BatchingConfiguration.DeserializeBatchingConfiguration(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointFabricOneLake( + authentication, + names, + oneLakePathType, + host, + batching, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLake)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointFabricOneLake IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointFabricOneLake(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLake)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLake.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLake.cs new file mode 100644 index 000000000000..04a6ecce7459 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLake.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Microsoft Fabric endpoint properties. + public partial class DataflowEndpointFabricOneLake + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Authentication configuration. NOTE - only one authentication property is allowed per entry. + /// Names of the workspace and lakehouse. + /// Type of location of the data in the workspace. Can be either tables or files. + /// Host of the Microsoft Fabric in the form of https://<host>.fabric.microsoft.com. + /// , or is null. + public DataflowEndpointFabricOneLake(DataflowEndpointFabricOneLakeAuthentication authentication, DataflowEndpointFabricOneLakeNames names, DataflowEndpointFabricPathType oneLakePathType, string host) + { + Argument.AssertNotNull(authentication, nameof(authentication)); + Argument.AssertNotNull(names, nameof(names)); + Argument.AssertNotNull(host, nameof(host)); + + Authentication = authentication; + Names = names; + OneLakePathType = oneLakePathType; + Host = host; + } + + /// Initializes a new instance of . + /// Authentication configuration. NOTE - only one authentication property is allowed per entry. + /// Names of the workspace and lakehouse. + /// Type of location of the data in the workspace. Can be either tables or files. + /// Host of the Microsoft Fabric in the form of https://<host>.fabric.microsoft.com. + /// Batching configuration. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointFabricOneLake(DataflowEndpointFabricOneLakeAuthentication authentication, DataflowEndpointFabricOneLakeNames names, DataflowEndpointFabricPathType oneLakePathType, string host, BatchingConfiguration batching, IDictionary serializedAdditionalRawData) + { + Authentication = authentication; + Names = names; + OneLakePathType = oneLakePathType; + Host = host; + Batching = batching; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointFabricOneLake() + { + } + + /// Authentication configuration. NOTE - only one authentication property is allowed per entry. + public DataflowEndpointFabricOneLakeAuthentication Authentication { get; set; } + /// Names of the workspace and lakehouse. + public DataflowEndpointFabricOneLakeNames Names { get; set; } + /// Type of location of the data in the workspace. Can be either tables or files. + public DataflowEndpointFabricPathType OneLakePathType { get; set; } + /// Host of the Microsoft Fabric in the form of https://<host>.fabric.microsoft.com. + public string Host { get; set; } + /// Batching configuration. + public BatchingConfiguration Batching { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeAuthentication.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeAuthentication.Serialization.cs new file mode 100644 index 000000000000..41526a97e964 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeAuthentication.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointFabricOneLakeAuthentication : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLakeAuthentication)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.ToString()); + if (Optional.IsDefined(SystemAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("systemAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(SystemAssignedManagedIdentitySettings, options); + } + if (Optional.IsDefined(UserAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("userAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(UserAssignedManagedIdentitySettings, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointFabricOneLakeAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLakeAuthentication)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointFabricOneLakeAuthentication(document.RootElement, options); + } + + internal static DataflowEndpointFabricOneLakeAuthentication DeserializeDataflowEndpointFabricOneLakeAuthentication(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FabricOneLakeAuthMethod method = default; + DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings = default; + DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("method"u8)) + { + method = new FabricOneLakeAuthMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemAssignedManagedIdentitySettings = DataflowEndpointAuthenticationSystemAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationSystemAssignedManagedIdentity(property.Value, options); + continue; + } + if (property.NameEquals("userAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userAssignedManagedIdentitySettings = DataflowEndpointAuthenticationUserAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationUserAssignedManagedIdentity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointFabricOneLakeAuthentication(method, systemAssignedManagedIdentitySettings, userAssignedManagedIdentitySettings, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLakeAuthentication)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointFabricOneLakeAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointFabricOneLakeAuthentication(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLakeAuthentication)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeAuthentication.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeAuthentication.cs new file mode 100644 index 000000000000..b6c8e597d3cf --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeAuthentication.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Microsoft Fabric endpoint. Authentication properties. NOTE - Only one method is supported for one entry. + public partial class DataflowEndpointFabricOneLakeAuthentication + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Mode of Authentication. + public DataflowEndpointFabricOneLakeAuthentication(FabricOneLakeAuthMethod method) + { + Method = method; + } + + /// Initializes a new instance of . + /// Mode of Authentication. + /// System-assigned managed identity authentication. + /// User-assigned managed identity authentication. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointFabricOneLakeAuthentication(FabricOneLakeAuthMethod method, DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings, DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings, IDictionary serializedAdditionalRawData) + { + Method = method; + SystemAssignedManagedIdentitySettings = systemAssignedManagedIdentitySettings; + UserAssignedManagedIdentitySettings = userAssignedManagedIdentitySettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointFabricOneLakeAuthentication() + { + } + + /// Mode of Authentication. + public FabricOneLakeAuthMethod Method { get; set; } + /// System-assigned managed identity authentication. + internal DataflowEndpointAuthenticationSystemAssignedManagedIdentity SystemAssignedManagedIdentitySettings { get; set; } + /// Audience of the service to authenticate against. Optional; defaults to the audience for Service host configuration. + public string SystemAssignedManagedIdentityAudience + { + get => SystemAssignedManagedIdentitySettings is null ? default : SystemAssignedManagedIdentitySettings.Audience; + set + { + if (SystemAssignedManagedIdentitySettings is null) + SystemAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationSystemAssignedManagedIdentity(); + SystemAssignedManagedIdentitySettings.Audience = value; + } + } + + /// User-assigned managed identity authentication. + public DataflowEndpointAuthenticationUserAssignedManagedIdentity UserAssignedManagedIdentitySettings { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeNames.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeNames.Serialization.cs new file mode 100644 index 000000000000..f734203e7aa0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeNames.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointFabricOneLakeNames : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLakeNames)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("lakehouseName"u8); + writer.WriteStringValue(LakehouseName); + writer.WritePropertyName("workspaceName"u8); + writer.WriteStringValue(WorkspaceName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointFabricOneLakeNames IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLakeNames)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointFabricOneLakeNames(document.RootElement, options); + } + + internal static DataflowEndpointFabricOneLakeNames DeserializeDataflowEndpointFabricOneLakeNames(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string lakehouseName = default; + string workspaceName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("lakehouseName"u8)) + { + lakehouseName = property.Value.GetString(); + continue; + } + if (property.NameEquals("workspaceName"u8)) + { + workspaceName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointFabricOneLakeNames(lakehouseName, workspaceName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLakeNames)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointFabricOneLakeNames IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointFabricOneLakeNames(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointFabricOneLakeNames)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeNames.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeNames.cs new file mode 100644 index 000000000000..a7fd35866c65 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricOneLakeNames.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Microsoft Fabric endpoint Names properties. + public partial class DataflowEndpointFabricOneLakeNames + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Lakehouse name. + /// Workspace name. + /// or is null. + public DataflowEndpointFabricOneLakeNames(string lakehouseName, string workspaceName) + { + Argument.AssertNotNull(lakehouseName, nameof(lakehouseName)); + Argument.AssertNotNull(workspaceName, nameof(workspaceName)); + + LakehouseName = lakehouseName; + WorkspaceName = workspaceName; + } + + /// Initializes a new instance of . + /// Lakehouse name. + /// Workspace name. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointFabricOneLakeNames(string lakehouseName, string workspaceName, IDictionary serializedAdditionalRawData) + { + LakehouseName = lakehouseName; + WorkspaceName = workspaceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointFabricOneLakeNames() + { + } + + /// Lakehouse name. + public string LakehouseName { get; set; } + /// Workspace name. + public string WorkspaceName { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricPathType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricPathType.cs new file mode 100644 index 000000000000..ae7c92f852df --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointFabricPathType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Fabric Path Type properties. + public readonly partial struct DataflowEndpointFabricPathType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataflowEndpointFabricPathType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FilesValue = "Files"; + private const string TablesValue = "Tables"; + + /// FILES Type. + public static DataflowEndpointFabricPathType Files { get; } = new DataflowEndpointFabricPathType(FilesValue); + /// TABLES Type. + public static DataflowEndpointFabricPathType Tables { get; } = new DataflowEndpointFabricPathType(TablesValue); + /// Determines if two values are the same. + public static bool operator ==(DataflowEndpointFabricPathType left, DataflowEndpointFabricPathType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataflowEndpointFabricPathType left, DataflowEndpointFabricPathType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataflowEndpointFabricPathType(string value) => new DataflowEndpointFabricPathType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataflowEndpointFabricPathType other && Equals(other); + /// + public bool Equals(DataflowEndpointFabricPathType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafka.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafka.Serialization.cs new file mode 100644 index 000000000000..4599bad179a6 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafka.Serialization.cs @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointKafka : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointKafka)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("authentication"u8); + writer.WriteObjectValue(Authentication, options); + if (Optional.IsDefined(ConsumerGroupId)) + { + writer.WritePropertyName("consumerGroupId"u8); + writer.WriteStringValue(ConsumerGroupId); + } + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + if (Optional.IsDefined(Batching)) + { + writer.WritePropertyName("batching"u8); + writer.WriteObjectValue(Batching, options); + } + if (Optional.IsDefined(CopyMqttProperties)) + { + writer.WritePropertyName("copyMqttProperties"u8); + writer.WriteStringValue(CopyMqttProperties.Value.ToString()); + } + if (Optional.IsDefined(Compression)) + { + writer.WritePropertyName("compression"u8); + writer.WriteStringValue(Compression.Value.ToString()); + } + if (Optional.IsDefined(KafkaAcks)) + { + writer.WritePropertyName("kafkaAcks"u8); + writer.WriteStringValue(KafkaAcks.Value.ToString()); + } + if (Optional.IsDefined(PartitionStrategy)) + { + writer.WritePropertyName("partitionStrategy"u8); + writer.WriteStringValue(PartitionStrategy.Value.ToString()); + } + if (Optional.IsDefined(Tls)) + { + writer.WritePropertyName("tls"u8); + writer.WriteObjectValue(Tls, options); + } + if (Optional.IsDefined(CloudEventAttributes)) + { + writer.WritePropertyName("cloudEventAttributes"u8); + writer.WriteStringValue(CloudEventAttributes.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointKafka IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointKafka)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointKafka(document.RootElement, options); + } + + internal static DataflowEndpointKafka DeserializeDataflowEndpointKafka(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowEndpointKafkaAuthentication authentication = default; + string consumerGroupId = default; + string host = default; + DataflowEndpointKafkaBatching batching = default; + OperationalMode? copyMqttProperties = default; + DataflowEndpointKafkaCompression? compression = default; + DataflowEndpointKafkaAck? kafkaAcks = default; + DataflowEndpointKafkaPartitionStrategy? partitionStrategy = default; + TlsProperties tls = default; + CloudEventAttributeType? cloudEventAttributes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authentication"u8)) + { + authentication = DataflowEndpointKafkaAuthentication.DeserializeDataflowEndpointKafkaAuthentication(property.Value, options); + continue; + } + if (property.NameEquals("consumerGroupId"u8)) + { + consumerGroupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("batching"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + batching = DataflowEndpointKafkaBatching.DeserializeDataflowEndpointKafkaBatching(property.Value, options); + continue; + } + if (property.NameEquals("copyMqttProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + copyMqttProperties = new OperationalMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("compression"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + compression = new DataflowEndpointKafkaCompression(property.Value.GetString()); + continue; + } + if (property.NameEquals("kafkaAcks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kafkaAcks = new DataflowEndpointKafkaAck(property.Value.GetString()); + continue; + } + if (property.NameEquals("partitionStrategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partitionStrategy = new DataflowEndpointKafkaPartitionStrategy(property.Value.GetString()); + continue; + } + if (property.NameEquals("tls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tls = TlsProperties.DeserializeTlsProperties(property.Value, options); + continue; + } + if (property.NameEquals("cloudEventAttributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cloudEventAttributes = new CloudEventAttributeType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointKafka( + authentication, + consumerGroupId, + host, + batching, + copyMqttProperties, + compression, + kafkaAcks, + partitionStrategy, + tls, + cloudEventAttributes, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointKafka)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointKafka IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointKafka(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointKafka)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafka.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafka.cs new file mode 100644 index 000000000000..9fccbcb32cad --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafka.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Kafka endpoint properties. + public partial class DataflowEndpointKafka + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Authentication configuration. NOTE - only authentication property is allowed per entry. + /// Kafka endpoint host. + /// or is null. + public DataflowEndpointKafka(DataflowEndpointKafkaAuthentication authentication, string host) + { + Argument.AssertNotNull(authentication, nameof(authentication)); + Argument.AssertNotNull(host, nameof(host)); + + Authentication = authentication; + Host = host; + } + + /// Initializes a new instance of . + /// Authentication configuration. NOTE - only authentication property is allowed per entry. + /// Consumer group ID. + /// Kafka endpoint host. + /// Batching configuration. + /// Copy Broker properties. No effect if the endpoint is used as a source or if the dataflow doesn't have an Broker source. + /// Compression. Can be none, gzip, lz4, or snappy. No effect if the endpoint is used as a source. + /// Kafka acks. Can be all, one, or zero. No effect if the endpoint is used as a source. + /// Partition handling strategy. Can be default or static. No effect if the endpoint is used as a source. + /// TLS configuration. + /// Cloud event mapping config. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointKafka(DataflowEndpointKafkaAuthentication authentication, string consumerGroupId, string host, DataflowEndpointKafkaBatching batching, OperationalMode? copyMqttProperties, DataflowEndpointKafkaCompression? compression, DataflowEndpointKafkaAck? kafkaAcks, DataflowEndpointKafkaPartitionStrategy? partitionStrategy, TlsProperties tls, CloudEventAttributeType? cloudEventAttributes, IDictionary serializedAdditionalRawData) + { + Authentication = authentication; + ConsumerGroupId = consumerGroupId; + Host = host; + Batching = batching; + CopyMqttProperties = copyMqttProperties; + Compression = compression; + KafkaAcks = kafkaAcks; + PartitionStrategy = partitionStrategy; + Tls = tls; + CloudEventAttributes = cloudEventAttributes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointKafka() + { + } + + /// Authentication configuration. NOTE - only authentication property is allowed per entry. + public DataflowEndpointKafkaAuthentication Authentication { get; set; } + /// Consumer group ID. + public string ConsumerGroupId { get; set; } + /// Kafka endpoint host. + public string Host { get; set; } + /// Batching configuration. + public DataflowEndpointKafkaBatching Batching { get; set; } + /// Copy Broker properties. No effect if the endpoint is used as a source or if the dataflow doesn't have an Broker source. + public OperationalMode? CopyMqttProperties { get; set; } + /// Compression. Can be none, gzip, lz4, or snappy. No effect if the endpoint is used as a source. + public DataflowEndpointKafkaCompression? Compression { get; set; } + /// Kafka acks. Can be all, one, or zero. No effect if the endpoint is used as a source. + public DataflowEndpointKafkaAck? KafkaAcks { get; set; } + /// Partition handling strategy. Can be default or static. No effect if the endpoint is used as a source. + public DataflowEndpointKafkaPartitionStrategy? PartitionStrategy { get; set; } + /// TLS configuration. + public TlsProperties Tls { get; set; } + /// Cloud event mapping config. + public CloudEventAttributeType? CloudEventAttributes { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAck.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAck.cs new file mode 100644 index 000000000000..06bfcf506e81 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAck.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Kafka Acks properties. + public readonly partial struct DataflowEndpointKafkaAck : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataflowEndpointKafkaAck(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ZeroValue = "Zero"; + private const string OneValue = "One"; + private const string AllValue = "All"; + + /// ZERO Option. + public static DataflowEndpointKafkaAck Zero { get; } = new DataflowEndpointKafkaAck(ZeroValue); + /// ONE Option. + public static DataflowEndpointKafkaAck One { get; } = new DataflowEndpointKafkaAck(OneValue); + /// ALL Option. + public static DataflowEndpointKafkaAck All { get; } = new DataflowEndpointKafkaAck(AllValue); + /// Determines if two values are the same. + public static bool operator ==(DataflowEndpointKafkaAck left, DataflowEndpointKafkaAck right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataflowEndpointKafkaAck left, DataflowEndpointKafkaAck right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataflowEndpointKafkaAck(string value) => new DataflowEndpointKafkaAck(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataflowEndpointKafkaAck other && Equals(other); + /// + public bool Equals(DataflowEndpointKafkaAck 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAuthentication.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAuthentication.Serialization.cs new file mode 100644 index 000000000000..71d3026ec584 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAuthentication.Serialization.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointKafkaAuthentication : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointKafkaAuthentication)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.ToString()); + if (Optional.IsDefined(SystemAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("systemAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(SystemAssignedManagedIdentitySettings, options); + } + if (Optional.IsDefined(UserAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("userAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(UserAssignedManagedIdentitySettings, options); + } + if (Optional.IsDefined(SaslSettings)) + { + writer.WritePropertyName("saslSettings"u8); + writer.WriteObjectValue(SaslSettings, options); + } + if (Optional.IsDefined(X509CertificateSettings)) + { + writer.WritePropertyName("x509CertificateSettings"u8); + writer.WriteObjectValue(X509CertificateSettings, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointKafkaAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointKafkaAuthentication)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointKafkaAuthentication(document.RootElement, options); + } + + internal static DataflowEndpointKafkaAuthentication DeserializeDataflowEndpointKafkaAuthentication(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KafkaAuthMethod method = default; + DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings = default; + DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings = default; + DataflowEndpointAuthenticationSasl saslSettings = default; + DataflowEndpointAuthenticationX509 x509CertificateSettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("method"u8)) + { + method = new KafkaAuthMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemAssignedManagedIdentitySettings = DataflowEndpointAuthenticationSystemAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationSystemAssignedManagedIdentity(property.Value, options); + continue; + } + if (property.NameEquals("userAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userAssignedManagedIdentitySettings = DataflowEndpointAuthenticationUserAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationUserAssignedManagedIdentity(property.Value, options); + continue; + } + if (property.NameEquals("saslSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + saslSettings = DataflowEndpointAuthenticationSasl.DeserializeDataflowEndpointAuthenticationSasl(property.Value, options); + continue; + } + if (property.NameEquals("x509CertificateSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + x509CertificateSettings = DataflowEndpointAuthenticationX509.DeserializeDataflowEndpointAuthenticationX509(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointKafkaAuthentication( + method, + systemAssignedManagedIdentitySettings, + userAssignedManagedIdentitySettings, + saslSettings, + x509CertificateSettings, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointKafkaAuthentication)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointKafkaAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointKafkaAuthentication(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointKafkaAuthentication)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAuthentication.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAuthentication.cs new file mode 100644 index 000000000000..98b439a3d812 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaAuthentication.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Kafka endpoint Authentication properties. NOTE - only authentication property is allowed per entry. + public partial class DataflowEndpointKafkaAuthentication + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Mode of Authentication. + public DataflowEndpointKafkaAuthentication(KafkaAuthMethod method) + { + Method = method; + } + + /// Initializes a new instance of . + /// Mode of Authentication. + /// System-assigned managed identity authentication. + /// User-assigned managed identity authentication. + /// SASL authentication. + /// X.509 certificate authentication. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointKafkaAuthentication(KafkaAuthMethod method, DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings, DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings, DataflowEndpointAuthenticationSasl saslSettings, DataflowEndpointAuthenticationX509 x509CertificateSettings, IDictionary serializedAdditionalRawData) + { + Method = method; + SystemAssignedManagedIdentitySettings = systemAssignedManagedIdentitySettings; + UserAssignedManagedIdentitySettings = userAssignedManagedIdentitySettings; + SaslSettings = saslSettings; + X509CertificateSettings = x509CertificateSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointKafkaAuthentication() + { + } + + /// Mode of Authentication. + public KafkaAuthMethod Method { get; set; } + /// System-assigned managed identity authentication. + internal DataflowEndpointAuthenticationSystemAssignedManagedIdentity SystemAssignedManagedIdentitySettings { get; set; } + /// Audience of the service to authenticate against. Optional; defaults to the audience for Service host configuration. + public string SystemAssignedManagedIdentityAudience + { + get => SystemAssignedManagedIdentitySettings is null ? default : SystemAssignedManagedIdentitySettings.Audience; + set + { + if (SystemAssignedManagedIdentitySettings is null) + SystemAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationSystemAssignedManagedIdentity(); + SystemAssignedManagedIdentitySettings.Audience = value; + } + } + + /// User-assigned managed identity authentication. + public DataflowEndpointAuthenticationUserAssignedManagedIdentity UserAssignedManagedIdentitySettings { get; set; } + /// SASL authentication. + public DataflowEndpointAuthenticationSasl SaslSettings { get; set; } + /// X.509 certificate authentication. + internal DataflowEndpointAuthenticationX509 X509CertificateSettings { get; set; } + /// Secret reference of the X.509 certificate. + public string X509CertificateSecretRef + { + get => X509CertificateSettings is null ? default : X509CertificateSettings.SecretRef; + set => X509CertificateSettings = new DataflowEndpointAuthenticationX509(value); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaBatching.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaBatching.Serialization.cs new file mode 100644 index 000000000000..70106a2f1945 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaBatching.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.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointKafkaBatching : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointKafkaBatching)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsDefined(LatencyMs)) + { + writer.WritePropertyName("latencyMs"u8); + writer.WriteNumberValue(LatencyMs.Value); + } + if (Optional.IsDefined(MaxBytes)) + { + writer.WritePropertyName("maxBytes"u8); + writer.WriteNumberValue(MaxBytes.Value); + } + if (Optional.IsDefined(MaxMessages)) + { + writer.WritePropertyName("maxMessages"u8); + writer.WriteNumberValue(MaxMessages.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointKafkaBatching IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointKafkaBatching)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointKafkaBatching(document.RootElement, options); + } + + internal static DataflowEndpointKafkaBatching DeserializeDataflowEndpointKafkaBatching(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OperationalMode? mode = default; + int? latencyMs = default; + int? maxBytes = default; + int? maxMessages = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new OperationalMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("latencyMs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + latencyMs = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxBytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxBytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxMessages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxMessages = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointKafkaBatching(mode, latencyMs, maxBytes, maxMessages, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointKafkaBatching)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointKafkaBatching IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointKafkaBatching(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointKafkaBatching)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaBatching.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaBatching.cs new file mode 100644 index 000000000000..93d9b36ddf35 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaBatching.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Kafka endpoint Batching properties. + public partial class DataflowEndpointKafkaBatching + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DataflowEndpointKafkaBatching() + { + } + + /// Initializes a new instance of . + /// Mode for batching. + /// Batching latency in milliseconds. + /// Maximum number of bytes in a batch. + /// Maximum number of messages in a batch. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointKafkaBatching(OperationalMode? mode, int? latencyMs, int? maxBytes, int? maxMessages, IDictionary serializedAdditionalRawData) + { + Mode = mode; + LatencyMs = latencyMs; + MaxBytes = maxBytes; + MaxMessages = maxMessages; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Mode for batching. + public OperationalMode? Mode { get; set; } + /// Batching latency in milliseconds. + public int? LatencyMs { get; set; } + /// Maximum number of bytes in a batch. + public int? MaxBytes { get; set; } + /// Maximum number of messages in a batch. + public int? MaxMessages { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaCompression.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaCompression.cs new file mode 100644 index 000000000000..09b8d79e1bbe --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaCompression.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Kafka endpoint Compression properties. + public readonly partial struct DataflowEndpointKafkaCompression : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataflowEndpointKafkaCompression(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string GzipValue = "Gzip"; + private const string SnappyValue = "Snappy"; + private const string Lz4Value = "Lz4"; + + /// NONE Option. + public static DataflowEndpointKafkaCompression None { get; } = new DataflowEndpointKafkaCompression(NoneValue); + /// Gzip Option. + public static DataflowEndpointKafkaCompression Gzip { get; } = new DataflowEndpointKafkaCompression(GzipValue); + /// SNAPPY Option. + public static DataflowEndpointKafkaCompression Snappy { get; } = new DataflowEndpointKafkaCompression(SnappyValue); + /// LZ4 Option. + public static DataflowEndpointKafkaCompression Lz4 { get; } = new DataflowEndpointKafkaCompression(Lz4Value); + /// Determines if two values are the same. + public static bool operator ==(DataflowEndpointKafkaCompression left, DataflowEndpointKafkaCompression right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataflowEndpointKafkaCompression left, DataflowEndpointKafkaCompression right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataflowEndpointKafkaCompression(string value) => new DataflowEndpointKafkaCompression(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataflowEndpointKafkaCompression other && Equals(other); + /// + public bool Equals(DataflowEndpointKafkaCompression 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaPartitionStrategy.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaPartitionStrategy.cs new file mode 100644 index 000000000000..77a7900bd131 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointKafkaPartitionStrategy.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Kafka Partition Strategy properties. + public readonly partial struct DataflowEndpointKafkaPartitionStrategy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataflowEndpointKafkaPartitionStrategy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string StaticValue = "Static"; + private const string TopicValue = "Topic"; + private const string PropertyValue = "Property"; + + /// Default: Assigns messages to random partitions, using a round-robin algorithm. + public static DataflowEndpointKafkaPartitionStrategy Default { get; } = new DataflowEndpointKafkaPartitionStrategy(DefaultValue); + /// Static: Assigns messages to a fixed partition number that's derived from the instance ID of the dataflow. + public static DataflowEndpointKafkaPartitionStrategy Static { get; } = new DataflowEndpointKafkaPartitionStrategy(StaticValue); + /// TOPIC Option. + public static DataflowEndpointKafkaPartitionStrategy Topic { get; } = new DataflowEndpointKafkaPartitionStrategy(TopicValue); + /// PROPERTY Option. + public static DataflowEndpointKafkaPartitionStrategy Property { get; } = new DataflowEndpointKafkaPartitionStrategy(PropertyValue); + /// Determines if two values are the same. + public static bool operator ==(DataflowEndpointKafkaPartitionStrategy left, DataflowEndpointKafkaPartitionStrategy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataflowEndpointKafkaPartitionStrategy left, DataflowEndpointKafkaPartitionStrategy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataflowEndpointKafkaPartitionStrategy(string value) => new DataflowEndpointKafkaPartitionStrategy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataflowEndpointKafkaPartitionStrategy other && Equals(other); + /// + public bool Equals(DataflowEndpointKafkaPartitionStrategy 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointLocalStorage.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointLocalStorage.Serialization.cs new file mode 100644 index 000000000000..e353c8a532f3 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointLocalStorage.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class DataflowEndpointLocalStorage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointLocalStorage)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("persistentVolumeClaimRef"u8); + writer.WriteStringValue(PersistentVolumeClaimRef); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointLocalStorage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointLocalStorage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointLocalStorage(document.RootElement, options); + } + + internal static DataflowEndpointLocalStorage DeserializeDataflowEndpointLocalStorage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string persistentVolumeClaimRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("persistentVolumeClaimRef"u8)) + { + persistentVolumeClaimRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointLocalStorage(persistentVolumeClaimRef, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointLocalStorage)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointLocalStorage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointLocalStorage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointLocalStorage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointLocalStorage.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointLocalStorage.cs new file mode 100644 index 000000000000..934bc9a780c0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointLocalStorage.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Local persistent volume endpoint properties. + internal partial class DataflowEndpointLocalStorage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Persistent volume claim name. + /// is null. + public DataflowEndpointLocalStorage(string persistentVolumeClaimRef) + { + Argument.AssertNotNull(persistentVolumeClaimRef, nameof(persistentVolumeClaimRef)); + + PersistentVolumeClaimRef = persistentVolumeClaimRef; + } + + /// Initializes a new instance of . + /// Persistent volume claim name. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointLocalStorage(string persistentVolumeClaimRef, IDictionary serializedAdditionalRawData) + { + PersistentVolumeClaimRef = persistentVolumeClaimRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointLocalStorage() + { + } + + /// Persistent volume claim name. + public string PersistentVolumeClaimRef { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqtt.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqtt.Serialization.cs new file mode 100644 index 000000000000..56785afcc94d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqtt.Serialization.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointMqtt : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointMqtt)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("authentication"u8); + writer.WriteObjectValue(Authentication, options); + if (Optional.IsDefined(ClientIdPrefix)) + { + writer.WritePropertyName("clientIdPrefix"u8); + writer.WriteStringValue(ClientIdPrefix); + } + if (Optional.IsDefined(Host)) + { + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + } + if (Optional.IsDefined(Protocol)) + { + writer.WritePropertyName("protocol"u8); + writer.WriteStringValue(Protocol.Value.ToString()); + } + if (Optional.IsDefined(KeepAliveSeconds)) + { + writer.WritePropertyName("keepAliveSeconds"u8); + writer.WriteNumberValue(KeepAliveSeconds.Value); + } + if (Optional.IsDefined(Retain)) + { + writer.WritePropertyName("retain"u8); + writer.WriteStringValue(Retain.Value.ToString()); + } + if (Optional.IsDefined(MaxInflightMessages)) + { + writer.WritePropertyName("maxInflightMessages"u8); + writer.WriteNumberValue(MaxInflightMessages.Value); + } + if (Optional.IsDefined(Qos)) + { + writer.WritePropertyName("qos"u8); + writer.WriteNumberValue(Qos.Value); + } + if (Optional.IsDefined(SessionExpirySeconds)) + { + writer.WritePropertyName("sessionExpirySeconds"u8); + writer.WriteNumberValue(SessionExpirySeconds.Value); + } + if (Optional.IsDefined(Tls)) + { + writer.WritePropertyName("tls"u8); + writer.WriteObjectValue(Tls, options); + } + if (Optional.IsDefined(CloudEventAttributes)) + { + writer.WritePropertyName("cloudEventAttributes"u8); + writer.WriteStringValue(CloudEventAttributes.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointMqtt IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointMqtt)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointMqtt(document.RootElement, options); + } + + internal static DataflowEndpointMqtt DeserializeDataflowEndpointMqtt(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataflowEndpointMqttAuthentication authentication = default; + string clientIdPrefix = default; + string host = default; + BrokerProtocolType? protocol = default; + int? keepAliveSeconds = default; + MqttRetainType? retain = default; + int? maxInflightMessages = default; + int? qos = default; + int? sessionExpirySeconds = default; + TlsProperties tls = default; + CloudEventAttributeType? cloudEventAttributes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authentication"u8)) + { + authentication = DataflowEndpointMqttAuthentication.DeserializeDataflowEndpointMqttAuthentication(property.Value, options); + continue; + } + if (property.NameEquals("clientIdPrefix"u8)) + { + clientIdPrefix = property.Value.GetString(); + continue; + } + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("protocol"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = new BrokerProtocolType(property.Value.GetString()); + continue; + } + if (property.NameEquals("keepAliveSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keepAliveSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("retain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + retain = new MqttRetainType(property.Value.GetString()); + continue; + } + if (property.NameEquals("maxInflightMessages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxInflightMessages = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("qos"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + qos = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sessionExpirySeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sessionExpirySeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("tls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tls = TlsProperties.DeserializeTlsProperties(property.Value, options); + continue; + } + if (property.NameEquals("cloudEventAttributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cloudEventAttributes = new CloudEventAttributeType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointMqtt( + authentication, + clientIdPrefix, + host, + protocol, + keepAliveSeconds, + retain, + maxInflightMessages, + qos, + sessionExpirySeconds, + tls, + cloudEventAttributes, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointMqtt)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointMqtt IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointMqtt(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointMqtt)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqtt.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqtt.cs new file mode 100644 index 000000000000..b5f7c2b5635a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqtt.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker endpoint properties. + public partial class DataflowEndpointMqtt + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// authentication properties. DEFAULT: kubernetes.audience=aio-internal. NOTE - Enum field only property is allowed. + /// is null. + public DataflowEndpointMqtt(DataflowEndpointMqttAuthentication authentication) + { + Argument.AssertNotNull(authentication, nameof(authentication)); + + Authentication = authentication; + } + + /// Initializes a new instance of . + /// authentication properties. DEFAULT: kubernetes.audience=aio-internal. NOTE - Enum field only property is allowed. + /// Client ID prefix. Client ID generated by the dataflow is <prefix>-TBD. Optional; no prefix if omitted. + /// Host of the Broker in the form of <hostname>:<port>. Optional; connects to Broker if omitted. + /// Enable or disable websockets. + /// Broker KeepAlive for connection in seconds. + /// Whether or not to keep the retain setting. + /// The max number of messages to keep in flight. For subscribe, this is the receive maximum. For publish, this is the maximum number of messages to send before waiting for an ack. + /// Qos for Broker connection. + /// Session expiry in seconds. + /// TLS configuration. + /// Cloud event mapping config. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointMqtt(DataflowEndpointMqttAuthentication authentication, string clientIdPrefix, string host, BrokerProtocolType? protocol, int? keepAliveSeconds, MqttRetainType? retain, int? maxInflightMessages, int? qos, int? sessionExpirySeconds, TlsProperties tls, CloudEventAttributeType? cloudEventAttributes, IDictionary serializedAdditionalRawData) + { + Authentication = authentication; + ClientIdPrefix = clientIdPrefix; + Host = host; + Protocol = protocol; + KeepAliveSeconds = keepAliveSeconds; + Retain = retain; + MaxInflightMessages = maxInflightMessages; + Qos = qos; + SessionExpirySeconds = sessionExpirySeconds; + Tls = tls; + CloudEventAttributes = cloudEventAttributes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointMqtt() + { + } + + /// authentication properties. DEFAULT: kubernetes.audience=aio-internal. NOTE - Enum field only property is allowed. + public DataflowEndpointMqttAuthentication Authentication { get; set; } + /// Client ID prefix. Client ID generated by the dataflow is <prefix>-TBD. Optional; no prefix if omitted. + public string ClientIdPrefix { get; set; } + /// Host of the Broker in the form of <hostname>:<port>. Optional; connects to Broker if omitted. + public string Host { get; set; } + /// Enable or disable websockets. + public BrokerProtocolType? Protocol { get; set; } + /// Broker KeepAlive for connection in seconds. + public int? KeepAliveSeconds { get; set; } + /// Whether or not to keep the retain setting. + public MqttRetainType? Retain { get; set; } + /// The max number of messages to keep in flight. For subscribe, this is the receive maximum. For publish, this is the maximum number of messages to send before waiting for an ack. + public int? MaxInflightMessages { get; set; } + /// Qos for Broker connection. + public int? Qos { get; set; } + /// Session expiry in seconds. + public int? SessionExpirySeconds { get; set; } + /// TLS configuration. + public TlsProperties Tls { get; set; } + /// Cloud event mapping config. + public CloudEventAttributeType? CloudEventAttributes { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqttAuthentication.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqttAuthentication.Serialization.cs new file mode 100644 index 000000000000..18933dcf6958 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqttAuthentication.Serialization.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointMqttAuthentication : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointMqttAuthentication)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.ToString()); + if (Optional.IsDefined(SystemAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("systemAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(SystemAssignedManagedIdentitySettings, options); + } + if (Optional.IsDefined(UserAssignedManagedIdentitySettings)) + { + writer.WritePropertyName("userAssignedManagedIdentitySettings"u8); + writer.WriteObjectValue(UserAssignedManagedIdentitySettings, options); + } + if (Optional.IsDefined(ServiceAccountTokenSettings)) + { + writer.WritePropertyName("serviceAccountTokenSettings"u8); + writer.WriteObjectValue(ServiceAccountTokenSettings, options); + } + if (Optional.IsDefined(X509CertificateSettings)) + { + writer.WritePropertyName("x509CertificateSettings"u8); + writer.WriteObjectValue(X509CertificateSettings, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointMqttAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointMqttAuthentication)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointMqttAuthentication(document.RootElement, options); + } + + internal static DataflowEndpointMqttAuthentication DeserializeDataflowEndpointMqttAuthentication(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MqttAuthMethod method = default; + DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings = default; + DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings = default; + DataflowEndpointAuthenticationServiceAccountToken serviceAccountTokenSettings = default; + DataflowEndpointAuthenticationX509 x509CertificateSettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("method"u8)) + { + method = new MqttAuthMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemAssignedManagedIdentitySettings = DataflowEndpointAuthenticationSystemAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationSystemAssignedManagedIdentity(property.Value, options); + continue; + } + if (property.NameEquals("userAssignedManagedIdentitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userAssignedManagedIdentitySettings = DataflowEndpointAuthenticationUserAssignedManagedIdentity.DeserializeDataflowEndpointAuthenticationUserAssignedManagedIdentity(property.Value, options); + continue; + } + if (property.NameEquals("serviceAccountTokenSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceAccountTokenSettings = DataflowEndpointAuthenticationServiceAccountToken.DeserializeDataflowEndpointAuthenticationServiceAccountToken(property.Value, options); + continue; + } + if (property.NameEquals("x509CertificateSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + x509CertificateSettings = DataflowEndpointAuthenticationX509.DeserializeDataflowEndpointAuthenticationX509(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointMqttAuthentication( + method, + systemAssignedManagedIdentitySettings, + userAssignedManagedIdentitySettings, + serviceAccountTokenSettings, + x509CertificateSettings, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointMqttAuthentication)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointMqttAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointMqttAuthentication(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointMqttAuthentication)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqttAuthentication.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqttAuthentication.cs new file mode 100644 index 000000000000..3510dcee51cc --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointMqttAuthentication.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Mqtt endpoint Authentication properties. NOTE - only authentication property is allowed per entry. + public partial class DataflowEndpointMqttAuthentication + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Mode of Authentication. + public DataflowEndpointMqttAuthentication(MqttAuthMethod method) + { + Method = method; + } + + /// Initializes a new instance of . + /// Mode of Authentication. + /// System-assigned managed identity authentication. + /// User-assigned managed identity authentication. + /// Kubernetes service account token authentication. Default audience if not set is aio-internal. + /// X.509 certificate authentication. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointMqttAuthentication(MqttAuthMethod method, DataflowEndpointAuthenticationSystemAssignedManagedIdentity systemAssignedManagedIdentitySettings, DataflowEndpointAuthenticationUserAssignedManagedIdentity userAssignedManagedIdentitySettings, DataflowEndpointAuthenticationServiceAccountToken serviceAccountTokenSettings, DataflowEndpointAuthenticationX509 x509CertificateSettings, IDictionary serializedAdditionalRawData) + { + Method = method; + SystemAssignedManagedIdentitySettings = systemAssignedManagedIdentitySettings; + UserAssignedManagedIdentitySettings = userAssignedManagedIdentitySettings; + ServiceAccountTokenSettings = serviceAccountTokenSettings; + X509CertificateSettings = x509CertificateSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointMqttAuthentication() + { + } + + /// Mode of Authentication. + public MqttAuthMethod Method { get; set; } + /// System-assigned managed identity authentication. + internal DataflowEndpointAuthenticationSystemAssignedManagedIdentity SystemAssignedManagedIdentitySettings { get; set; } + /// Audience of the service to authenticate against. Optional; defaults to the audience for Service host configuration. + public string SystemAssignedManagedIdentityAudience + { + get => SystemAssignedManagedIdentitySettings is null ? default : SystemAssignedManagedIdentitySettings.Audience; + set + { + if (SystemAssignedManagedIdentitySettings is null) + SystemAssignedManagedIdentitySettings = new DataflowEndpointAuthenticationSystemAssignedManagedIdentity(); + SystemAssignedManagedIdentitySettings.Audience = value; + } + } + + /// User-assigned managed identity authentication. + public DataflowEndpointAuthenticationUserAssignedManagedIdentity UserAssignedManagedIdentitySettings { get; set; } + /// Kubernetes service account token authentication. Default audience if not set is aio-internal. + internal DataflowEndpointAuthenticationServiceAccountToken ServiceAccountTokenSettings { get; set; } + /// Audience of the service account. Optional, defaults to the broker internal service account audience. + public string ServiceAccountTokenAudience + { + get => ServiceAccountTokenSettings is null ? default : ServiceAccountTokenSettings.Audience; + set => ServiceAccountTokenSettings = new DataflowEndpointAuthenticationServiceAccountToken(value); + } + + /// X.509 certificate authentication. + internal DataflowEndpointAuthenticationX509 X509CertificateSettings { get; set; } + /// Secret reference of the X.509 certificate. + public string X509CertificateSecretRef + { + get => X509CertificateSettings is null ? default : X509CertificateSettings.SecretRef; + set => X509CertificateSettings = new DataflowEndpointAuthenticationX509(value); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointProperties.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointProperties.Serialization.cs new file mode 100644 index 000000000000..188683c85457 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointProperties.Serialization.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowEndpointProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("endpointType"u8); + writer.WriteStringValue(EndpointType.ToString()); + if (Optional.IsDefined(DataExplorerSettings)) + { + writer.WritePropertyName("dataExplorerSettings"u8); + writer.WriteObjectValue(DataExplorerSettings, options); + } + if (Optional.IsDefined(DataLakeStorageSettings)) + { + writer.WritePropertyName("dataLakeStorageSettings"u8); + writer.WriteObjectValue(DataLakeStorageSettings, options); + } + if (Optional.IsDefined(FabricOneLakeSettings)) + { + writer.WritePropertyName("fabricOneLakeSettings"u8); + writer.WriteObjectValue(FabricOneLakeSettings, options); + } + if (Optional.IsDefined(KafkaSettings)) + { + writer.WritePropertyName("kafkaSettings"u8); + writer.WriteObjectValue(KafkaSettings, options); + } + if (Optional.IsDefined(LocalStorageSettings)) + { + writer.WritePropertyName("localStorageSettings"u8); + writer.WriteObjectValue(LocalStorageSettings, options); + } + if (Optional.IsDefined(MqttSettings)) + { + writer.WritePropertyName("mqttSettings"u8); + writer.WriteObjectValue(MqttSettings, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointProperties(document.RootElement, options); + } + + internal static DataflowEndpointProperties DeserializeDataflowEndpointProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EndpointType endpointType = default; + DataflowEndpointDataExplorer dataExplorerSettings = default; + DataflowEndpointDataLakeStorage dataLakeStorageSettings = default; + DataflowEndpointFabricOneLake fabricOneLakeSettings = default; + DataflowEndpointKafka kafkaSettings = default; + DataflowEndpointLocalStorage localStorageSettings = default; + DataflowEndpointMqtt mqttSettings = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("endpointType"u8)) + { + endpointType = new EndpointType(property.Value.GetString()); + continue; + } + if (property.NameEquals("dataExplorerSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataExplorerSettings = DataflowEndpointDataExplorer.DeserializeDataflowEndpointDataExplorer(property.Value, options); + continue; + } + if (property.NameEquals("dataLakeStorageSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataLakeStorageSettings = DataflowEndpointDataLakeStorage.DeserializeDataflowEndpointDataLakeStorage(property.Value, options); + continue; + } + if (property.NameEquals("fabricOneLakeSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fabricOneLakeSettings = DataflowEndpointFabricOneLake.DeserializeDataflowEndpointFabricOneLake(property.Value, options); + continue; + } + if (property.NameEquals("kafkaSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kafkaSettings = DataflowEndpointKafka.DeserializeDataflowEndpointKafka(property.Value, options); + continue; + } + if (property.NameEquals("localStorageSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + localStorageSettings = DataflowEndpointLocalStorage.DeserializeDataflowEndpointLocalStorage(property.Value, options); + continue; + } + if (property.NameEquals("mqttSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mqttSettings = DataflowEndpointMqtt.DeserializeDataflowEndpointMqtt(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointProperties( + endpointType, + dataExplorerSettings, + dataLakeStorageSettings, + fabricOneLakeSettings, + kafkaSettings, + localStorageSettings, + mqttSettings, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointProperties)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointProperties.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointProperties.cs new file mode 100644 index 000000000000..fc165c1a45f0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointProperties.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Resource properties. NOTE - Only one type of endpoint is supported for one Resource. + public partial class DataflowEndpointProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Endpoint Type. + public DataflowEndpointProperties(EndpointType endpointType) + { + EndpointType = endpointType; + } + + /// Initializes a new instance of . + /// Endpoint Type. + /// Azure Data Explorer endpoint. + /// Azure Data Lake endpoint. + /// Microsoft Fabric endpoint. + /// Kafka endpoint. + /// Local persistent volume endpoint. + /// Broker endpoint. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointProperties(EndpointType endpointType, DataflowEndpointDataExplorer dataExplorerSettings, DataflowEndpointDataLakeStorage dataLakeStorageSettings, DataflowEndpointFabricOneLake fabricOneLakeSettings, DataflowEndpointKafka kafkaSettings, DataflowEndpointLocalStorage localStorageSettings, DataflowEndpointMqtt mqttSettings, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + EndpointType = endpointType; + DataExplorerSettings = dataExplorerSettings; + DataLakeStorageSettings = dataLakeStorageSettings; + FabricOneLakeSettings = fabricOneLakeSettings; + KafkaSettings = kafkaSettings; + LocalStorageSettings = localStorageSettings; + MqttSettings = mqttSettings; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointProperties() + { + } + + /// Endpoint Type. + public EndpointType EndpointType { get; set; } + /// Azure Data Explorer endpoint. + public DataflowEndpointDataExplorer DataExplorerSettings { get; set; } + /// Azure Data Lake endpoint. + public DataflowEndpointDataLakeStorage DataLakeStorageSettings { get; set; } + /// Microsoft Fabric endpoint. + public DataflowEndpointFabricOneLake FabricOneLakeSettings { get; set; } + /// Kafka endpoint. + public DataflowEndpointKafka KafkaSettings { get; set; } + /// Local persistent volume endpoint. + internal DataflowEndpointLocalStorage LocalStorageSettings { get; set; } + /// Persistent volume claim name. + public string LocalStoragePersistentVolumeClaimRef + { + get => LocalStorageSettings is null ? default : LocalStorageSettings.PersistentVolumeClaimRef; + set => LocalStorageSettings = new DataflowEndpointLocalStorage(value); + } + + /// Broker endpoint. + public DataflowEndpointMqtt MqttSettings { get; set; } + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointResourceListResult.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointResourceListResult.Serialization.cs new file mode 100644 index 000000000000..fbfe08a64c76 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class DataflowEndpointResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowEndpointResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowEndpointResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowEndpointResourceListResult(document.RootElement, options); + } + + internal static DataflowEndpointResourceListResult DeserializeDataflowEndpointResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataflowEndpointResourceData.DeserializeDataflowEndpointResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowEndpointResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowEndpointResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + DataflowEndpointResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowEndpointResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowEndpointResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointResourceListResult.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointResourceListResult.cs new file mode 100644 index 000000000000..0fb3ab689f95 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowEndpointResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The response of a DataflowEndpointResource list operation. + internal partial class DataflowEndpointResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The DataflowEndpointResource items on this page. + /// is null. + internal DataflowEndpointResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The DataflowEndpointResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal DataflowEndpointResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowEndpointResourceListResult() + { + } + + /// The DataflowEndpointResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowMappingType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowMappingType.cs new file mode 100644 index 000000000000..3bdb13d5a1b5 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowMappingType.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow type mapping properties. + public readonly partial struct DataflowMappingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataflowMappingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NewPropertiesValue = "NewProperties"; + private const string RenameValue = "Rename"; + private const string ComputeValue = "Compute"; + private const string PassThroughValue = "PassThrough"; + private const string BuiltInFunctionValue = "BuiltInFunction"; + + /// New Properties type. + public static DataflowMappingType NewProperties { get; } = new DataflowMappingType(NewPropertiesValue); + /// Rename type. + public static DataflowMappingType Rename { get; } = new DataflowMappingType(RenameValue); + /// Compute type. + public static DataflowMappingType Compute { get; } = new DataflowMappingType(ComputeValue); + /// Pass-through type. + public static DataflowMappingType PassThrough { get; } = new DataflowMappingType(PassThroughValue); + /// Built in function type. + public static DataflowMappingType BuiltInFunction { get; } = new DataflowMappingType(BuiltInFunctionValue); + /// Determines if two values are the same. + public static bool operator ==(DataflowMappingType left, DataflowMappingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataflowMappingType left, DataflowMappingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataflowMappingType(string value) => new DataflowMappingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataflowMappingType other && Equals(other); + /// + public bool Equals(DataflowMappingType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowOperation.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowOperation.Serialization.cs new file mode 100644 index 000000000000..217d390ffb5a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowOperation.Serialization.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowOperation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowOperation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("operationType"u8); + writer.WriteStringValue(OperationType.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(SourceSettings)) + { + writer.WritePropertyName("sourceSettings"u8); + writer.WriteObjectValue(SourceSettings, options); + } + if (Optional.IsDefined(BuiltInTransformationSettings)) + { + writer.WritePropertyName("builtInTransformationSettings"u8); + writer.WriteObjectValue(BuiltInTransformationSettings, options); + } + if (Optional.IsDefined(DestinationSettings)) + { + writer.WritePropertyName("destinationSettings"u8); + writer.WriteObjectValue(DestinationSettings, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowOperation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowOperation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowOperation(document.RootElement, options); + } + + internal static DataflowOperation DeserializeDataflowOperation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OperationType operationType = default; + string name = default; + DataflowSourceOperationSettings sourceSettings = default; + DataflowBuiltInTransformationSettings builtInTransformationSettings = default; + DataflowDestinationOperationSettings destinationSettings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("operationType"u8)) + { + operationType = new OperationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceSettings = DataflowSourceOperationSettings.DeserializeDataflowSourceOperationSettings(property.Value, options); + continue; + } + if (property.NameEquals("builtInTransformationSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + builtInTransformationSettings = DataflowBuiltInTransformationSettings.DeserializeDataflowBuiltInTransformationSettings(property.Value, options); + continue; + } + if (property.NameEquals("destinationSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + destinationSettings = DataflowDestinationOperationSettings.DeserializeDataflowDestinationOperationSettings(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowOperation( + operationType, + name, + sourceSettings, + builtInTransformationSettings, + destinationSettings, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowOperation)} does not support writing '{options.Format}' format."); + } + } + + DataflowOperation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowOperation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowOperation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowOperation.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowOperation.cs new file mode 100644 index 000000000000..264c7687e600 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowOperation.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow Operation properties. NOTE - One only method is allowed to be used for one entry. + public partial class DataflowOperation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Type of operation. + public DataflowOperation(OperationType operationType) + { + OperationType = operationType; + } + + /// Initializes a new instance of . + /// Type of operation. + /// Optional user provided name of the transformation. + /// Source configuration. + /// Built In Transformation configuration. + /// Destination configuration. + /// Keeps track of any properties unknown to the library. + internal DataflowOperation(OperationType operationType, string name, DataflowSourceOperationSettings sourceSettings, DataflowBuiltInTransformationSettings builtInTransformationSettings, DataflowDestinationOperationSettings destinationSettings, IDictionary serializedAdditionalRawData) + { + OperationType = operationType; + Name = name; + SourceSettings = sourceSettings; + BuiltInTransformationSettings = builtInTransformationSettings; + DestinationSettings = destinationSettings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowOperation() + { + } + + /// Type of operation. + public OperationType OperationType { get; set; } + /// Optional user provided name of the transformation. + public string Name { get; set; } + /// Source configuration. + public DataflowSourceOperationSettings SourceSettings { get; set; } + /// Built In Transformation configuration. + public DataflowBuiltInTransformationSettings BuiltInTransformationSettings { get; set; } + /// Destination configuration. + public DataflowDestinationOperationSettings DestinationSettings { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileProperties.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileProperties.Serialization.cs new file mode 100644 index 000000000000..c82972ff6cdb --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileProperties.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowProfileProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowProfileProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Diagnostics)) + { + writer.WritePropertyName("diagnostics"u8); + writer.WriteObjectValue(Diagnostics, options); + } + if (Optional.IsDefined(InstanceCount)) + { + writer.WritePropertyName("instanceCount"u8); + writer.WriteNumberValue(InstanceCount.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowProfileProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowProfileProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowProfileProperties(document.RootElement, options); + } + + internal static DataflowProfileProperties DeserializeDataflowProfileProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProfileDiagnostics diagnostics = default; + int? instanceCount = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("diagnostics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diagnostics = ProfileDiagnostics.DeserializeProfileDiagnostics(property.Value, options); + continue; + } + if (property.NameEquals("instanceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowProfileProperties(diagnostics, instanceCount, provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowProfileProperties)} does not support writing '{options.Format}' format."); + } + } + + DataflowProfileProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowProfileProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowProfileProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileProperties.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileProperties.cs new file mode 100644 index 000000000000..4105673e0279 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowProfile Resource properties. + public partial class DataflowProfileProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DataflowProfileProperties() + { + } + + /// Initializes a new instance of . + /// Spec defines the desired identities of NBC diagnostics settings. + /// To manually scale the dataflow profile, specify the maximum number of instances you want to run. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal DataflowProfileProperties(ProfileDiagnostics diagnostics, int? instanceCount, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + Diagnostics = diagnostics; + InstanceCount = instanceCount; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Spec defines the desired identities of NBC diagnostics settings. + public ProfileDiagnostics Diagnostics { get; set; } + /// To manually scale the dataflow profile, specify the maximum number of instances you want to run. + public int? InstanceCount { get; set; } + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileResourceListResult.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileResourceListResult.Serialization.cs new file mode 100644 index 000000000000..65b1a2bfafe1 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class DataflowProfileResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowProfileResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowProfileResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowProfileResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowProfileResourceListResult(document.RootElement, options); + } + + internal static DataflowProfileResourceListResult DeserializeDataflowProfileResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataflowProfileResourceData.DeserializeDataflowProfileResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowProfileResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowProfileResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + DataflowProfileResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowProfileResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowProfileResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileResourceListResult.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileResourceListResult.cs new file mode 100644 index 000000000000..73acf9e2870e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProfileResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The response of a DataflowProfileResource list operation. + internal partial class DataflowProfileResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The DataflowProfileResource items on this page. + /// is null. + internal DataflowProfileResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The DataflowProfileResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal DataflowProfileResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowProfileResourceListResult() + { + } + + /// The DataflowProfileResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProperties.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProperties.Serialization.cs new file mode 100644 index 000000000000..6d08ec5b88fe --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProperties.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + writer.WritePropertyName("operations"u8); + writer.WriteStartArray(); + foreach (var item in Operations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowProperties(document.RootElement, options); + } + + internal static DataflowProperties DeserializeDataflowProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OperationalMode? mode = default; + IList operations = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new OperationalMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("operations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataflowOperation.DeserializeDataflowOperation(item, options)); + } + operations = array; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowProperties(mode, operations, provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowProperties)} does not support writing '{options.Format}' format."); + } + } + + DataflowProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProperties.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProperties.cs new file mode 100644 index 000000000000..e5be51824bb9 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowProperties.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow Resource properties. + public partial class DataflowProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of operations including source and destination references as well as transformation. + /// is null. + public DataflowProperties(IEnumerable operations) + { + Argument.AssertNotNull(operations, nameof(operations)); + + Operations = operations.ToList(); + } + + /// Initializes a new instance of . + /// Mode for Dataflow. Optional; defaults to Enabled. + /// List of operations including source and destination references as well as transformation. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal DataflowProperties(OperationalMode? mode, IList operations, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + Mode = mode; + Operations = operations; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowProperties() + { + } + + /// Mode for Dataflow. Optional; defaults to Enabled. + public OperationalMode? Mode { get; set; } + /// List of operations including source and destination references as well as transformation. + public IList Operations { get; } + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowResourceListResult.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowResourceListResult.Serialization.cs new file mode 100644 index 000000000000..416bdbc86364 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class DataflowResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowResourceListResult(document.RootElement, options); + } + + internal static DataflowResourceListResult DeserializeDataflowResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataflowResourceData.DeserializeDataflowResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + DataflowResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowResourceListResult.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowResourceListResult.cs new file mode 100644 index 000000000000..6811403a9a59 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The response of a DataflowResource list operation. + internal partial class DataflowResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The DataflowResource items on this page. + /// is null. + internal DataflowResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The DataflowResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal DataflowResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowResourceListResult() + { + } + + /// The DataflowResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowSourceOperationSettings.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowSourceOperationSettings.Serialization.cs new file mode 100644 index 000000000000..4f65f7f215ae --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowSourceOperationSettings.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DataflowSourceOperationSettings : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowSourceOperationSettings)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("endpointRef"u8); + writer.WriteStringValue(EndpointRef); + if (Optional.IsDefined(AssetRef)) + { + writer.WritePropertyName("assetRef"u8); + writer.WriteStringValue(AssetRef); + } + if (Optional.IsDefined(SerializationFormat)) + { + writer.WritePropertyName("serializationFormat"u8); + writer.WriteStringValue(SerializationFormat.Value.ToString()); + } + if (Optional.IsDefined(SchemaRef)) + { + writer.WritePropertyName("schemaRef"u8); + writer.WriteStringValue(SchemaRef); + } + writer.WritePropertyName("dataSources"u8); + writer.WriteStartArray(); + foreach (var item in DataSources) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataflowSourceOperationSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DataflowSourceOperationSettings)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataflowSourceOperationSettings(document.RootElement, options); + } + + internal static DataflowSourceOperationSettings DeserializeDataflowSourceOperationSettings(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string endpointRef = default; + string assetRef = default; + SourceSerializationFormat? serializationFormat = default; + string schemaRef = default; + IList dataSources = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("endpointRef"u8)) + { + endpointRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("assetRef"u8)) + { + assetRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("serializationFormat"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serializationFormat = new SourceSerializationFormat(property.Value.GetString()); + continue; + } + if (property.NameEquals("schemaRef"u8)) + { + schemaRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataSources"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dataSources = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataflowSourceOperationSettings( + endpointRef, + assetRef, + serializationFormat, + schemaRef, + dataSources, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DataflowSourceOperationSettings)} does not support writing '{options.Format}' format."); + } + } + + DataflowSourceOperationSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataflowSourceOperationSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataflowSourceOperationSettings)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowSourceOperationSettings.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowSourceOperationSettings.cs new file mode 100644 index 000000000000..05d37e0e3541 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DataflowSourceOperationSettings.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow Source Operation properties. + public partial class DataflowSourceOperationSettings + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Reference to the Dataflow Endpoint resource. Can only be of Broker and Kafka type. + /// List of source locations. Can be Broker or Kafka topics. Supports wildcards # and +. + /// or is null. + public DataflowSourceOperationSettings(string endpointRef, IEnumerable dataSources) + { + Argument.AssertNotNull(endpointRef, nameof(endpointRef)); + Argument.AssertNotNull(dataSources, nameof(dataSources)); + + EndpointRef = endpointRef; + DataSources = dataSources.ToList(); + } + + /// Initializes a new instance of . + /// Reference to the Dataflow Endpoint resource. Can only be of Broker and Kafka type. + /// Reference to the resource in Azure Device Registry where the data in the endpoint originates from. + /// Content is a JSON Schema. Allowed: JSON Schema/draft-7. + /// Schema CR reference. Data will be deserialized according to the schema, and dropped if it doesn't match. + /// List of source locations. Can be Broker or Kafka topics. Supports wildcards # and +. + /// Keeps track of any properties unknown to the library. + internal DataflowSourceOperationSettings(string endpointRef, string assetRef, SourceSerializationFormat? serializationFormat, string schemaRef, IList dataSources, IDictionary serializedAdditionalRawData) + { + EndpointRef = endpointRef; + AssetRef = assetRef; + SerializationFormat = serializationFormat; + SchemaRef = schemaRef; + DataSources = dataSources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataflowSourceOperationSettings() + { + } + + /// Reference to the Dataflow Endpoint resource. Can only be of Broker and Kafka type. + public string EndpointRef { get; set; } + /// Reference to the resource in Azure Device Registry where the data in the endpoint originates from. + public string AssetRef { get; set; } + /// Content is a JSON Schema. Allowed: JSON Schema/draft-7. + public SourceSerializationFormat? SerializationFormat { get; set; } + /// Schema CR reference. Data will be deserialized according to the schema, and dropped if it doesn't match. + public string SchemaRef { get; set; } + /// List of source locations. Can be Broker or Kafka topics. Supports wildcards # and +. + public IList DataSources { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiagnosticsLogs.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiagnosticsLogs.Serialization.cs new file mode 100644 index 000000000000..b256ca61ebcc --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiagnosticsLogs.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class DiagnosticsLogs : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiagnosticsLogs)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Level)) + { + writer.WritePropertyName("level"u8); + writer.WriteStringValue(Level); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiagnosticsLogs IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiagnosticsLogs)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiagnosticsLogs(document.RootElement, options); + } + + internal static DiagnosticsLogs DeserializeDiagnosticsLogs(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string level = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("level"u8)) + { + level = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiagnosticsLogs(level, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiagnosticsLogs)} does not support writing '{options.Format}' format."); + } + } + + DiagnosticsLogs IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDiagnosticsLogs(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiagnosticsLogs)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiagnosticsLogs.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiagnosticsLogs.cs new file mode 100644 index 000000000000..0dc565ff1aff --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiagnosticsLogs.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Diagnostic Log properties. + internal partial class DiagnosticsLogs + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DiagnosticsLogs() + { + } + + /// Initializes a new instance of . + /// The log level. Examples - 'debug', 'info', 'warn', 'error', 'trace'. + /// Keeps track of any properties unknown to the library. + internal DiagnosticsLogs(string level, IDictionary serializedAdditionalRawData) + { + Level = level; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The log level. Examples - 'debug', 'info', 'warn', 'error', 'trace'. + public string Level { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiskBackedMessageBuffer.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiskBackedMessageBuffer.Serialization.cs new file mode 100644 index 000000000000..8994cb068b39 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiskBackedMessageBuffer.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class DiskBackedMessageBuffer : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiskBackedMessageBuffer)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("maxSize"u8); + writer.WriteStringValue(MaxSize); + if (Optional.IsDefined(EphemeralVolumeClaimSpec)) + { + writer.WritePropertyName("ephemeralVolumeClaimSpec"u8); + writer.WriteObjectValue(EphemeralVolumeClaimSpec, options); + } + if (Optional.IsDefined(PersistentVolumeClaimSpec)) + { + writer.WritePropertyName("persistentVolumeClaimSpec"u8); + writer.WriteObjectValue(PersistentVolumeClaimSpec, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DiskBackedMessageBuffer IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiskBackedMessageBuffer)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiskBackedMessageBuffer(document.RootElement, options); + } + + internal static DiskBackedMessageBuffer DeserializeDiskBackedMessageBuffer(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string maxSize = default; + VolumeClaimSpec ephemeralVolumeClaimSpec = default; + VolumeClaimSpec persistentVolumeClaimSpec = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("maxSize"u8)) + { + maxSize = property.Value.GetString(); + continue; + } + if (property.NameEquals("ephemeralVolumeClaimSpec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ephemeralVolumeClaimSpec = VolumeClaimSpec.DeserializeVolumeClaimSpec(property.Value, options); + continue; + } + if (property.NameEquals("persistentVolumeClaimSpec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + persistentVolumeClaimSpec = VolumeClaimSpec.DeserializeVolumeClaimSpec(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiskBackedMessageBuffer(maxSize, ephemeralVolumeClaimSpec, persistentVolumeClaimSpec, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiskBackedMessageBuffer)} does not support writing '{options.Format}' format."); + } + } + + DiskBackedMessageBuffer IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDiskBackedMessageBuffer(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiskBackedMessageBuffer)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiskBackedMessageBuffer.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiskBackedMessageBuffer.cs new file mode 100644 index 000000000000..4888b54b4fbf --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/DiskBackedMessageBuffer.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DiskBackedMessageBuffer properties. + public partial class DiskBackedMessageBuffer + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The max size of the message buffer on disk. If a PVC template is specified using one of ephemeralVolumeClaimSpec or persistentVolumeClaimSpec, then this size is used as the request and limit sizes of that template. If neither ephemeralVolumeClaimSpec nor persistentVolumeClaimSpec are specified, then an emptyDir volume is mounted with this size as its limit. See <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir> for details. + /// is null. + public DiskBackedMessageBuffer(string maxSize) + { + Argument.AssertNotNull(maxSize, nameof(maxSize)); + + MaxSize = maxSize; + } + + /// Initializes a new instance of . + /// The max size of the message buffer on disk. If a PVC template is specified using one of ephemeralVolumeClaimSpec or persistentVolumeClaimSpec, then this size is used as the request and limit sizes of that template. If neither ephemeralVolumeClaimSpec nor persistentVolumeClaimSpec are specified, then an emptyDir volume is mounted with this size as its limit. See <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir> for details. + /// Use the specified persistent volume claim template to mount a "generic ephemeral volume" for the message buffer. See <https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes> for details. + /// Use the specified persistent volume claim template to mount a persistent volume for the message buffer. + /// Keeps track of any properties unknown to the library. + internal DiskBackedMessageBuffer(string maxSize, VolumeClaimSpec ephemeralVolumeClaimSpec, VolumeClaimSpec persistentVolumeClaimSpec, IDictionary serializedAdditionalRawData) + { + MaxSize = maxSize; + EphemeralVolumeClaimSpec = ephemeralVolumeClaimSpec; + PersistentVolumeClaimSpec = persistentVolumeClaimSpec; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiskBackedMessageBuffer() + { + } + + /// The max size of the message buffer on disk. If a PVC template is specified using one of ephemeralVolumeClaimSpec or persistentVolumeClaimSpec, then this size is used as the request and limit sizes of that template. If neither ephemeralVolumeClaimSpec nor persistentVolumeClaimSpec are specified, then an emptyDir volume is mounted with this size as its limit. See <https://kubernetes.io/docs/concepts/storage/volumes/#emptydir> for details. + public string MaxSize { get; set; } + /// Use the specified persistent volume claim template to mount a "generic ephemeral volume" for the message buffer. See <https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes> for details. + public VolumeClaimSpec EphemeralVolumeClaimSpec { get; set; } + /// Use the specified persistent volume claim template to mount a persistent volume for the message buffer. + public VolumeClaimSpec PersistentVolumeClaimSpec { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/EndpointType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/EndpointType.cs new file mode 100644 index 000000000000..ebcf7a21be3e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/EndpointType.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Type properties. + public readonly partial struct EndpointType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EndpointType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DataExplorerValue = "DataExplorer"; + private const string DataLakeStorageValue = "DataLakeStorage"; + private const string FabricOneLakeValue = "FabricOneLake"; + private const string KafkaValue = "Kafka"; + private const string LocalStorageValue = "LocalStorage"; + private const string MqttValue = "Mqtt"; + + /// Azure Data Explorer Type. + public static EndpointType DataExplorer { get; } = new EndpointType(DataExplorerValue); + /// Azure Data Lake Type. + public static EndpointType DataLakeStorage { get; } = new EndpointType(DataLakeStorageValue); + /// Microsoft Fabric Type. + public static EndpointType FabricOneLake { get; } = new EndpointType(FabricOneLakeValue); + /// Kafka Type. + public static EndpointType Kafka { get; } = new EndpointType(KafkaValue); + /// Local Storage Type. + public static EndpointType LocalStorage { get; } = new EndpointType(LocalStorageValue); + /// Broker Type. + public static EndpointType Mqtt { get; } = new EndpointType(MqttValue); + /// Determines if two values are the same. + public static bool operator ==(EndpointType left, EndpointType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EndpointType left, EndpointType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EndpointType(string value) => new EndpointType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EndpointType other && Equals(other); + /// + public bool Equals(EndpointType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocation.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocation.Serialization.cs new file mode 100644 index 000000000000..7d1c0523e9ea --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocation.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class ExtendedLocation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtendedLocation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExtendedLocation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtendedLocation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtendedLocation(document.RootElement, options); + } + + internal static ExtendedLocation DeserializeExtendedLocation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + ExtendedLocationType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ExtendedLocationType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtendedLocation(name, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtendedLocation)} does not support writing '{options.Format}' format."); + } + } + + ExtendedLocation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtendedLocation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtendedLocation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocation.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocation.cs new file mode 100644 index 000000000000..7baef78f7eb6 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocation.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Extended location is an extension of Azure locations. They provide a way to use their Azure ARC enabled Kubernetes clusters as target locations for deploying Azure services instances. + public partial class ExtendedLocation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the extended location. + /// Type of ExtendedLocation. + /// is null. + public ExtendedLocation(string name, ExtendedLocationType type) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + Type = type; + } + + /// Initializes a new instance of . + /// The name of the extended location. + /// Type of ExtendedLocation. + /// Keeps track of any properties unknown to the library. + internal ExtendedLocation(string name, ExtendedLocationType type, IDictionary serializedAdditionalRawData) + { + Name = name; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExtendedLocation() + { + } + + /// The name of the extended location. + public string Name { get; set; } + /// Type of ExtendedLocation. + public ExtendedLocationType Type { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocationType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocationType.cs new file mode 100644 index 000000000000..580198c7d87b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ExtendedLocationType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The enum defining type of ExtendedLocation accepted. + public readonly partial struct ExtendedLocationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ExtendedLocationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CustomLocationValue = "CustomLocation"; + + /// CustomLocation type. + public static ExtendedLocationType CustomLocation { get; } = new ExtendedLocationType(CustomLocationValue); + /// Determines if two values are the same. + public static bool operator ==(ExtendedLocationType left, ExtendedLocationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ExtendedLocationType left, ExtendedLocationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ExtendedLocationType(string value) => new ExtendedLocationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ExtendedLocationType other && Equals(other); + /// + public bool Equals(ExtendedLocationType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/FabricOneLakeAuthMethod.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/FabricOneLakeAuthMethod.cs new file mode 100644 index 000000000000..c6afa99c4a18 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/FabricOneLakeAuthMethod.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Fabric One Lake Authentication Method properties. + public readonly partial struct FabricOneLakeAuthMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FabricOneLakeAuthMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedManagedIdentityValue = "SystemAssignedManagedIdentity"; + private const string UserAssignedManagedIdentityValue = "UserAssignedManagedIdentity"; + + /// SystemAssignedManagedIdentity type. + public static FabricOneLakeAuthMethod SystemAssignedManagedIdentity { get; } = new FabricOneLakeAuthMethod(SystemAssignedManagedIdentityValue); + /// UserAssignedManagedIdentity type. + public static FabricOneLakeAuthMethod UserAssignedManagedIdentity { get; } = new FabricOneLakeAuthMethod(UserAssignedManagedIdentityValue); + /// Determines if two values are the same. + public static bool operator ==(FabricOneLakeAuthMethod left, FabricOneLakeAuthMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FabricOneLakeAuthMethod left, FabricOneLakeAuthMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FabricOneLakeAuthMethod(string value) => new FabricOneLakeAuthMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FabricOneLakeAuthMethod other && Equals(other); + /// + public bool Equals(FabricOneLakeAuthMethod 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/FilterType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/FilterType.cs new file mode 100644 index 000000000000..396e4a81b1b1 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/FilterType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Filter Type properties. + public readonly partial struct FilterType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FilterType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FilterValue = "Filter"; + + /// Filter type. + public static FilterType Filter { get; } = new FilterType(FilterValue); + /// Determines if two values are the same. + public static bool operator ==(FilterType left, FilterType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FilterType left, FilterType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FilterType(string value) => new FilterType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FilterType other && Equals(other); + /// + public bool Equals(FilterType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Frontend.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Frontend.Serialization.cs new file mode 100644 index 000000000000..f7ecbcf6db61 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Frontend.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class Frontend : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Frontend)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("replicas"u8); + writer.WriteNumberValue(Replicas); + if (Optional.IsDefined(Workers)) + { + writer.WritePropertyName("workers"u8); + writer.WriteNumberValue(Workers.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Frontend IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Frontend)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFrontend(document.RootElement, options); + } + + internal static Frontend DeserializeFrontend(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int replicas = default; + int? workers = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("replicas"u8)) + { + replicas = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("workers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + workers = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Frontend(replicas, workers, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Frontend)} does not support writing '{options.Format}' format."); + } + } + + Frontend IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFrontend(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Frontend)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Frontend.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Frontend.cs new file mode 100644 index 000000000000..0db1d6c6022f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Frontend.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The desired properties of the frontend instances of the Broker. + public partial class Frontend + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The desired number of frontend instances (pods). + public Frontend(int replicas) + { + Replicas = replicas; + } + + /// Initializes a new instance of . + /// The desired number of frontend instances (pods). + /// Number of logical frontend workers per instance (pod). + /// Keeps track of any properties unknown to the library. + internal Frontend(int replicas, int? workers, IDictionary serializedAdditionalRawData) + { + Replicas = replicas; + Workers = workers; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Frontend() + { + } + + /// The desired number of frontend instances (pods). + public int Replicas { get; set; } + /// Number of logical frontend workers per instance (pod). + public int? Workers { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/GenerateResourceLimits.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/GenerateResourceLimits.Serialization.cs new file mode 100644 index 000000000000..6b4aa03c58b9 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/GenerateResourceLimits.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class GenerateResourceLimits : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GenerateResourceLimits)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Cpu)) + { + writer.WritePropertyName("cpu"u8); + writer.WriteStringValue(Cpu.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GenerateResourceLimits IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GenerateResourceLimits)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGenerateResourceLimits(document.RootElement, options); + } + + internal static GenerateResourceLimits DeserializeGenerateResourceLimits(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OperationalMode? cpu = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("cpu"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cpu = new OperationalMode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GenerateResourceLimits(cpu, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(GenerateResourceLimits)} does not support writing '{options.Format}' format."); + } + } + + GenerateResourceLimits IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeGenerateResourceLimits(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GenerateResourceLimits)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/GenerateResourceLimits.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/GenerateResourceLimits.cs new file mode 100644 index 000000000000..762f13aff91f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/GenerateResourceLimits.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// GenerateResourceLimits properties. + internal partial class GenerateResourceLimits + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public GenerateResourceLimits() + { + } + + /// Initializes a new instance of . + /// The toggle to enable/disable cpu resource limits. + /// Keeps track of any properties unknown to the library. + internal GenerateResourceLimits(OperationalMode? cpu, IDictionary serializedAdditionalRawData) + { + Cpu = cpu; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The toggle to enable/disable cpu resource limits. + public OperationalMode? Cpu { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceProperties.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceProperties.Serialization.cs new file mode 100644 index 000000000000..6adfa70b9573 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceProperties.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class InstanceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InstanceProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + writer.WritePropertyName("schemaRegistryRef"u8); + writer.WriteObjectValue(SchemaRegistryRef, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InstanceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InstanceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceProperties(document.RootElement, options); + } + + internal static InstanceProperties DeserializeInstanceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + ProvisioningState? provisioningState = default; + string version = default; + SchemaRegistryRef schemaRegistryRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("schemaRegistryRef"u8)) + { + schemaRegistryRef = SchemaRegistryRef.DeserializeSchemaRegistryRef(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InstanceProperties(description, provisioningState, version, schemaRegistryRef, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InstanceProperties)} does not support writing '{options.Format}' format."); + } + } + + InstanceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInstanceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstanceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceProperties.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceProperties.cs new file mode 100644 index 000000000000..8c3bb37e6515 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The properties of the Instance resource. + public partial class InstanceProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The reference to the Schema Registry for this AIO Instance. + /// is null. + public InstanceProperties(SchemaRegistryRef schemaRegistryRef) + { + Argument.AssertNotNull(schemaRegistryRef, nameof(schemaRegistryRef)); + + SchemaRegistryRef = schemaRegistryRef; + } + + /// Initializes a new instance of . + /// Detailed description of the Instance. + /// The status of the last operation. + /// The Azure IoT Operations version. + /// The reference to the Schema Registry for this AIO Instance. + /// Keeps track of any properties unknown to the library. + internal InstanceProperties(string description, ProvisioningState? provisioningState, string version, SchemaRegistryRef schemaRegistryRef, IDictionary serializedAdditionalRawData) + { + Description = description; + ProvisioningState = provisioningState; + Version = version; + SchemaRegistryRef = schemaRegistryRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InstanceProperties() + { + } + + /// Detailed description of the Instance. + public string Description { get; set; } + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// The Azure IoT Operations version. + public string Version { get; } + /// The reference to the Schema Registry for this AIO Instance. + internal SchemaRegistryRef SchemaRegistryRef { get; set; } + /// The resource ID of the Schema Registry. + public ResourceIdentifier SchemaRegistryRefResourceId + { + get => SchemaRegistryRef is null ? default : SchemaRegistryRef.ResourceId; + set => SchemaRegistryRef = new SchemaRegistryRef(value); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourceListResult.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourceListResult.Serialization.cs new file mode 100644 index 000000000000..7cdbaa81b2bc --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class InstanceResourceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InstanceResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InstanceResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InstanceResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceResourceListResult(document.RootElement, options); + } + + internal static InstanceResourceListResult DeserializeInstanceResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(InstanceResourceData.DeserializeInstanceResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InstanceResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InstanceResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + InstanceResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInstanceResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstanceResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourceListResult.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourceListResult.cs new file mode 100644 index 000000000000..80ca98065f8d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The response of a InstanceResource list operation. + internal partial class InstanceResourceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The InstanceResource items on this page. + /// is null. + internal InstanceResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The InstanceResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal InstanceResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InstanceResourceListResult() + { + } + + /// The InstanceResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourcePatch.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourcePatch.Serialization.cs new file mode 100644 index 000000000000..d42f1462a337 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourcePatch.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class InstanceResourcePatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InstanceResourcePatch)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InstanceResourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InstanceResourcePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceResourcePatch(document.RootElement, options); + } + + internal static InstanceResourcePatch DeserializeInstanceResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + ManagedServiceIdentity identity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InstanceResourcePatch(tags ?? new ChangeTrackingDictionary(), identity, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InstanceResourcePatch)} does not support writing '{options.Format}' format."); + } + } + + InstanceResourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInstanceResourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstanceResourcePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourcePatch.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourcePatch.cs new file mode 100644 index 000000000000..ce3bcb938c2c --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/InstanceResourcePatch.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The Instance update model. + public partial class InstanceResourcePatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public InstanceResourcePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The managed service identities assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal InstanceResourcePatch(IDictionary tags, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KafkaAuthMethod.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KafkaAuthMethod.cs new file mode 100644 index 000000000000..ab77ab58e197 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KafkaAuthMethod.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Kafka Authentication Method properties. + public readonly partial struct KafkaAuthMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public KafkaAuthMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedManagedIdentityValue = "SystemAssignedManagedIdentity"; + private const string UserAssignedManagedIdentityValue = "UserAssignedManagedIdentity"; + private const string SaslValue = "Sasl"; + private const string X509CertificateValue = "X509Certificate"; + private const string AnonymousValue = "Anonymous"; + + /// SystemAssignedManagedIdentity type. + public static KafkaAuthMethod SystemAssignedManagedIdentity { get; } = new KafkaAuthMethod(SystemAssignedManagedIdentityValue); + /// UserAssignedManagedIdentity type. + public static KafkaAuthMethod UserAssignedManagedIdentity { get; } = new KafkaAuthMethod(UserAssignedManagedIdentityValue); + /// Sasl Option. + public static KafkaAuthMethod Sasl { get; } = new KafkaAuthMethod(SaslValue); + /// x509Certificate Option. + public static KafkaAuthMethod X509Certificate { get; } = new KafkaAuthMethod(X509CertificateValue); + /// Anonymous Option. + public static KafkaAuthMethod Anonymous { get; } = new KafkaAuthMethod(AnonymousValue); + /// Determines if two values are the same. + public static bool operator ==(KafkaAuthMethod left, KafkaAuthMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(KafkaAuthMethod left, KafkaAuthMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator KafkaAuthMethod(string value) => new KafkaAuthMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KafkaAuthMethod other && Equals(other); + /// + public bool Equals(KafkaAuthMethod 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KubernetesReference.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KubernetesReference.Serialization.cs new file mode 100644 index 000000000000..80133bae2299 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KubernetesReference.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class KubernetesReference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KubernetesReference)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ApiGroup)) + { + writer.WritePropertyName("apiGroup"u8); + writer.WriteStringValue(ApiGroup); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Namespace)) + { + writer.WritePropertyName("namespace"u8); + writer.WriteStringValue(Namespace); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + KubernetesReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KubernetesReference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKubernetesReference(document.RootElement, options); + } + + internal static KubernetesReference DeserializeKubernetesReference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string apiGroup = default; + string kind = default; + string name = default; + string @namespace = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("apiGroup"u8)) + { + apiGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KubernetesReference(apiGroup, kind, name, @namespace, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KubernetesReference)} does not support writing '{options.Format}' format."); + } + } + + KubernetesReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKubernetesReference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KubernetesReference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KubernetesReference.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KubernetesReference.cs new file mode 100644 index 000000000000..140fb09dc889 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/KubernetesReference.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Kubernetes reference. + public partial class KubernetesReference + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Kind is the type of resource being referenced. + /// Name is the name of resource being referenced. + /// or is null. + public KubernetesReference(string kind, string name) + { + Argument.AssertNotNull(kind, nameof(kind)); + Argument.AssertNotNull(name, nameof(name)); + + Kind = kind; + Name = name; + } + + /// Initializes a new instance of . + /// APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. + /// Kind is the type of resource being referenced. + /// Name is the name of resource being referenced. + /// Namespace is the namespace of the resource being referenced. This field is required when the resource has a namespace. + /// Keeps track of any properties unknown to the library. + internal KubernetesReference(string apiGroup, string kind, string name, string @namespace, IDictionary serializedAdditionalRawData) + { + ApiGroup = apiGroup; + Kind = kind; + Name = name; + Namespace = @namespace; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KubernetesReference() + { + } + + /// APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. + public string ApiGroup { get; set; } + /// Kind is the type of resource being referenced. + public string Kind { get; set; } + /// Name is the name of resource being referenced. + public string Name { get; set; } + /// Namespace is the namespace of the resource being referenced. This field is required when the resource has a namespace. + public string Namespace { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ListenerPort.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ListenerPort.Serialization.cs new file mode 100644 index 000000000000..5289d976ca89 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ListenerPort.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class ListenerPort : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListenerPort)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AuthenticationRef)) + { + writer.WritePropertyName("authenticationRef"u8); + writer.WriteStringValue(AuthenticationRef); + } + if (Optional.IsDefined(AuthorizationRef)) + { + writer.WritePropertyName("authorizationRef"u8); + writer.WriteStringValue(AuthorizationRef); + } + if (Optional.IsDefined(NodePort)) + { + writer.WritePropertyName("nodePort"u8); + writer.WriteNumberValue(NodePort.Value); + } + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port); + if (Optional.IsDefined(Protocol)) + { + writer.WritePropertyName("protocol"u8); + writer.WriteStringValue(Protocol.Value.ToString()); + } + if (Optional.IsDefined(Tls)) + { + writer.WritePropertyName("tls"u8); + writer.WriteObjectValue(Tls, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ListenerPort IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListenerPort)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeListenerPort(document.RootElement, options); + } + + internal static ListenerPort DeserializeListenerPort(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string authenticationRef = default; + string authorizationRef = default; + int? nodePort = default; + int port = default; + BrokerProtocolType? protocol = default; + TlsCertMethod tls = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authenticationRef"u8)) + { + authenticationRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("authorizationRef"u8)) + { + authorizationRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("nodePort"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodePort = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("port"u8)) + { + port = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("protocol"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = new BrokerProtocolType(property.Value.GetString()); + continue; + } + if (property.NameEquals("tls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tls = TlsCertMethod.DeserializeTlsCertMethod(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ListenerPort( + authenticationRef, + authorizationRef, + nodePort, + port, + protocol, + tls, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ListenerPort)} does not support writing '{options.Format}' format."); + } + } + + ListenerPort IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeListenerPort(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListenerPort)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ListenerPort.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ListenerPort.cs new file mode 100644 index 000000000000..b43259c8b99e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ListenerPort.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Defines a TCP port on which a `BrokerListener` listens. + public partial class ListenerPort + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// TCP port for accepting client connections. + public ListenerPort(int port) + { + Port = port; + } + + /// Initializes a new instance of . + /// Reference to client authentication settings. Omit to disable authentication. + /// Reference to client authorization settings. Omit to disable authorization. + /// Kubernetes node port. Only relevant when this port is associated with a `NodePort` listener. + /// TCP port for accepting client connections. + /// Protocol to use for client connections. + /// TLS server certificate settings for this port. Omit to disable TLS. + /// Keeps track of any properties unknown to the library. + internal ListenerPort(string authenticationRef, string authorizationRef, int? nodePort, int port, BrokerProtocolType? protocol, TlsCertMethod tls, IDictionary serializedAdditionalRawData) + { + AuthenticationRef = authenticationRef; + AuthorizationRef = authorizationRef; + NodePort = nodePort; + Port = port; + Protocol = protocol; + Tls = tls; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ListenerPort() + { + } + + /// Reference to client authentication settings. Omit to disable authentication. + public string AuthenticationRef { get; set; } + /// Reference to client authorization settings. Omit to disable authorization. + public string AuthorizationRef { get; set; } + /// Kubernetes node port. Only relevant when this port is associated with a `NodePort` listener. + public int? NodePort { get; set; } + /// TCP port for accepting client connections. + public int Port { get; set; } + /// Protocol to use for client connections. + public BrokerProtocolType? Protocol { get; set; } + /// TLS server certificate settings for this port. Omit to disable TLS. + public TlsCertMethod Tls { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/LocalKubernetesReference.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/LocalKubernetesReference.Serialization.cs new file mode 100644 index 000000000000..f64c87cbeffa --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/LocalKubernetesReference.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.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class LocalKubernetesReference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LocalKubernetesReference)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ApiGroup)) + { + writer.WritePropertyName("apiGroup"u8); + writer.WriteStringValue(ApiGroup); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LocalKubernetesReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LocalKubernetesReference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLocalKubernetesReference(document.RootElement, options); + } + + internal static LocalKubernetesReference DeserializeLocalKubernetesReference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string apiGroup = default; + string kind = default; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("apiGroup"u8)) + { + apiGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LocalKubernetesReference(apiGroup, kind, name, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LocalKubernetesReference)} does not support writing '{options.Format}' format."); + } + } + + LocalKubernetesReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLocalKubernetesReference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LocalKubernetesReference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/LocalKubernetesReference.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/LocalKubernetesReference.cs new file mode 100644 index 000000000000..67e3e6a6b33a --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/LocalKubernetesReference.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Kubernetes reference. + public partial class LocalKubernetesReference + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Kind is the type of resource being referenced. + /// Name is the name of resource being referenced. + /// or is null. + public LocalKubernetesReference(string kind, string name) + { + Argument.AssertNotNull(kind, nameof(kind)); + Argument.AssertNotNull(name, nameof(name)); + + Kind = kind; + Name = name; + } + + /// Initializes a new instance of . + /// APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. + /// Kind is the type of resource being referenced. + /// Name is the name of resource being referenced. + /// Keeps track of any properties unknown to the library. + internal LocalKubernetesReference(string apiGroup, string kind, string name, IDictionary serializedAdditionalRawData) + { + ApiGroup = apiGroup; + Kind = kind; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LocalKubernetesReference() + { + } + + /// APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required. + public string ApiGroup { get; set; } + /// Kind is the type of resource being referenced. + public string Kind { get; set; } + /// Name is the name of resource being referenced. + public string Name { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Metrics.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Metrics.Serialization.cs new file mode 100644 index 000000000000..ab7f05d862e9 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Metrics.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class Metrics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Metrics)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(PrometheusPort)) + { + writer.WritePropertyName("prometheusPort"u8); + writer.WriteNumberValue(PrometheusPort.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Metrics IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Metrics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetrics(document.RootElement, options); + } + + internal static Metrics DeserializeMetrics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? prometheusPort = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("prometheusPort"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + prometheusPort = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Metrics(prometheusPort, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Metrics)} does not support writing '{options.Format}' format."); + } + } + + Metrics IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMetrics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Metrics)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Metrics.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Metrics.cs new file mode 100644 index 000000000000..c6d664b41a92 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Metrics.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Diagnostic Metrics properties. + internal partial class Metrics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Metrics() + { + } + + /// Initializes a new instance of . + /// The prometheus port to expose the metrics. + /// Keeps track of any properties unknown to the library. + internal Metrics(int? prometheusPort, IDictionary serializedAdditionalRawData) + { + PrometheusPort = prometheusPort; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The prometheus port to expose the metrics. + public int? PrometheusPort { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/MqttAuthMethod.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/MqttAuthMethod.cs new file mode 100644 index 000000000000..51de4735b851 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/MqttAuthMethod.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowEndpoint Mqtt Authentication Method properties. + public readonly partial struct MqttAuthMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MqttAuthMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedManagedIdentityValue = "SystemAssignedManagedIdentity"; + private const string UserAssignedManagedIdentityValue = "UserAssignedManagedIdentity"; + private const string ServiceAccountTokenValue = "ServiceAccountToken"; + private const string X509CertificateValue = "X509Certificate"; + private const string AnonymousValue = "Anonymous"; + + /// SystemAssignedManagedIdentity type. + public static MqttAuthMethod SystemAssignedManagedIdentity { get; } = new MqttAuthMethod(SystemAssignedManagedIdentityValue); + /// UserAssignedManagedIdentity type. + public static MqttAuthMethod UserAssignedManagedIdentity { get; } = new MqttAuthMethod(UserAssignedManagedIdentityValue); + /// ServiceAccountToken Option. + public static MqttAuthMethod ServiceAccountToken { get; } = new MqttAuthMethod(ServiceAccountTokenValue); + /// x509Certificate Option. + public static MqttAuthMethod X509Certificate { get; } = new MqttAuthMethod(X509CertificateValue); + /// Anonymous Option. + public static MqttAuthMethod Anonymous { get; } = new MqttAuthMethod(AnonymousValue); + /// Determines if two values are the same. + public static bool operator ==(MqttAuthMethod left, MqttAuthMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MqttAuthMethod left, MqttAuthMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MqttAuthMethod(string value) => new MqttAuthMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MqttAuthMethod other && Equals(other); + /// + public bool Equals(MqttAuthMethod 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/MqttRetainType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/MqttRetainType.cs new file mode 100644 index 000000000000..2dbcf13e8244 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/MqttRetainType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Retain types. + public readonly partial struct MqttRetainType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MqttRetainType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string KeepValue = "Keep"; + private const string NeverValue = "Never"; + + /// Retain the messages. + public static MqttRetainType Keep { get; } = new MqttRetainType(KeepValue); + /// Never retain messages. + public static MqttRetainType Never { get; } = new MqttRetainType(NeverValue); + /// Determines if two values are the same. + public static bool operator ==(MqttRetainType left, MqttRetainType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MqttRetainType left, MqttRetainType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MqttRetainType(string value) => new MqttRetainType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MqttRetainType other && Equals(other); + /// + public bool Equals(MqttRetainType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperationType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperationType.cs new file mode 100644 index 000000000000..c2bd3ae3d057 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperationType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Dataflow Operation Type properties. + public readonly partial struct OperationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SourceValue = "Source"; + private const string DestinationValue = "Destination"; + private const string BuiltInTransformationValue = "BuiltInTransformation"; + + /// Dataflow Source Operation. + public static OperationType Source { get; } = new OperationType(SourceValue); + /// Dataflow Destination Operation. + public static OperationType Destination { get; } = new OperationType(DestinationValue); + /// Dataflow BuiltIn Transformation Operation. + public static OperationType BuiltInTransformation { get; } = new OperationType(BuiltInTransformationValue); + /// Determines if two values are the same. + public static bool operator ==(OperationType left, OperationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationType left, OperationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperationType(string value) => new OperationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationType other && Equals(other); + /// + public bool Equals(OperationType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperationalMode.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperationalMode.cs new file mode 100644 index 000000000000..f3c6686a2eec --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperationalMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Mode properties. + public readonly partial struct OperationalMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationalMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled is equivalent to True. + public static OperationalMode Enabled { get; } = new OperationalMode(EnabledValue); + /// Disabled is equivalent to False. + public static OperationalMode Disabled { get; } = new OperationalMode(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(OperationalMode left, OperationalMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationalMode left, OperationalMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperationalMode(string value) => new OperationalMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationalMode other && Equals(other); + /// + public bool Equals(OperationalMode 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperatorValue.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperatorValue.cs new file mode 100644 index 000000000000..c072dd0f6130 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/OperatorValue.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Valid operators are In, NotIn, Exists and DoesNotExist. + public readonly partial struct OperatorValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperatorValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InValue = "In"; + private const string NotInValue = "NotIn"; + private const string ExistsValue = "Exists"; + private const string DoesNotExistValue = "DoesNotExist"; + + /// In operator. + public static OperatorValue In { get; } = new OperatorValue(InValue); + /// NotIn operator. + public static OperatorValue NotIn { get; } = new OperatorValue(NotInValue); + /// Exists operator. + public static OperatorValue Exists { get; } = new OperatorValue(ExistsValue); + /// DoesNotExist operator. + public static OperatorValue DoesNotExist { get; } = new OperatorValue(DoesNotExistValue); + /// Determines if two values are the same. + public static bool operator ==(OperatorValue left, OperatorValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperatorValue left, OperatorValue right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperatorValue(string value) => new OperatorValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperatorValue other && Equals(other); + /// + public bool Equals(OperatorValue 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrincipalDefinition.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrincipalDefinition.Serialization.cs new file mode 100644 index 000000000000..9d971f50b122 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrincipalDefinition.Serialization.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class PrincipalDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrincipalDefinition)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Attributes)) + { + writer.WritePropertyName("attributes"u8); + writer.WriteStartArray(); + foreach (var item in Attributes) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStartObject(); + foreach (var item0 in item) + { + writer.WritePropertyName(item0.Key); + writer.WriteStringValue(item0.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ClientIds)) + { + writer.WritePropertyName("clientIds"u8); + writer.WriteStartArray(); + foreach (var item in ClientIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Usernames)) + { + writer.WritePropertyName("usernames"u8); + writer.WriteStartArray(); + foreach (var item in Usernames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PrincipalDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrincipalDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrincipalDefinition(document.RootElement, options); + } + + internal static PrincipalDefinition DeserializePrincipalDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList> attributes = default; + IList clientIds = default; + IList usernames = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List> array = new List>(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in item.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + array.Add(dictionary); + } + } + attributes = array; + continue; + } + if (property.NameEquals("clientIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + clientIds = array; + continue; + } + if (property.NameEquals("usernames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + usernames = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PrincipalDefinition(attributes ?? new ChangeTrackingList>(), clientIds ?? new ChangeTrackingList(), usernames ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PrincipalDefinition)} does not support writing '{options.Format}' format."); + } + } + + PrincipalDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePrincipalDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrincipalDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrincipalDefinition.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrincipalDefinition.cs new file mode 100644 index 000000000000..ce94d2071a3f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrincipalDefinition.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// PrincipalDefinition properties of Rule. + public partial class PrincipalDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PrincipalDefinition() + { + Attributes = new ChangeTrackingList>(); + ClientIds = new ChangeTrackingList(); + Usernames = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A list of key-value pairs that match the attributes of the clients. The attributes are case-sensitive and must match the attributes provided by the clients during authentication. + /// A list of client IDs that match the clients. The client IDs are case-sensitive and must match the client IDs provided by the clients during connection. + /// A list of usernames that match the clients. The usernames are case-sensitive and must match the usernames provided by the clients during authentication. + /// Keeps track of any properties unknown to the library. + internal PrincipalDefinition(IList> attributes, IList clientIds, IList usernames, IDictionary serializedAdditionalRawData) + { + Attributes = attributes; + ClientIds = clientIds; + Usernames = usernames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// A list of key-value pairs that match the attributes of the clients. The attributes are case-sensitive and must match the attributes provided by the clients during authentication. + public IList> Attributes { get; } + /// A list of client IDs that match the clients. The client IDs are case-sensitive and must match the client IDs provided by the clients during connection. + public IList ClientIds { get; } + /// A list of usernames that match the clients. The usernames are case-sensitive and must match the usernames provided by the clients during authentication. + public IList Usernames { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrivateKeyAlgorithm.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrivateKeyAlgorithm.cs new file mode 100644 index 000000000000..38992465ec66 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrivateKeyAlgorithm.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Private key algorithm types. + public readonly partial struct PrivateKeyAlgorithm : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PrivateKeyAlgorithm(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string Ec256Value = "Ec256"; + private const string Ec384Value = "Ec384"; + private const string Ec521Value = "Ec521"; + private const string Ed25519Value = "Ed25519"; + private const string Rsa2048Value = "Rsa2048"; + private const string Rsa4096Value = "Rsa4096"; + private const string Rsa8192Value = "Rsa8192"; + + /// Algorithm - ec256. + public static PrivateKeyAlgorithm Ec256 { get; } = new PrivateKeyAlgorithm(Ec256Value); + /// Algorithm - ec384. + public static PrivateKeyAlgorithm Ec384 { get; } = new PrivateKeyAlgorithm(Ec384Value); + /// Algorithm - ec521. + public static PrivateKeyAlgorithm Ec521 { get; } = new PrivateKeyAlgorithm(Ec521Value); + /// Algorithm - ed25519. + public static PrivateKeyAlgorithm Ed25519 { get; } = new PrivateKeyAlgorithm(Ed25519Value); + /// Algorithm - rsa2048. + public static PrivateKeyAlgorithm Rsa2048 { get; } = new PrivateKeyAlgorithm(Rsa2048Value); + /// Algorithm - rsa4096. + public static PrivateKeyAlgorithm Rsa4096 { get; } = new PrivateKeyAlgorithm(Rsa4096Value); + /// Algorithm - rsa8192. + public static PrivateKeyAlgorithm Rsa8192 { get; } = new PrivateKeyAlgorithm(Rsa8192Value); + /// Determines if two values are the same. + public static bool operator ==(PrivateKeyAlgorithm left, PrivateKeyAlgorithm right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PrivateKeyAlgorithm left, PrivateKeyAlgorithm right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PrivateKeyAlgorithm(string value) => new PrivateKeyAlgorithm(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PrivateKeyAlgorithm other && Equals(other); + /// + public bool Equals(PrivateKeyAlgorithm 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrivateKeyRotationPolicy.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrivateKeyRotationPolicy.cs new file mode 100644 index 000000000000..68f1284b1c62 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/PrivateKeyRotationPolicy.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Private key rotation policy. + public readonly partial struct PrivateKeyRotationPolicy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PrivateKeyRotationPolicy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AlwaysValue = "Always"; + private const string NeverValue = "Never"; + + /// Rotation Policy - Always. + public static PrivateKeyRotationPolicy Always { get; } = new PrivateKeyRotationPolicy(AlwaysValue); + /// Rotation Policy - Never. + public static PrivateKeyRotationPolicy Never { get; } = new PrivateKeyRotationPolicy(NeverValue); + /// Determines if two values are the same. + public static bool operator ==(PrivateKeyRotationPolicy left, PrivateKeyRotationPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PrivateKeyRotationPolicy left, PrivateKeyRotationPolicy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PrivateKeyRotationPolicy(string value) => new PrivateKeyRotationPolicy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PrivateKeyRotationPolicy other && Equals(other); + /// + public bool Equals(PrivateKeyRotationPolicy 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProfileDiagnostics.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProfileDiagnostics.Serialization.cs new file mode 100644 index 000000000000..85f2a1ff7f20 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProfileDiagnostics.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class ProfileDiagnostics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProfileDiagnostics)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Logs)) + { + writer.WritePropertyName("logs"u8); + writer.WriteObjectValue(Logs, options); + } + if (Optional.IsDefined(Metrics)) + { + writer.WritePropertyName("metrics"u8); + writer.WriteObjectValue(Metrics, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ProfileDiagnostics IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProfileDiagnostics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProfileDiagnostics(document.RootElement, options); + } + + internal static ProfileDiagnostics DeserializeProfileDiagnostics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DiagnosticsLogs logs = default; + Metrics metrics = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("logs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logs = DiagnosticsLogs.DeserializeDiagnosticsLogs(property.Value, options); + continue; + } + if (property.NameEquals("metrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metrics = Metrics.DeserializeMetrics(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProfileDiagnostics(logs, metrics, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ProfileDiagnostics)} does not support writing '{options.Format}' format."); + } + } + + ProfileDiagnostics IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeProfileDiagnostics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProfileDiagnostics)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProfileDiagnostics.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProfileDiagnostics.cs new file mode 100644 index 000000000000..2e29fc16cc95 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProfileDiagnostics.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// DataflowProfile Diagnostics properties. + public partial class ProfileDiagnostics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ProfileDiagnostics() + { + } + + /// Initializes a new instance of . + /// Diagnostic log settings for the resource. + /// The metrics settings for the resource. + /// Keeps track of any properties unknown to the library. + internal ProfileDiagnostics(DiagnosticsLogs logs, Metrics metrics, IDictionary serializedAdditionalRawData) + { + Logs = logs; + Metrics = metrics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Diagnostic log settings for the resource. + internal DiagnosticsLogs Logs { get; set; } + /// The log level. Examples - 'debug', 'info', 'warn', 'error', 'trace'. + public string LogsLevel + { + get => Logs is null ? default : Logs.Level; + set + { + if (Logs is null) + Logs = new DiagnosticsLogs(); + Logs.Level = value; + } + } + + /// The metrics settings for the resource. + internal Metrics Metrics { get; set; } + /// The prometheus port to expose the metrics. + public int? MetricsPrometheusPort + { + get => Metrics is null ? default : Metrics.PrometheusPort; + set + { + if (Metrics is null) + Metrics = new Metrics(); + Metrics.PrometheusPort = value; + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProvisioningState.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..044791997bda --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The enum defining status of resource. + 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"; + private const string ProvisioningValue = "Provisioning"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string AcceptedValue = "Accepted"; + + /// Resource has been created. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Resource is getting provisioned. + public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + /// Resource is Updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// Resource is Deleting. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// Resource has been Accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SanForCert.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SanForCert.Serialization.cs new file mode 100644 index 000000000000..0369a42258b0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SanForCert.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class SanForCert : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SanForCert)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("dns"u8); + writer.WriteStartArray(); + foreach (var item in Dns) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("ip"u8); + writer.WriteStartArray(); + foreach (var item in IP) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SanForCert IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SanForCert)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSanForCert(document.RootElement, options); + } + + internal static SanForCert DeserializeSanForCert(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList dns = default; + IList ip = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dns"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dns = array; + continue; + } + if (property.NameEquals("ip"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + ip = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SanForCert(dns, ip, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SanForCert)} does not support writing '{options.Format}' format."); + } + } + + SanForCert IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSanForCert(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SanForCert)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SanForCert.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SanForCert.cs new file mode 100644 index 000000000000..750bd03821a1 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SanForCert.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Subject Alternative Names (SANs) for certificate. + public partial class SanForCert + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// DNS SANs. + /// IP address SANs. + /// or is null. + public SanForCert(IEnumerable dns, IEnumerable ip) + { + Argument.AssertNotNull(dns, nameof(dns)); + Argument.AssertNotNull(ip, nameof(ip)); + + Dns = dns.ToList(); + IP = ip.ToList(); + } + + /// Initializes a new instance of . + /// DNS SANs. + /// IP address SANs. + /// Keeps track of any properties unknown to the library. + internal SanForCert(IList dns, IList ip, IDictionary serializedAdditionalRawData) + { + Dns = dns; + IP = ip; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SanForCert() + { + } + + /// DNS SANs. + public IList Dns { get; } + /// IP address SANs. + public IList IP { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SchemaRegistryRef.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SchemaRegistryRef.Serialization.cs new file mode 100644 index 000000000000..f77ca693f334 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SchemaRegistryRef.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class SchemaRegistryRef : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchemaRegistryRef)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SchemaRegistryRef IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SchemaRegistryRef)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSchemaRegistryRef(document.RootElement, options); + } + + internal static SchemaRegistryRef DeserializeSchemaRegistryRef(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier resourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + resourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SchemaRegistryRef(resourceId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SchemaRegistryRef)} does not support writing '{options.Format}' format."); + } + } + + SchemaRegistryRef IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSchemaRegistryRef(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SchemaRegistryRef)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SchemaRegistryRef.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SchemaRegistryRef.cs new file mode 100644 index 000000000000..eba95c26b820 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SchemaRegistryRef.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The reference to the Schema Registry for this AIO Instance. + public partial class SchemaRegistryRef + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The resource ID of the Schema Registry. + /// is null. + public SchemaRegistryRef(ResourceIdentifier resourceId) + { + Argument.AssertNotNull(resourceId, nameof(resourceId)); + + ResourceId = resourceId; + } + + /// Initializes a new instance of . + /// The resource ID of the Schema Registry. + /// Keeps track of any properties unknown to the library. + internal SchemaRegistryRef(ResourceIdentifier resourceId, IDictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SchemaRegistryRef() + { + } + + /// The resource ID of the Schema Registry. + public ResourceIdentifier ResourceId { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfCheck.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfCheck.Serialization.cs new file mode 100644 index 000000000000..353de084add0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfCheck.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class SelfCheck : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SelfCheck)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsDefined(IntervalSeconds)) + { + writer.WritePropertyName("intervalSeconds"u8); + writer.WriteNumberValue(IntervalSeconds.Value); + } + if (Optional.IsDefined(TimeoutSeconds)) + { + writer.WritePropertyName("timeoutSeconds"u8); + writer.WriteNumberValue(TimeoutSeconds.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SelfCheck IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SelfCheck)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSelfCheck(document.RootElement, options); + } + + internal static SelfCheck DeserializeSelfCheck(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OperationalMode? mode = default; + int? intervalSeconds = default; + int? timeoutSeconds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new OperationalMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("intervalSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + intervalSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("timeoutSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeoutSeconds = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SelfCheck(mode, intervalSeconds, timeoutSeconds, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SelfCheck)} does not support writing '{options.Format}' format."); + } + } + + SelfCheck IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSelfCheck(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SelfCheck)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfCheck.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfCheck.cs new file mode 100644 index 000000000000..6fa8789c8bbf --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfCheck.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Diagnostic Self check properties. + public partial class SelfCheck + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SelfCheck() + { + } + + /// Initializes a new instance of . + /// The toggle to enable/disable self check. + /// The self check interval. + /// The timeout for self check. + /// Keeps track of any properties unknown to the library. + internal SelfCheck(OperationalMode? mode, int? intervalSeconds, int? timeoutSeconds, IDictionary serializedAdditionalRawData) + { + Mode = mode; + IntervalSeconds = intervalSeconds; + TimeoutSeconds = timeoutSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The toggle to enable/disable self check. + public OperationalMode? Mode { get; set; } + /// The self check interval. + public int? IntervalSeconds { get; set; } + /// The timeout for self check. + public int? TimeoutSeconds { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfTracing.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfTracing.Serialization.cs new file mode 100644 index 000000000000..db1d705bddad --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfTracing.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class SelfTracing : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SelfTracing)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsDefined(IntervalSeconds)) + { + writer.WritePropertyName("intervalSeconds"u8); + writer.WriteNumberValue(IntervalSeconds.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SelfTracing IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SelfTracing)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSelfTracing(document.RootElement, options); + } + + internal static SelfTracing DeserializeSelfTracing(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OperationalMode? mode = default; + int? intervalSeconds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new OperationalMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("intervalSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + intervalSeconds = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SelfTracing(mode, intervalSeconds, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SelfTracing)} does not support writing '{options.Format}' format."); + } + } + + SelfTracing IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSelfTracing(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SelfTracing)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfTracing.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfTracing.cs new file mode 100644 index 000000000000..9fe7f6412260 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SelfTracing.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Diagnostic Self tracing properties. + public partial class SelfTracing + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SelfTracing() + { + } + + /// Initializes a new instance of . + /// The toggle to enable/disable self tracing. + /// The self tracing interval. + /// Keeps track of any properties unknown to the library. + internal SelfTracing(OperationalMode? mode, int? intervalSeconds, IDictionary serializedAdditionalRawData) + { + Mode = mode; + IntervalSeconds = intervalSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The toggle to enable/disable self tracing. + public OperationalMode? Mode { get; set; } + /// The self tracing interval. + public int? IntervalSeconds { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ServiceType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ServiceType.cs new file mode 100644 index 000000000000..34dec84c483d --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/ServiceType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Kubernetes Service Types supported by Listener. + public readonly partial struct ServiceType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ServiceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ClusterIPValue = "ClusterIp"; + private const string LoadBalancerValue = "LoadBalancer"; + private const string NodePortValue = "NodePort"; + + /// Cluster IP Service. + public static ServiceType ClusterIP { get; } = new ServiceType(ClusterIPValue); + /// Load Balancer Service. + public static ServiceType LoadBalancer { get; } = new ServiceType(LoadBalancerValue); + /// Node Port Service. + public static ServiceType NodePort { get; } = new ServiceType(NodePortValue); + /// Determines if two values are the same. + public static bool operator ==(ServiceType left, ServiceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ServiceType left, ServiceType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ServiceType(string value) => new ServiceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ServiceType other && Equals(other); + /// + public bool Equals(ServiceType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SourceSerializationFormat.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SourceSerializationFormat.cs new file mode 100644 index 000000000000..778296f426c1 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SourceSerializationFormat.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Serialization Format properties. + public readonly partial struct SourceSerializationFormat : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SourceSerializationFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string JsonValue = "Json"; + + /// JSON Format. + public static SourceSerializationFormat Json { get; } = new SourceSerializationFormat(JsonValue); + /// Determines if two values are the same. + public static bool operator ==(SourceSerializationFormat left, SourceSerializationFormat right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SourceSerializationFormat left, SourceSerializationFormat right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SourceSerializationFormat(string value) => new SourceSerializationFormat(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SourceSerializationFormat other && Equals(other); + /// + public bool Equals(SourceSerializationFormat 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceDefinitionMethod.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceDefinitionMethod.cs new file mode 100644 index 000000000000..b53f1eff7445 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceDefinitionMethod.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// StateStoreResourceDefinitionMethods methods allowed. + public readonly partial struct StateStoreResourceDefinitionMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StateStoreResourceDefinitionMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ReadValue = "Read"; + private const string WriteValue = "Write"; + private const string ReadWriteValue = "ReadWrite"; + + /// Get/KeyNotify from Store. + public static StateStoreResourceDefinitionMethod Read { get; } = new StateStoreResourceDefinitionMethod(ReadValue); + /// Set/Delete in Store. + public static StateStoreResourceDefinitionMethod Write { get; } = new StateStoreResourceDefinitionMethod(WriteValue); + /// Allowed all operations on Store - Get/KeyNotify/Set/Delete. + public static StateStoreResourceDefinitionMethod ReadWrite { get; } = new StateStoreResourceDefinitionMethod(ReadWriteValue); + /// Determines if two values are the same. + public static bool operator ==(StateStoreResourceDefinitionMethod left, StateStoreResourceDefinitionMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StateStoreResourceDefinitionMethod left, StateStoreResourceDefinitionMethod right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator StateStoreResourceDefinitionMethod(string value) => new StateStoreResourceDefinitionMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StateStoreResourceDefinitionMethod other && Equals(other); + /// + public bool Equals(StateStoreResourceDefinitionMethod 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceKeyType.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceKeyType.cs new file mode 100644 index 000000000000..cd212b6f043f --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceKeyType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// StateStoreResourceKeyTypes properties. + public readonly partial struct StateStoreResourceKeyType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StateStoreResourceKeyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PatternValue = "Pattern"; + private const string StringValue = "String"; + private const string BinaryValue = "Binary"; + + /// Key type - pattern. + public static StateStoreResourceKeyType Pattern { get; } = new StateStoreResourceKeyType(PatternValue); + /// Key type - string. + public static StateStoreResourceKeyType String { get; } = new StateStoreResourceKeyType(StringValue); + /// Key type - binary. + public static StateStoreResourceKeyType Binary { get; } = new StateStoreResourceKeyType(BinaryValue); + /// Determines if two values are the same. + public static bool operator ==(StateStoreResourceKeyType left, StateStoreResourceKeyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StateStoreResourceKeyType left, StateStoreResourceKeyType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator StateStoreResourceKeyType(string value) => new StateStoreResourceKeyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StateStoreResourceKeyType other && Equals(other); + /// + public bool Equals(StateStoreResourceKeyType 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceRule.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceRule.Serialization.cs new file mode 100644 index 000000000000..69941dd5a4a5 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceRule.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class StateStoreResourceRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StateStoreResourceRule)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("keyType"u8); + writer.WriteStringValue(KeyType.ToString()); + writer.WritePropertyName("keys"u8); + writer.WriteStartArray(); + foreach (var item in Keys) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + StateStoreResourceRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StateStoreResourceRule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStateStoreResourceRule(document.RootElement, options); + } + + internal static StateStoreResourceRule DeserializeStateStoreResourceRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + StateStoreResourceKeyType keyType = default; + IList keys = default; + StateStoreResourceDefinitionMethod method = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyType"u8)) + { + keyType = new StateStoreResourceKeyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("keys"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + keys = array; + continue; + } + if (property.NameEquals("method"u8)) + { + method = new StateStoreResourceDefinitionMethod(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StateStoreResourceRule(keyType, keys, method, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StateStoreResourceRule)} does not support writing '{options.Format}' format."); + } + } + + StateStoreResourceRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStateStoreResourceRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StateStoreResourceRule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceRule.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceRule.cs new file mode 100644 index 000000000000..9087cc273357 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/StateStoreResourceRule.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// State Store Resource Rule properties. + public partial class StateStoreResourceRule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Allowed keyTypes pattern, string, binary. The key type used for matching, for example pattern tries to match the key to a glob-style pattern and string checks key is equal to value provided in keys. + /// Give access to state store keys for the corresponding principals defined. When key type is pattern set glob-style pattern (e.g., '*', 'clients/*'). + /// Give access for `Read`, `Write` and `ReadWrite` access level. + /// is null. + public StateStoreResourceRule(StateStoreResourceKeyType keyType, IEnumerable keys, StateStoreResourceDefinitionMethod method) + { + Argument.AssertNotNull(keys, nameof(keys)); + + KeyType = keyType; + Keys = keys.ToList(); + Method = method; + } + + /// Initializes a new instance of . + /// Allowed keyTypes pattern, string, binary. The key type used for matching, for example pattern tries to match the key to a glob-style pattern and string checks key is equal to value provided in keys. + /// Give access to state store keys for the corresponding principals defined. When key type is pattern set glob-style pattern (e.g., '*', 'clients/*'). + /// Give access for `Read`, `Write` and `ReadWrite` access level. + /// Keeps track of any properties unknown to the library. + internal StateStoreResourceRule(StateStoreResourceKeyType keyType, IList keys, StateStoreResourceDefinitionMethod method, IDictionary serializedAdditionalRawData) + { + KeyType = keyType; + Keys = keys; + Method = method; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StateStoreResourceRule() + { + } + + /// Allowed keyTypes pattern, string, binary. The key type used for matching, for example pattern tries to match the key to a glob-style pattern and string checks key is equal to value provided in keys. + public StateStoreResourceKeyType KeyType { get; set; } + /// Give access to state store keys for the corresponding principals defined. When key type is pattern set glob-style pattern (e.g., '*', 'clients/*'). + public IList Keys { get; } + /// Give access for `Read`, `Write` and `ReadWrite` access level. + public StateStoreResourceDefinitionMethod Method { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberMessageDropStrategy.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberMessageDropStrategy.cs new file mode 100644 index 000000000000..6d418d59d48e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberMessageDropStrategy.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The enum defining strategies for dropping messages from the subscriber queue. + public readonly partial struct SubscriberMessageDropStrategy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SubscriberMessageDropStrategy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string DropOldestValue = "DropOldest"; + + /// Messages are never dropped. + public static SubscriberMessageDropStrategy None { get; } = new SubscriberMessageDropStrategy(NoneValue); + /// The oldest message is dropped. + public static SubscriberMessageDropStrategy DropOldest { get; } = new SubscriberMessageDropStrategy(DropOldestValue); + /// Determines if two values are the same. + public static bool operator ==(SubscriberMessageDropStrategy left, SubscriberMessageDropStrategy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SubscriberMessageDropStrategy left, SubscriberMessageDropStrategy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SubscriberMessageDropStrategy(string value) => new SubscriberMessageDropStrategy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SubscriberMessageDropStrategy other && Equals(other); + /// + public bool Equals(SubscriberMessageDropStrategy 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberQueueLimit.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberQueueLimit.Serialization.cs new file mode 100644 index 000000000000..956b422dd3f0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberQueueLimit.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class SubscriberQueueLimit : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriberQueueLimit)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Length)) + { + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length.Value); + } + if (Optional.IsDefined(Strategy)) + { + writer.WritePropertyName("strategy"u8); + writer.WriteStringValue(Strategy.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SubscriberQueueLimit IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SubscriberQueueLimit)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSubscriberQueueLimit(document.RootElement, options); + } + + internal static SubscriberQueueLimit DeserializeSubscriberQueueLimit(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? length = default; + SubscriberMessageDropStrategy? strategy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("length"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + length = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("strategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + strategy = new SubscriberMessageDropStrategy(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SubscriberQueueLimit(length, strategy, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SubscriberQueueLimit)} does not support writing '{options.Format}' format."); + } + } + + SubscriberQueueLimit IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSubscriberQueueLimit(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubscriberQueueLimit)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberQueueLimit.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberQueueLimit.cs new file mode 100644 index 000000000000..b397650aa427 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/SubscriberQueueLimit.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// The settings of Subscriber Queue Limit. + public partial class SubscriberQueueLimit + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SubscriberQueueLimit() + { + } + + /// Initializes a new instance of . + /// The maximum length of the queue before messages start getting dropped. + /// The strategy to use for dropping messages from the queue. + /// Keeps track of any properties unknown to the library. + internal SubscriberQueueLimit(long? length, SubscriberMessageDropStrategy? strategy, IDictionary serializedAdditionalRawData) + { + Length = length; + Strategy = strategy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The maximum length of the queue before messages start getting dropped. + public long? Length { get; set; } + /// The strategy to use for dropping messages from the queue. + public SubscriberMessageDropStrategy? Strategy { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethod.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethod.Serialization.cs new file mode 100644 index 000000000000..924fa582eea8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethod.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class TlsCertMethod : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TlsCertMethod)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.ToString()); + if (Optional.IsDefined(CertManagerCertificateSpec)) + { + writer.WritePropertyName("certManagerCertificateSpec"u8); + writer.WriteObjectValue(CertManagerCertificateSpec, options); + } + if (Optional.IsDefined(Manual)) + { + writer.WritePropertyName("manual"u8); + writer.WriteObjectValue(Manual, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TlsCertMethod IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TlsCertMethod)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTlsCertMethod(document.RootElement, options); + } + + internal static TlsCertMethod DeserializeTlsCertMethod(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TlsCertMethodMode mode = default; + CertManagerCertificateSpec certManagerCertificateSpec = default; + X509ManualCertificate manual = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + mode = new TlsCertMethodMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("certManagerCertificateSpec"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certManagerCertificateSpec = CertManagerCertificateSpec.DeserializeCertManagerCertificateSpec(property.Value, options); + continue; + } + if (property.NameEquals("manual"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + manual = X509ManualCertificate.DeserializeX509ManualCertificate(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TlsCertMethod(mode, certManagerCertificateSpec, manual, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TlsCertMethod)} does not support writing '{options.Format}' format."); + } + } + + TlsCertMethod IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTlsCertMethod(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TlsCertMethod)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethod.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethod.cs new file mode 100644 index 000000000000..2f0fc69c5814 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethod.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Collection of different TLS types, NOTE- Enum at a time only one of them needs to be supported. + public partial class TlsCertMethod + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Mode of TLS server certificate management. + public TlsCertMethod(TlsCertMethodMode mode) + { + Mode = mode; + } + + /// Initializes a new instance of . + /// Mode of TLS server certificate management. + /// Option 1 - Automatic TLS server certificate management with cert-manager. + /// Option 2 - Manual TLS server certificate management through a defined secret. + /// Keeps track of any properties unknown to the library. + internal TlsCertMethod(TlsCertMethodMode mode, CertManagerCertificateSpec certManagerCertificateSpec, X509ManualCertificate manual, IDictionary serializedAdditionalRawData) + { + Mode = mode; + CertManagerCertificateSpec = certManagerCertificateSpec; + Manual = manual; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TlsCertMethod() + { + } + + /// Mode of TLS server certificate management. + public TlsCertMethodMode Mode { get; set; } + /// Option 1 - Automatic TLS server certificate management with cert-manager. + public CertManagerCertificateSpec CertManagerCertificateSpec { get; set; } + /// Option 2 - Manual TLS server certificate management through a defined secret. + internal X509ManualCertificate Manual { get; set; } + /// Kubernetes secret containing an X.509 client certificate. This is a reference to the secret through an identifying name, not the secret itself. + public string ManualSecretRef + { + get => Manual is null ? default : Manual.SecretRef; + set => Manual = new X509ManualCertificate(value); + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethodMode.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethodMode.cs new file mode 100644 index 000000000000..38707ea3991e --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsCertMethodMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Authentication Mode. + public readonly partial struct TlsCertMethodMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TlsCertMethodMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutomaticValue = "Automatic"; + private const string ManualValue = "Manual"; + + /// Automatic TLS server certificate configuration. + public static TlsCertMethodMode Automatic { get; } = new TlsCertMethodMode(AutomaticValue); + /// Manual TLS server certificate configuration. + public static TlsCertMethodMode Manual { get; } = new TlsCertMethodMode(ManualValue); + /// Determines if two values are the same. + public static bool operator ==(TlsCertMethodMode left, TlsCertMethodMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TlsCertMethodMode left, TlsCertMethodMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TlsCertMethodMode(string value) => new TlsCertMethodMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TlsCertMethodMode other && Equals(other); + /// + public bool Equals(TlsCertMethodMode 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsProperties.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsProperties.Serialization.cs new file mode 100644 index 000000000000..0fc092a47382 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsProperties.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class TlsProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TlsProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsDefined(TrustedCaCertificateConfigMapRef)) + { + writer.WritePropertyName("trustedCaCertificateConfigMapRef"u8); + writer.WriteStringValue(TrustedCaCertificateConfigMapRef); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TlsProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TlsProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTlsProperties(document.RootElement, options); + } + + internal static TlsProperties DeserializeTlsProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OperationalMode? mode = default; + string trustedCaCertificateConfigMapRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new OperationalMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("trustedCaCertificateConfigMapRef"u8)) + { + trustedCaCertificateConfigMapRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TlsProperties(mode, trustedCaCertificateConfigMapRef, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TlsProperties)} does not support writing '{options.Format}' format."); + } + } + + TlsProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTlsProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TlsProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsProperties.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsProperties.cs new file mode 100644 index 000000000000..f0d2baf4ae46 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TlsProperties.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Tls properties. + public partial class TlsProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public TlsProperties() + { + } + + /// Initializes a new instance of . + /// Mode for TLS. + /// Trusted CA certificate config map. + /// Keeps track of any properties unknown to the library. + internal TlsProperties(OperationalMode? mode, string trustedCaCertificateConfigMapRef, IDictionary serializedAdditionalRawData) + { + Mode = mode; + TrustedCaCertificateConfigMapRef = trustedCaCertificateConfigMapRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Mode for TLS. + public OperationalMode? Mode { get; set; } + /// Trusted CA certificate config map. + public string TrustedCaCertificateConfigMapRef { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Traces.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Traces.Serialization.cs new file mode 100644 index 000000000000..381cc0e27ee5 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Traces.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.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class Traces : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Traces)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsDefined(CacheSizeMegabytes)) + { + writer.WritePropertyName("cacheSizeMegabytes"u8); + writer.WriteNumberValue(CacheSizeMegabytes.Value); + } + if (Optional.IsDefined(SelfTracing)) + { + writer.WritePropertyName("selfTracing"u8); + writer.WriteObjectValue(SelfTracing, options); + } + if (Optional.IsDefined(SpanChannelCapacity)) + { + writer.WritePropertyName("spanChannelCapacity"u8); + writer.WriteNumberValue(SpanChannelCapacity.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Traces IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Traces)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTraces(document.RootElement, options); + } + + internal static Traces DeserializeTraces(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OperationalMode? mode = default; + int? cacheSizeMegabytes = default; + SelfTracing selfTracing = default; + int? spanChannelCapacity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new OperationalMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("cacheSizeMegabytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cacheSizeMegabytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("selfTracing"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + selfTracing = SelfTracing.DeserializeSelfTracing(property.Value, options); + continue; + } + if (property.NameEquals("spanChannelCapacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + spanChannelCapacity = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Traces(mode, cacheSizeMegabytes, selfTracing, spanChannelCapacity, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Traces)} does not support writing '{options.Format}' format."); + } + } + + Traces IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTraces(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Traces)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Traces.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Traces.cs new file mode 100644 index 000000000000..388b68edfcef --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/Traces.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Broker Diagnostic Trace properties. + public partial class Traces + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Traces() + { + } + + /// Initializes a new instance of . + /// The toggle to enable/disable traces. + /// The cache size in megabytes. + /// The self tracing properties. + /// The span channel capacity. + /// Keeps track of any properties unknown to the library. + internal Traces(OperationalMode? mode, int? cacheSizeMegabytes, SelfTracing selfTracing, int? spanChannelCapacity, IDictionary serializedAdditionalRawData) + { + Mode = mode; + CacheSizeMegabytes = cacheSizeMegabytes; + SelfTracing = selfTracing; + SpanChannelCapacity = spanChannelCapacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The toggle to enable/disable traces. + public OperationalMode? Mode { get; set; } + /// The cache size in megabytes. + public int? CacheSizeMegabytes { get; set; } + /// The self tracing properties. + public SelfTracing SelfTracing { get; set; } + /// The span channel capacity. + public int? SpanChannelCapacity { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TransformationSerializationFormat.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TransformationSerializationFormat.cs new file mode 100644 index 000000000000..5448edc318bd --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/TransformationSerializationFormat.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// Transformation Format properties. + public readonly partial struct TransformationSerializationFormat : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TransformationSerializationFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DeltaValue = "Delta"; + private const string JsonValue = "Json"; + private const string ParquetValue = "Parquet"; + + /// Delta Format. + public static TransformationSerializationFormat Delta { get; } = new TransformationSerializationFormat(DeltaValue); + /// JSON Format. + public static TransformationSerializationFormat Json { get; } = new TransformationSerializationFormat(JsonValue); + /// Parquet Format. + public static TransformationSerializationFormat Parquet { get; } = new TransformationSerializationFormat(ParquetValue); + /// Determines if two values are the same. + public static bool operator ==(TransformationSerializationFormat left, TransformationSerializationFormat right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TransformationSerializationFormat left, TransformationSerializationFormat right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TransformationSerializationFormat(string value) => new TransformationSerializationFormat(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TransformationSerializationFormat other && Equals(other); + /// + public bool Equals(TransformationSerializationFormat 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/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimResourceRequirements.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimResourceRequirements.Serialization.cs new file mode 100644 index 000000000000..85facff585cf --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimResourceRequirements.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class VolumeClaimResourceRequirements : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeClaimResourceRequirements)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Limits)) + { + writer.WritePropertyName("limits"u8); + writer.WriteStartObject(); + foreach (var item in Limits) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Requests)) + { + writer.WritePropertyName("requests"u8); + writer.WriteStartObject(); + foreach (var item in Requests) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VolumeClaimResourceRequirements IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeClaimResourceRequirements)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeClaimResourceRequirements(document.RootElement, options); + } + + internal static VolumeClaimResourceRequirements DeserializeVolumeClaimResourceRequirements(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary limits = default; + IDictionary requests = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("limits"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + limits = dictionary; + continue; + } + if (property.NameEquals("requests"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + requests = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VolumeClaimResourceRequirements(limits ?? new ChangeTrackingDictionary(), requests ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VolumeClaimResourceRequirements)} does not support writing '{options.Format}' format."); + } + } + + VolumeClaimResourceRequirements IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeVolumeClaimResourceRequirements(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeClaimResourceRequirements)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimResourceRequirements.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimResourceRequirements.cs new file mode 100644 index 000000000000..d681ac7b0a98 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimResourceRequirements.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// VolumeClaimResourceRequirements properties. + public partial class VolumeClaimResourceRequirements + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public VolumeClaimResourceRequirements() + { + Limits = new ChangeTrackingDictionary(); + Requests = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/. + /// Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/. + /// Keeps track of any properties unknown to the library. + internal VolumeClaimResourceRequirements(IDictionary limits, IDictionary requests, IDictionary serializedAdditionalRawData) + { + Limits = limits; + Requests = requests; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Limits describes the maximum amount of compute resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/. + public IDictionary Limits { get; } + /// Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/. + public IDictionary Requests { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpec.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpec.Serialization.cs new file mode 100644 index 000000000000..87367f0f7f94 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpec.Serialization.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class VolumeClaimSpec : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeClaimSpec)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(VolumeName)) + { + writer.WritePropertyName("volumeName"u8); + writer.WriteStringValue(VolumeName); + } + if (Optional.IsDefined(VolumeMode)) + { + writer.WritePropertyName("volumeMode"u8); + writer.WriteStringValue(VolumeMode); + } + if (Optional.IsDefined(StorageClassName)) + { + writer.WritePropertyName("storageClassName"u8); + writer.WriteStringValue(StorageClassName); + } + if (Optional.IsCollectionDefined(AccessModes)) + { + writer.WritePropertyName("accessModes"u8); + writer.WriteStartArray(); + foreach (var item in AccessModes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DataSource)) + { + writer.WritePropertyName("dataSource"u8); + writer.WriteObjectValue(DataSource, options); + } + if (Optional.IsDefined(DataSourceRef)) + { + writer.WritePropertyName("dataSourceRef"u8); + writer.WriteObjectValue(DataSourceRef, options); + } + if (Optional.IsDefined(Resources)) + { + writer.WritePropertyName("resources"u8); + writer.WriteObjectValue(Resources, options); + } + if (Optional.IsDefined(Selector)) + { + writer.WritePropertyName("selector"u8); + writer.WriteObjectValue(Selector, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VolumeClaimSpec IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeClaimSpec)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeClaimSpec(document.RootElement, options); + } + + internal static VolumeClaimSpec DeserializeVolumeClaimSpec(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string volumeName = default; + string volumeMode = default; + string storageClassName = default; + IList accessModes = default; + LocalKubernetesReference dataSource = default; + KubernetesReference dataSourceRef = default; + VolumeClaimResourceRequirements resources = default; + VolumeClaimSpecSelector selector = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("volumeName"u8)) + { + volumeName = property.Value.GetString(); + continue; + } + if (property.NameEquals("volumeMode"u8)) + { + volumeMode = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageClassName"u8)) + { + storageClassName = property.Value.GetString(); + continue; + } + if (property.NameEquals("accessModes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + accessModes = array; + continue; + } + if (property.NameEquals("dataSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataSource = LocalKubernetesReference.DeserializeLocalKubernetesReference(property.Value, options); + continue; + } + if (property.NameEquals("dataSourceRef"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataSourceRef = KubernetesReference.DeserializeKubernetesReference(property.Value, options); + continue; + } + if (property.NameEquals("resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resources = VolumeClaimResourceRequirements.DeserializeVolumeClaimResourceRequirements(property.Value, options); + continue; + } + if (property.NameEquals("selector"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + selector = VolumeClaimSpecSelector.DeserializeVolumeClaimSpecSelector(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VolumeClaimSpec( + volumeName, + volumeMode, + storageClassName, + accessModes ?? new ChangeTrackingList(), + dataSource, + dataSourceRef, + resources, + selector, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VolumeClaimSpec)} does not support writing '{options.Format}' format."); + } + } + + VolumeClaimSpec IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeVolumeClaimSpec(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeClaimSpec)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpec.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpec.cs new file mode 100644 index 000000000000..19e9bce5dd85 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpec.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// VolumeClaimSpec properties. + public partial class VolumeClaimSpec + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public VolumeClaimSpec() + { + AccessModes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// VolumeName is the binding reference to the PersistentVolume backing this claim. + /// volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is a beta feature. + /// Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1. + /// AccessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1. + /// This field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. If the AnyVolumeDataSource feature gate is enabled, this field will always have the same contents as the DataSourceRef field. + /// Specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any local object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the DataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, both fields (DataSource and DataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. There are two important differences between DataSource and DataSourceRef: * While DataSource only allows two specific types of objects, DataSourceRef allows any non-core object, as well as PersistentVolumeClaim objects. * While DataSource ignores disallowed values (dropping them), DataSourceRef preserves all values, and generates an error if a disallowed value is specified. (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + /// Resources represents the minimum resources the volume should have. If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements that are lower than previous value but must still be higher than capacity recorded in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources. + /// A label query over volumes to consider for binding. + /// Keeps track of any properties unknown to the library. + internal VolumeClaimSpec(string volumeName, string volumeMode, string storageClassName, IList accessModes, LocalKubernetesReference dataSource, KubernetesReference dataSourceRef, VolumeClaimResourceRequirements resources, VolumeClaimSpecSelector selector, IDictionary serializedAdditionalRawData) + { + VolumeName = volumeName; + VolumeMode = volumeMode; + StorageClassName = storageClassName; + AccessModes = accessModes; + DataSource = dataSource; + DataSourceRef = dataSourceRef; + Resources = resources; + Selector = selector; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// VolumeName is the binding reference to the PersistentVolume backing this claim. + public string VolumeName { get; set; } + /// volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. This is a beta feature. + public string VolumeMode { get; set; } + /// Name of the StorageClass required by the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1. + public string StorageClassName { get; set; } + /// AccessModes contains the desired access modes the volume should have. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1. + public IList AccessModes { get; } + /// This field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. If the AnyVolumeDataSource feature gate is enabled, this field will always have the same contents as the DataSourceRef field. + public LocalKubernetesReference DataSource { get; set; } + /// Specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any local object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the DataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, both fields (DataSource and DataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. There are two important differences between DataSource and DataSourceRef: * While DataSource only allows two specific types of objects, DataSourceRef allows any non-core object, as well as PersistentVolumeClaim objects. * While DataSource ignores disallowed values (dropping them), DataSourceRef preserves all values, and generates an error if a disallowed value is specified. (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. + public KubernetesReference DataSourceRef { get; set; } + /// Resources represents the minimum resources the volume should have. If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements that are lower than previous value but must still be higher than capacity recorded in the status field of the claim. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources. + public VolumeClaimResourceRequirements Resources { get; set; } + /// A label query over volumes to consider for binding. + public VolumeClaimSpecSelector Selector { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelector.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelector.Serialization.cs new file mode 100644 index 000000000000..e4af32745130 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelector.Serialization.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class VolumeClaimSpecSelector : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeClaimSpecSelector)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(MatchExpressions)) + { + writer.WritePropertyName("matchExpressions"u8); + writer.WriteStartArray(); + foreach (var item in MatchExpressions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MatchLabels)) + { + writer.WritePropertyName("matchLabels"u8); + writer.WriteStartObject(); + foreach (var item in MatchLabels) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VolumeClaimSpecSelector IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeClaimSpecSelector)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeClaimSpecSelector(document.RootElement, options); + } + + internal static VolumeClaimSpecSelector DeserializeVolumeClaimSpecSelector(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList matchExpressions = default; + IDictionary matchLabels = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("matchExpressions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VolumeClaimSpecSelectorMatchExpressions.DeserializeVolumeClaimSpecSelectorMatchExpressions(item, options)); + } + matchExpressions = array; + continue; + } + if (property.NameEquals("matchLabels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + matchLabels = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VolumeClaimSpecSelector(matchExpressions ?? new ChangeTrackingList(), matchLabels ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VolumeClaimSpecSelector)} does not support writing '{options.Format}' format."); + } + } + + VolumeClaimSpecSelector IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeVolumeClaimSpecSelector(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeClaimSpecSelector)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelector.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelector.cs new file mode 100644 index 000000000000..b795f5039667 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelector.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// VolumeClaimSpecSelector properties. + public partial class VolumeClaimSpecSelector + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public VolumeClaimSpecSelector() + { + MatchExpressions = new ChangeTrackingList(); + MatchLabels = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// MatchExpressions is a list of label selector requirements. The requirements are ANDed. + /// MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + /// Keeps track of any properties unknown to the library. + internal VolumeClaimSpecSelector(IList matchExpressions, IDictionary matchLabels, IDictionary serializedAdditionalRawData) + { + MatchExpressions = matchExpressions; + MatchLabels = matchLabels; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// MatchExpressions is a list of label selector requirements. The requirements are ANDed. + public IList MatchExpressions { get; } + /// MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. + public IDictionary MatchLabels { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelectorMatchExpressions.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelectorMatchExpressions.Serialization.cs new file mode 100644 index 000000000000..a6ac4eba0940 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelectorMatchExpressions.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + public partial class VolumeClaimSpecSelectorMatchExpressions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeClaimSpecSelectorMatchExpressions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("operator"u8); + writer.WriteStringValue(Operator.ToString()); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VolumeClaimSpecSelectorMatchExpressions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeClaimSpecSelectorMatchExpressions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeClaimSpecSelectorMatchExpressions(document.RootElement, options); + } + + internal static VolumeClaimSpecSelectorMatchExpressions DeserializeVolumeClaimSpecSelectorMatchExpressions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + OperatorValue @operator = default; + IList values = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("operator"u8)) + { + @operator = new OperatorValue(property.Value.GetString()); + continue; + } + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + values = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VolumeClaimSpecSelectorMatchExpressions(key, @operator, values ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VolumeClaimSpecSelectorMatchExpressions)} does not support writing '{options.Format}' format."); + } + } + + VolumeClaimSpecSelectorMatchExpressions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeVolumeClaimSpecSelectorMatchExpressions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeClaimSpecSelectorMatchExpressions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelectorMatchExpressions.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelectorMatchExpressions.cs new file mode 100644 index 000000000000..29a3c93a77c4 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/VolumeClaimSpecSelectorMatchExpressions.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; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// VolumeClaimSpecSelectorMatchExpressions properties. + public partial class VolumeClaimSpecSelectorMatchExpressions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// key is the label key that the selector applies to. + /// operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + /// is null. + public VolumeClaimSpecSelectorMatchExpressions(string key, OperatorValue @operator) + { + Argument.AssertNotNull(key, nameof(key)); + + Key = key; + Operator = @operator; + Values = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// key is the label key that the selector applies to. + /// operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + /// values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + /// Keeps track of any properties unknown to the library. + internal VolumeClaimSpecSelectorMatchExpressions(string key, OperatorValue @operator, IList values, IDictionary serializedAdditionalRawData) + { + Key = key; + Operator = @operator; + Values = values; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal VolumeClaimSpecSelectorMatchExpressions() + { + } + + /// key is the label key that the selector applies to. + public string Key { get; set; } + /// operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. + public OperatorValue Operator { get; set; } + /// values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. + public IList Values { get; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/X509ManualCertificate.Serialization.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/X509ManualCertificate.Serialization.cs new file mode 100644 index 000000000000..67e99ebed383 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/X509ManualCertificate.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + internal partial class X509ManualCertificate : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(X509ManualCertificate)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("secretRef"u8); + writer.WriteStringValue(SecretRef); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + X509ManualCertificate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(X509ManualCertificate)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeX509ManualCertificate(document.RootElement, options); + } + + internal static X509ManualCertificate DeserializeX509ManualCertificate(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string secretRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretRef"u8)) + { + secretRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new X509ManualCertificate(secretRef, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(X509ManualCertificate)} does not support writing '{options.Format}' format."); + } + } + + X509ManualCertificate IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeX509ManualCertificate(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(X509ManualCertificate)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/X509ManualCertificate.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/X509ManualCertificate.cs new file mode 100644 index 000000000000..690b57bfbf1b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/Models/X509ManualCertificate.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.IoTOperations.Models +{ + /// X509 Certificate Authentication properties. + internal partial class X509ManualCertificate + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Kubernetes secret containing an X.509 client certificate. This is a reference to the secret through an identifying name, not the secret itself. + /// is null. + public X509ManualCertificate(string secretRef) + { + Argument.AssertNotNull(secretRef, nameof(secretRef)); + + SecretRef = secretRef; + } + + /// Initializes a new instance of . + /// Kubernetes secret containing an X.509 client certificate. This is a reference to the secret through an identifying name, not the secret itself. + /// Keeps track of any properties unknown to the library. + internal X509ManualCertificate(string secretRef, IDictionary serializedAdditionalRawData) + { + SecretRef = secretRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal X509ManualCertificate() + { + } + + /// Kubernetes secret containing an X.509 client certificate. This is a reference to the secret through an identifying name, not the secret itself. + public string SecretRef { get; set; } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/ProviderConstants.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..4b35d29c2858 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/ProviderConstants.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.IoTOperations +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerAuthenticationRestOperations.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerAuthenticationRestOperations.cs new file mode 100644 index 000000000000..8d9f654a6ba8 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerAuthenticationRestOperations.cs @@ -0,0 +1,549 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IoTOperations.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + internal partial class BrokerAuthenticationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of BrokerAuthenticationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public BrokerAuthenticationRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authenticationName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authentications/", false); + uri.AppendPath(authenticationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authenticationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authentications/", false); + uri.AppendPath(authenticationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a BrokerAuthenticationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authentication resource. + /// 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 instanceName, string brokerName, string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthenticationResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerAuthenticationResourceData.DeserializeBrokerAuthenticationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BrokerAuthenticationResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a BrokerAuthenticationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authentication resource. + /// 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 instanceName, string brokerName, string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthenticationResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerAuthenticationResourceData.DeserializeBrokerAuthenticationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BrokerAuthenticationResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authenticationName, BrokerAuthenticationResourceData 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authentications/", false); + uri.AppendPath(authenticationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authenticationName, BrokerAuthenticationResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authentications/", false); + uri.AppendPath(authenticationName, 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; + } + + /// Create a BrokerAuthenticationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authentication resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authenticationName, BrokerAuthenticationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName, 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); + } + } + + /// Create a BrokerAuthenticationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authentication resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authenticationName, BrokerAuthenticationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authenticationName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authentications/", false); + uri.AppendPath(authenticationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authenticationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authentications/", false); + uri.AppendPath(authenticationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a BrokerAuthenticationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authentication resource. + /// 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 instanceName, string brokerName, string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a BrokerAuthenticationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authentication resource. + /// 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 instanceName, string brokerName, string authenticationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authenticationName, nameof(authenticationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authenticationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authentications", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authentications", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BrokerAuthenticationResource resources by BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthenticationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerAuthenticationResourceListResult.DeserializeBrokerAuthenticationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BrokerAuthenticationResource resources by BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthenticationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerAuthenticationResourceListResult.DeserializeBrokerAuthenticationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BrokerAuthenticationResource resources by BrokerResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName, brokerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthenticationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerAuthenticationResourceListResult.DeserializeBrokerAuthenticationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BrokerAuthenticationResource resources by BrokerResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName, brokerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthenticationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerAuthenticationResourceListResult.DeserializeBrokerAuthenticationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerAuthorizationRestOperations.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerAuthorizationRestOperations.cs new file mode 100644 index 000000000000..c514cab57cd0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerAuthorizationRestOperations.cs @@ -0,0 +1,549 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IoTOperations.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + internal partial class BrokerAuthorizationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of BrokerAuthorizationRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public BrokerAuthorizationRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authorizationName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authorizationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a BrokerAuthorizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authorization resource. + /// 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 instanceName, string brokerName, string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthorizationResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerAuthorizationResourceData.DeserializeBrokerAuthorizationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BrokerAuthorizationResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a BrokerAuthorizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authorization resource. + /// 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 instanceName, string brokerName, string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthorizationResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerAuthorizationResourceData.DeserializeBrokerAuthorizationResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BrokerAuthorizationResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authorizationName, BrokerAuthorizationResourceData 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authorizationName, BrokerAuthorizationResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationName, 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; + } + + /// Create a BrokerAuthorizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authorization resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authorizationName, BrokerAuthorizationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName, 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); + } + } + + /// Create a BrokerAuthorizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authorization resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authorizationName, BrokerAuthorizationResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authorizationName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string authorizationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a BrokerAuthorizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authorization resource. + /// 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 instanceName, string brokerName, string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a BrokerAuthorizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker authorization resource. + /// 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 instanceName, string brokerName, string authorizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(authorizationName, nameof(authorizationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, brokerName, authorizationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authorizations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/authorizations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BrokerAuthorizationResource resources by BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthorizationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerAuthorizationResourceListResult.DeserializeBrokerAuthorizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BrokerAuthorizationResource resources by BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthorizationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerAuthorizationResourceListResult.DeserializeBrokerAuthorizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BrokerAuthorizationResource resources by BrokerResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName, brokerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthorizationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerAuthorizationResourceListResult.DeserializeBrokerAuthorizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BrokerAuthorizationResource resources by BrokerResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName, brokerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerAuthorizationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerAuthorizationResourceListResult.DeserializeBrokerAuthorizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerListenerRestOperations.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerListenerRestOperations.cs new file mode 100644 index 000000000000..09b58ad43689 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerListenerRestOperations.cs @@ -0,0 +1,549 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IoTOperations.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + internal partial class BrokerListenerRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of BrokerListenerRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public BrokerListenerRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string listenerName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/listeners/", false); + uri.AppendPath(listenerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string listenerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/listeners/", false); + uri.AppendPath(listenerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a BrokerListenerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker listener resource. + /// 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 instanceName, string brokerName, string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerListenerResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerListenerResourceData.DeserializeBrokerListenerResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BrokerListenerResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a BrokerListenerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker listener resource. + /// 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 instanceName, string brokerName, string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerListenerResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerListenerResourceData.DeserializeBrokerListenerResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BrokerListenerResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string listenerName, BrokerListenerResourceData 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/listeners/", false); + uri.AppendPath(listenerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string listenerName, BrokerListenerResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/listeners/", false); + uri.AppendPath(listenerName, 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; + } + + /// Create a BrokerListenerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker listener resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string listenerName, BrokerListenerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName, 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); + } + } + + /// Create a BrokerListenerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker listener resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string listenerName, BrokerListenerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string listenerName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/listeners/", false); + uri.AppendPath(listenerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, string listenerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/listeners/", false); + uri.AppendPath(listenerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a BrokerListenerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker listener resource. + /// 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 instanceName, string brokerName, string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a BrokerListenerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Name of Instance broker listener resource. + /// 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 instanceName, string brokerName, string listenerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNullOrEmpty(listenerName, nameof(listenerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, brokerName, listenerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/listeners", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendPath("/listeners", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BrokerListenerResource resources by BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerListenerResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerListenerResourceListResult.DeserializeBrokerListenerResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BrokerListenerResource resources by BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerListenerResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerListenerResourceListResult.DeserializeBrokerListenerResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BrokerListenerResource resources by BrokerResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName, brokerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerListenerResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerListenerResourceListResult.DeserializeBrokerListenerResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BrokerListenerResource resources by BrokerResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName, brokerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerListenerResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerListenerResourceListResult.DeserializeBrokerListenerResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerRestOperations.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerRestOperations.cs new file mode 100644 index 000000000000..e036c05ae979 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/BrokerRestOperations.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IoTOperations.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + internal partial class BrokerRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of BrokerRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public BrokerRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// 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 instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerResourceData.DeserializeBrokerResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BrokerResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// 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 instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerResourceData.DeserializeBrokerResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((BrokerResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, BrokerResourceData 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, BrokerResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, 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; + } + + /// Create a BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, BrokerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, brokerName, 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); + } + } + + /// Create a BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string instanceName, string brokerName, BrokerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, brokerName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string instanceName, string brokerName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers/", false); + uri.AppendPath(brokerName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// 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 instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a BrokerResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of broker. + /// 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 instanceName, string brokerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(brokerName, nameof(brokerName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, brokerName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string instanceName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string instanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/brokers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BrokerResource resources by InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerResourceListResult.DeserializeBrokerResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BrokerResource resources by InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerResourceListResult.DeserializeBrokerResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string instanceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string instanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List BrokerResource resources by InstanceResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + BrokerResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = BrokerResourceListResult.DeserializeBrokerResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List BrokerResource resources by InstanceResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + BrokerResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = BrokerResourceListResult.DeserializeBrokerResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowEndpointRestOperations.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowEndpointRestOperations.cs new file mode 100644 index 000000000000..3387cbdb08b1 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowEndpointRestOperations.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IoTOperations.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + internal partial class DataflowEndpointRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DataflowEndpointRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public DataflowEndpointRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowEndpointName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowEndpoints/", false); + uri.AppendPath(dataflowEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowEndpointName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowEndpoints/", false); + uri.AppendPath(dataflowEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a DataflowEndpointResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowEndpoint resource. + /// 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 instanceName, string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataflowEndpointResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataflowEndpointResourceData.DeserializeDataflowEndpointResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataflowEndpointResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a DataflowEndpointResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowEndpoint resource. + /// 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 instanceName, string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataflowEndpointResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataflowEndpointResourceData.DeserializeDataflowEndpointResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataflowEndpointResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowEndpointName, DataflowEndpointResourceData 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowEndpoints/", false); + uri.AppendPath(dataflowEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowEndpointName, DataflowEndpointResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowEndpoints/", false); + uri.AppendPath(dataflowEndpointName, 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; + } + + /// Create a DataflowEndpointResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowEndpoint resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string instanceName, string dataflowEndpointName, DataflowEndpointResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName, 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); + } + } + + /// Create a DataflowEndpointResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowEndpoint resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string instanceName, string dataflowEndpointName, DataflowEndpointResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowEndpointName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowEndpoints/", false); + uri.AppendPath(dataflowEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowEndpointName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowEndpoints/", false); + uri.AppendPath(dataflowEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a DataflowEndpointResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowEndpoint resource. + /// 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 instanceName, string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a DataflowEndpointResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowEndpoint resource. + /// 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 instanceName, string dataflowEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowEndpointName, nameof(dataflowEndpointName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, dataflowEndpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string instanceName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowEndpoints", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string instanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowEndpoints", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DataflowEndpointResource resources by InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataflowEndpointResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataflowEndpointResourceListResult.DeserializeDataflowEndpointResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DataflowEndpointResource resources by InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataflowEndpointResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataflowEndpointResourceListResult.DeserializeDataflowEndpointResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string instanceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string instanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DataflowEndpointResource resources by InstanceResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataflowEndpointResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataflowEndpointResourceListResult.DeserializeDataflowEndpointResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DataflowEndpointResource resources by InstanceResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataflowEndpointResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataflowEndpointResourceListResult.DeserializeDataflowEndpointResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowProfileRestOperations.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowProfileRestOperations.cs new file mode 100644 index 000000000000..4c390f5687bc --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowProfileRestOperations.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IoTOperations.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + internal partial class DataflowProfileRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DataflowProfileRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public DataflowProfileRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a DataflowProfileResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// 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 instanceName, string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataflowProfileResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataflowProfileResourceData.DeserializeDataflowProfileResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataflowProfileResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a DataflowProfileResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// 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 instanceName, string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataflowProfileResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataflowProfileResourceData.DeserializeDataflowProfileResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataflowProfileResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, DataflowProfileResourceData 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, DataflowProfileResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, 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; + } + + /// Create a DataflowProfileResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, DataflowProfileResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, 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); + } + } + + /// Create a DataflowProfileResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, DataflowProfileResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a DataflowProfileResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// 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 instanceName, string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a DataflowProfileResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// 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 instanceName, string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string instanceName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string instanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DataflowProfileResource resources by InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataflowProfileResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataflowProfileResourceListResult.DeserializeDataflowProfileResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DataflowProfileResource resources by InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataflowProfileResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataflowProfileResourceListResult.DeserializeDataflowProfileResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string instanceName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string instanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DataflowProfileResource resources by InstanceResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataflowProfileResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataflowProfileResourceListResult.DeserializeDataflowProfileResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DataflowProfileResource resources by InstanceResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataflowProfileResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataflowProfileResourceListResult.DeserializeDataflowProfileResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowRestOperations.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowRestOperations.cs new file mode 100644 index 000000000000..d5e5e743414b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/DataflowRestOperations.cs @@ -0,0 +1,549 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IoTOperations.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + internal partial class DataflowRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DataflowRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public DataflowRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, string dataflowName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendPath("/dataflows/", false); + uri.AppendPath(dataflowName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, string dataflowName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendPath("/dataflows/", false); + uri.AppendPath(dataflowName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a DataflowResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// Name of Instance dataflowProfile dataflow resource. + /// 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 instanceName, string dataflowProfileName, string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataflowResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataflowResourceData.DeserializeDataflowResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataflowResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a DataflowResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// Name of Instance dataflowProfile dataflow resource. + /// 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 instanceName, string dataflowProfileName, string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataflowResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataflowResourceData.DeserializeDataflowResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataflowResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, string dataflowName, DataflowResourceData 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendPath("/dataflows/", false); + uri.AppendPath(dataflowName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, string dataflowName, DataflowResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendPath("/dataflows/", false); + uri.AppendPath(dataflowName, 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; + } + + /// Create a DataflowResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// Name of Instance dataflowProfile dataflow resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, string dataflowName, DataflowResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName, 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); + } + } + + /// Create a DataflowResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// Name of Instance dataflowProfile dataflow resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, string dataflowName, DataflowResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, string dataflowName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendPath("/dataflows/", false); + uri.AppendPath(dataflowName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, string dataflowName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendPath("/dataflows/", false); + uri.AppendPath(dataflowName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a DataflowResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// Name of Instance dataflowProfile dataflow resource. + /// 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 instanceName, string dataflowProfileName, string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a DataflowResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// Name of Instance dataflowProfile dataflow resource. + /// 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 instanceName, string dataflowProfileName, string dataflowName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + Argument.AssertNotNullOrEmpty(dataflowName, nameof(dataflowName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName, dataflowName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendPath("/dataflows", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendPath("/dataflowProfiles/", false); + uri.AppendPath(dataflowProfileName, true); + uri.AppendPath("/dataflows", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DataflowResource resources by DataflowProfileResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataflowResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataflowResourceListResult.DeserializeDataflowResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DataflowResource resources by DataflowProfileResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataflowResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataflowResourceListResult.DeserializeDataflowResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List DataflowResource resources by DataflowProfileResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataflowResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataflowResourceListResult.DeserializeDataflowResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List DataflowResource resources by DataflowProfileResource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Name of Instance dataflowProfile resource. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string instanceName, string dataflowProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNullOrEmpty(dataflowProfileName, nameof(dataflowProfileName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, instanceName, dataflowProfileName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataflowResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataflowResourceListResult.DeserializeDataflowResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/InstanceRestOperations.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/InstanceRestOperations.cs new file mode 100644 index 000000000000..0a7f2fbce169 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Generated/RestOperations/InstanceRestOperations.cs @@ -0,0 +1,731 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.IoTOperations.Models; + +namespace Azure.ResourceManager.IoTOperations +{ + internal partial class InstanceRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of InstanceRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public InstanceRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string instanceName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// 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 instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InstanceResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InstanceResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// 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 instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InstanceResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InstanceResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string instanceName, InstanceResourceData 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string instanceName, InstanceResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, 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; + } + + /// Create a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string instanceName, InstanceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, 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); + } + } + + /// Create a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string instanceName, InstanceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instanceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string instanceName, InstanceResourcePatch 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string instanceName, InstanceResourcePatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The resource properties to be updated. + /// 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 instanceName, InstanceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, instanceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InstanceResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// The resource properties to be updated. + /// 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 instanceName, InstanceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, instanceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InstanceResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string instanceName) + { + 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.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string instanceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances/", false); + uri.AppendPath(instanceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// 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 instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of instance. + /// 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 instanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instanceName, nameof(instanceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + 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.IoTOperations/instances", 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(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List InstanceResource resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InstanceResource resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// 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) + { + 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: + { + InstanceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(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.IoTOperations/instances", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.IoTOperations/instances", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List InstanceResource resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InstanceResource resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(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) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List InstanceResource resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InstanceResource resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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) + { + 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: + { + InstanceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(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(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List InstanceResource resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InstanceResource resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Properties/AssemblyInfo.cs b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..67978c3ac1f0 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.IoTOperations.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/tests/Azure.ResourceManager.IoTOperations.Tests.csproj b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/tests/Azure.ResourceManager.IoTOperations.Tests.csproj new file mode 100644 index 000000000000..583882085427 --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/tests/Azure.ResourceManager.IoTOperations.Tests.csproj @@ -0,0 +1,12 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + diff --git a/sdk/iotoperations/Azure.ResourceManager.IoTOperations/tsp-location.yaml b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/tsp-location.yaml new file mode 100644 index 000000000000..68bf6302877b --- /dev/null +++ b/sdk/iotoperations/Azure.ResourceManager.IoTOperations/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/iotoperations/IoTOperations.Management +commit: 1eb05b957a92bd56ef0ae770335b5813338984c2 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/iotoperations/ci.mgmt.yml b/sdk/iotoperations/ci.mgmt.yml new file mode 100644 index 000000000000..0df387fcb663 --- /dev/null +++ b/sdk/iotoperations/ci.mgmt.yml @@ -0,0 +1,36 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iotoperations/ci.mgmt.yml + - sdk/iotoperations/Azure.ResourceManager.IoTOperations/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iotoperations/ci.mgmt.yml + - sdk/iotoperations/Azure.ResourceManager.IoTOperations/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: iotoperations + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.IoTOperations + safeName: AzureResourceManagerIoTOperations diff --git a/sdk/keyvault/ci.mgmt.yml b/sdk/keyvault/ci.mgmt.yml index b48c2f8d4ff4..3075cea61b8c 100644 --- a/sdk/keyvault/ci.mgmt.yml +++ b/sdk/keyvault/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/keyvault/ci.mgmt.yml - sdk/keyvault/Azure.ResourceManager.KeyVault/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/keyvault/ci.mgmt.yml + - sdk/keyvault/Azure.ResourceManager.KeyVault/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/keyvault/ci.mgmt.yml + - sdk/keyvault/Azure.ResourceManager.KeyVault/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/keyvault/ci.mgmt.yml + - sdk/keyvault/Azure.ResourceManager.KeyVault/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/kubernetesconfiguration/ci.mgmt.yml b/sdk/kubernetesconfiguration/ci.mgmt.yml index 4249ef57fa6e..41a222a7b54b 100644 --- a/sdk/kubernetesconfiguration/ci.mgmt.yml +++ b/sdk/kubernetesconfiguration/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/kubernetesconfiguration/ci.mgmt.yml - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesconfiguration/ci.mgmt.yml + - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesconfiguration/ci.mgmt.yml + - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesconfiguration/ci.mgmt.yml + - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/kusto/ci.mgmt.yml b/sdk/kusto/ci.mgmt.yml index 374cf1f0cb81..4d89347fe566 100644 --- a/sdk/kusto/ci.mgmt.yml +++ b/sdk/kusto/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/kusto/ci.mgmt.yml - sdk/kusto/Azure.ResourceManager.Kusto/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kusto/ci.mgmt.yml + - sdk/kusto/Azure.ResourceManager.Kusto/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kusto/ci.mgmt.yml + - sdk/kusto/Azure.ResourceManager.Kusto/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kusto/ci.mgmt.yml + - sdk/kusto/Azure.ResourceManager.Kusto/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/labservices/ci.mgmt.yml b/sdk/labservices/ci.mgmt.yml index 48f80379ab14..73bca6a9d3a3 100644 --- a/sdk/labservices/ci.mgmt.yml +++ b/sdk/labservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/labservices/ci.mgmt.yml - sdk/labservices/Azure.ResourceManager.LabServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/labservices/ci.mgmt.yml + - sdk/labservices/Azure.ResourceManager.LabServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/labservices/ci.mgmt.yml + - sdk/labservices/Azure.ResourceManager.LabServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/labservices/ci.mgmt.yml + - sdk/labservices/Azure.ResourceManager.LabServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/loadtestservice/ci.mgmt.yml b/sdk/loadtestservice/ci.mgmt.yml index 4e3d99d42979..0128bbbdd45b 100644 --- a/sdk/loadtestservice/ci.mgmt.yml +++ b/sdk/loadtestservice/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/loadtestservice/ci.mgmt.yml - sdk/loadtestservice/Azure.ResourceManager.LoadTesting/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/loadtestservice/ci.mgmt.yml + - sdk/loadtestservice/Azure.ResourceManager.LoadTesting/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/loadtestservice/ci.mgmt.yml + - sdk/loadtestservice/Azure.ResourceManager.LoadTesting/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/loadtestservice/ci.mgmt.yml + - sdk/loadtestservice/Azure.ResourceManager.LoadTesting/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/logic/ci.mgmt.yml b/sdk/logic/ci.mgmt.yml index b89b224082ee..42cb9c85c76f 100644 --- a/sdk/logic/ci.mgmt.yml +++ b/sdk/logic/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/logic/ci.mgmt.yml - sdk/logic/Azure.ResourceManager.Logic/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/logic/ci.mgmt.yml + - sdk/logic/Azure.ResourceManager.Logic/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/logic/ci.mgmt.yml + - sdk/logic/Azure.ResourceManager.Logic/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/logic/ci.mgmt.yml + - sdk/logic/Azure.ResourceManager.Logic/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/machinelearningcompute/ci.mgmt.yml b/sdk/machinelearningcompute/ci.mgmt.yml index 9ea84fdf4d15..7e95031d2fb3 100644 --- a/sdk/machinelearningcompute/ci.mgmt.yml +++ b/sdk/machinelearningcompute/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/machinelearningcompute/ci.mgmt.yml - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/machinelearningcompute/ci.mgmt.yml + - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/machinelearningcompute/ci.mgmt.yml + - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/machinelearningcompute/ci.mgmt.yml + - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/machinelearningservices/ci.mgmt.yml b/sdk/machinelearningservices/ci.mgmt.yml index 457299ab20b9..d85218bf7e84 100644 --- a/sdk/machinelearningservices/ci.mgmt.yml +++ b/sdk/machinelearningservices/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,42 @@ pr: - sdk/machinelearningservices/ci.mgmt.yml - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/machinelearningservices/ci.mgmt.yml + - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/machinelearningservices/ci.mgmt.yml + - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/machinelearningservices/ci.mgmt.yml + - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/maintenance/ci.mgmt.yml b/sdk/maintenance/ci.mgmt.yml index c49cc1565d6d..fc7577a12db6 100644 --- a/sdk/maintenance/ci.mgmt.yml +++ b/sdk/maintenance/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/maintenance/ci.mgmt.yml - sdk/maintenance/Azure.ResourceManager.Maintenance/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maintenance/ci.mgmt.yml + - sdk/maintenance/Azure.ResourceManager.Maintenance/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maintenance/ci.mgmt.yml + - sdk/maintenance/Azure.ResourceManager.Maintenance/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maintenance/ci.mgmt.yml + - sdk/maintenance/Azure.ResourceManager.Maintenance/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managednetwork/ci.mgmt.yml b/sdk/managednetwork/ci.mgmt.yml index 431d66d1245b..5a930824e75e 100644 --- a/sdk/managednetwork/ci.mgmt.yml +++ b/sdk/managednetwork/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/managednetwork/ci.mgmt.yml - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managednetwork/ci.mgmt.yml + - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managednetwork/ci.mgmt.yml + - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managednetwork/ci.mgmt.yml + - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managednetworkfabric/ci.mgmt.yml b/sdk/managednetworkfabric/ci.mgmt.yml index aa6b571b04e2..2f0ada505697 100644 --- a/sdk/managednetworkfabric/ci.mgmt.yml +++ b/sdk/managednetworkfabric/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/managednetworkfabric/ci.mgmt.yml - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managednetworkfabric/ci.mgmt.yml + - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managednetworkfabric/ci.mgmt.yml + - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managednetworkfabric/ci.mgmt.yml + - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managedserviceidentity/ci.mgmt.yml b/sdk/managedserviceidentity/ci.mgmt.yml index c8f3a187f918..72cac6fc8159 100644 --- a/sdk/managedserviceidentity/ci.mgmt.yml +++ b/sdk/managedserviceidentity/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/managedserviceidentity/ci.mgmt.yml - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedserviceidentity/ci.mgmt.yml + - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedserviceidentity/ci.mgmt.yml + - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedserviceidentity/ci.mgmt.yml + - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managedservices/ci.mgmt.yml b/sdk/managedservices/ci.mgmt.yml index d6c0ccd16eef..e9a9f4ad121c 100644 --- a/sdk/managedservices/ci.mgmt.yml +++ b/sdk/managedservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/managedservices/ci.mgmt.yml - sdk/managedservices/Azure.ResourceManager.ManagedServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedservices/ci.mgmt.yml + - sdk/managedservices/Azure.ResourceManager.ManagedServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedservices/ci.mgmt.yml + - sdk/managedservices/Azure.ResourceManager.ManagedServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedservices/ci.mgmt.yml + - sdk/managedservices/Azure.ResourceManager.ManagedServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managementpartner/ci.mgmt.yml b/sdk/managementpartner/ci.mgmt.yml index 52c8e762088e..db3e1b9419a2 100644 --- a/sdk/managementpartner/ci.mgmt.yml +++ b/sdk/managementpartner/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/managementpartner/ci.mgmt.yml - sdk/managementpartner/Azure.ResourceManager.ManagementPartner/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managementpartner/ci.mgmt.yml + - sdk/managementpartner/Azure.ResourceManager.ManagementPartner/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managementpartner/ci.mgmt.yml + - sdk/managementpartner/Azure.ResourceManager.ManagementPartner/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managementpartner/ci.mgmt.yml + - sdk/managementpartner/Azure.ResourceManager.ManagementPartner/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/maps/ci.mgmt.yml b/sdk/maps/ci.mgmt.yml index 2f16079cab2e..233562389b2b 100644 --- a/sdk/maps/ci.mgmt.yml +++ b/sdk/maps/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/maps/ci.mgmt.yml - sdk/maps/Azure.ResourceManager.Maps/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maps/ci.mgmt.yml + - sdk/maps/Azure.ResourceManager.Maps/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maps/ci.mgmt.yml + - sdk/maps/Azure.ResourceManager.Maps/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maps/ci.mgmt.yml + - sdk/maps/Azure.ResourceManager.Maps/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/marketplace/ci.mgmt.yml b/sdk/marketplace/ci.mgmt.yml index e6574bdb3039..263d2db0c168 100644 --- a/sdk/marketplace/ci.mgmt.yml +++ b/sdk/marketplace/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/marketplace/ci.mgmt.yml - sdk/marketplace/Azure.ResourceManager.Marketplace/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/marketplace/ci.mgmt.yml + - sdk/marketplace/Azure.ResourceManager.Marketplace/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/marketplace/ci.mgmt.yml + - sdk/marketplace/Azure.ResourceManager.Marketplace/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/marketplace/ci.mgmt.yml + - sdk/marketplace/Azure.ResourceManager.Marketplace/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/marketplaceordering/ci.mgmt.yml b/sdk/marketplaceordering/ci.mgmt.yml index 2b1f8721902e..328d4a74d355 100644 --- a/sdk/marketplaceordering/ci.mgmt.yml +++ b/sdk/marketplaceordering/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/marketplaceordering/ci.mgmt.yml - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/marketplaceordering/ci.mgmt.yml + - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/marketplaceordering/ci.mgmt.yml + - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/marketplaceordering/ci.mgmt.yml + - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mediaservices/ci.mgmt.yml b/sdk/mediaservices/ci.mgmt.yml index 55656f3ae48b..f8f926d112a4 100644 --- a/sdk/mediaservices/ci.mgmt.yml +++ b/sdk/mediaservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/mediaservices/ci.mgmt.yml - sdk/mediaservices/Azure.ResourceManager.Media/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mediaservices/ci.mgmt.yml + - sdk/mediaservices/Azure.ResourceManager.Media/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mediaservices/ci.mgmt.yml + - sdk/mediaservices/Azure.ResourceManager.Media/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mediaservices/ci.mgmt.yml + - sdk/mediaservices/Azure.ResourceManager.Media/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/migrationdiscoverysap/ci.mgmt.yml b/sdk/migrationdiscoverysap/ci.mgmt.yml index f5eb354d28e7..e4bb27ebe603 100644 --- a/sdk/migrationdiscoverysap/ci.mgmt.yml +++ b/sdk/migrationdiscoverysap/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/migrationdiscoverysap/ci.mgmt.yml - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/migrationdiscoverysap/ci.mgmt.yml + - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/migrationdiscoverysap/ci.mgmt.yml + - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/migrationdiscoverysap/ci.mgmt.yml + - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mixedreality/ci.mgmt.yml b/sdk/mixedreality/ci.mgmt.yml index 81c0c2744232..0846323551bb 100644 --- a/sdk/mixedreality/ci.mgmt.yml +++ b/sdk/mixedreality/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,42 @@ pr: - sdk/mixedreality/ci.mgmt.yml - sdk/mixedreality/Azure.ResourceManager.MixedReality/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mixedreality/ci.mgmt.yml + - sdk/mixedreality/Azure.ResourceManager.MixedReality/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mixedreality/ci.mgmt.yml + - sdk/mixedreality/Azure.ResourceManager.MixedReality/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mixedreality/ci.mgmt.yml + - sdk/mixedreality/Azure.ResourceManager.MixedReality/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mobilenetwork/ci.mgmt.yml b/sdk/mobilenetwork/ci.mgmt.yml index 8a68e6749ba7..0204d41de0b8 100644 --- a/sdk/mobilenetwork/ci.mgmt.yml +++ b/sdk/mobilenetwork/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/mobilenetwork/ci.mgmt.yml - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mobilenetwork/ci.mgmt.yml + - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mobilenetwork/ci.mgmt.yml + - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mobilenetwork/ci.mgmt.yml + - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mongocluster/ci.mgmt.yml b/sdk/mongocluster/ci.mgmt.yml index d2eafe7877dd..4528876764aa 100644 --- a/sdk/mongocluster/ci.mgmt.yml +++ b/sdk/mongocluster/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/mongocluster/ci.mgmt.yml - sdk/mongocluster/Azure.ResourceManager.MongoCluster/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mongocluster/ci.mgmt.yml + - sdk/mongocluster/Azure.ResourceManager.MongoCluster/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mongocluster/ci.mgmt.yml + - sdk/mongocluster/Azure.ResourceManager.MongoCluster/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mongocluster/ci.mgmt.yml + - sdk/mongocluster/Azure.ResourceManager.MongoCluster/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/monitor/ci.mgmt.yml b/sdk/monitor/ci.mgmt.yml index 8beeded4e3b9..ff438ce541dc 100644 --- a/sdk/monitor/ci.mgmt.yml +++ b/sdk/monitor/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,42 @@ pr: - sdk/monitor/ci.mgmt.yml - sdk/monitor/Azure.ResourceManager.Monitor/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/monitor/ci.mgmt.yml + - sdk/monitor/Azure.ResourceManager.Monitor/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/monitor/ci.mgmt.yml + - sdk/monitor/Azure.ResourceManager.Monitor/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/monitor/ci.mgmt.yml + - sdk/monitor/Azure.ResourceManager.Monitor/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mysql/ci.mgmt.yml b/sdk/mysql/ci.mgmt.yml index e1521b4ed568..d69fadd4d847 100644 --- a/sdk/mysql/ci.mgmt.yml +++ b/sdk/mysql/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/mysql/ci.mgmt.yml - sdk/mysql/Azure.ResourceManager.MySql/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mysql/ci.mgmt.yml + - sdk/mysql/Azure.ResourceManager.MySql/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mysql/ci.mgmt.yml + - sdk/mysql/Azure.ResourceManager.MySql/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mysql/ci.mgmt.yml + - sdk/mysql/Azure.ResourceManager.MySql/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/neonpostgres/ci.mgmt.yml b/sdk/neonpostgres/ci.mgmt.yml index 72d449fc7a16..ffdc185519e8 100644 --- a/sdk/neonpostgres/ci.mgmt.yml +++ b/sdk/neonpostgres/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/neonpostgres/ci.mgmt.yml - sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/neonpostgres/ci.mgmt.yml + - sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/neonpostgres/ci.mgmt.yml + - sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/neonpostgres/ci.mgmt.yml + - sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/netapp/ci.mgmt.yml b/sdk/netapp/ci.mgmt.yml index 05a683e910f5..18a09e7b9109 100644 --- a/sdk/netapp/ci.mgmt.yml +++ b/sdk/netapp/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/netapp/ci.mgmt.yml - sdk/netapp/Azure.ResourceManager.NetApp/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/netapp/ci.mgmt.yml + - sdk/netapp/Azure.ResourceManager.NetApp/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/netapp/ci.mgmt.yml + - sdk/netapp/Azure.ResourceManager.NetApp/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/netapp/ci.mgmt.yml + - sdk/netapp/Azure.ResourceManager.NetApp/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/network/ci.mgmt.yml b/sdk/network/ci.mgmt.yml index edf77de02a49..389cb50de79b 100644 --- a/sdk/network/ci.mgmt.yml +++ b/sdk/network/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/network/ci.mgmt.yml - sdk/network/Azure.ResourceManager.Network/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/network/ci.mgmt.yml + - sdk/network/Azure.ResourceManager.Network/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/network/ci.mgmt.yml + - sdk/network/Azure.ResourceManager.Network/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/network/ci.mgmt.yml + - sdk/network/Azure.ResourceManager.Network/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/networkanalytics/ci.mgmt.yml b/sdk/networkanalytics/ci.mgmt.yml index 9ece072ce867..34f3d4689160 100644 --- a/sdk/networkanalytics/ci.mgmt.yml +++ b/sdk/networkanalytics/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/networkanalytics/ci.mgmt.yml - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkanalytics/ci.mgmt.yml + - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkanalytics/ci.mgmt.yml + - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkanalytics/ci.mgmt.yml + - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/networkcloud/ci.mgmt.yml b/sdk/networkcloud/ci.mgmt.yml index f6c281af22a9..f82f477b6903 100644 --- a/sdk/networkcloud/ci.mgmt.yml +++ b/sdk/networkcloud/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/networkcloud/ci.mgmt.yml - sdk/networkcloud/Azure.ResourceManager.NetworkCloud/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkcloud/ci.mgmt.yml + - sdk/networkcloud/Azure.ResourceManager.NetworkCloud/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkcloud/ci.mgmt.yml + - sdk/networkcloud/Azure.ResourceManager.NetworkCloud/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkcloud/ci.mgmt.yml + - sdk/networkcloud/Azure.ResourceManager.NetworkCloud/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/networkfunction/ci.mgmt.yml b/sdk/networkfunction/ci.mgmt.yml index a3c743ef532a..9b9d338ba848 100644 --- a/sdk/networkfunction/ci.mgmt.yml +++ b/sdk/networkfunction/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/networkfunction/ci.mgmt.yml - sdk/networkfunction/Azure.ResourceManager.NetworkFunction/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkfunction/ci.mgmt.yml + - sdk/networkfunction/Azure.ResourceManager.NetworkFunction/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkfunction/ci.mgmt.yml + - sdk/networkfunction/Azure.ResourceManager.NetworkFunction/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkfunction/ci.mgmt.yml + - sdk/networkfunction/Azure.ResourceManager.NetworkFunction/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/newrelicobservability/ci.mgmt.yml b/sdk/newrelicobservability/ci.mgmt.yml index d01ef74cd749..7f163c9d7e14 100644 --- a/sdk/newrelicobservability/ci.mgmt.yml +++ b/sdk/newrelicobservability/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/newrelicobservability/ci.mgmt.yml - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/newrelicobservability/ci.mgmt.yml + - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/newrelicobservability/ci.mgmt.yml + - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/newrelicobservability/ci.mgmt.yml + - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/nginx/ci.mgmt.yml b/sdk/nginx/ci.mgmt.yml index f701b26a561a..baf015360d03 100644 --- a/sdk/nginx/ci.mgmt.yml +++ b/sdk/nginx/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/nginx/ci.mgmt.yml - sdk/nginx/Azure.ResourceManager.Nginx/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/nginx/ci.mgmt.yml + - sdk/nginx/Azure.ResourceManager.Nginx/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/nginx/ci.mgmt.yml + - sdk/nginx/Azure.ResourceManager.Nginx/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/nginx/ci.mgmt.yml + - sdk/nginx/Azure.ResourceManager.Nginx/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/notificationhubs/ci.mgmt.yml b/sdk/notificationhubs/ci.mgmt.yml index ba5a26631dd4..b82eff70c0f6 100644 --- a/sdk/notificationhubs/ci.mgmt.yml +++ b/sdk/notificationhubs/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/notificationhubs/ci.mgmt.yml - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/notificationhubs/ci.mgmt.yml + - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/notificationhubs/ci.mgmt.yml + - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/notificationhubs/ci.mgmt.yml + - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/openenergyplatform/ci.mgmt.yml b/sdk/openenergyplatform/ci.mgmt.yml index 1ab74128b4db..7d99f1ca7108 100644 --- a/sdk/openenergyplatform/ci.mgmt.yml +++ b/sdk/openenergyplatform/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/openenergyplatform/ci.mgmt.yml - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/openenergyplatform/ci.mgmt.yml + - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/openenergyplatform/ci.mgmt.yml + - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/openenergyplatform/ci.mgmt.yml + - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/operationalinsights/ci.mgmt.yml b/sdk/operationalinsights/ci.mgmt.yml index d4c3b61dac40..b975786616bf 100644 --- a/sdk/operationalinsights/ci.mgmt.yml +++ b/sdk/operationalinsights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/operationalinsights/ci.mgmt.yml - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/operationalinsights/ci.mgmt.yml + - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/operationalinsights/ci.mgmt.yml + - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/operationalinsights/ci.mgmt.yml + - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/oracle/ci.mgmt.yml b/sdk/oracle/ci.mgmt.yml index ccbd7c096ecf..ba23c5093514 100644 --- a/sdk/oracle/ci.mgmt.yml +++ b/sdk/oracle/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/oracle/ci.mgmt.yml - sdk/oracle/Azure.ResourceManager.OracleDatabase/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/oracle/ci.mgmt.yml + - sdk/oracle/Azure.ResourceManager.OracleDatabase/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/oracle/ci.mgmt.yml + - sdk/oracle/Azure.ResourceManager.OracleDatabase/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/oracle/ci.mgmt.yml + - sdk/oracle/Azure.ResourceManager.OracleDatabase/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/orbital/ci.mgmt.yml b/sdk/orbital/ci.mgmt.yml index 701576d2fa62..03e456bc38dc 100644 --- a/sdk/orbital/ci.mgmt.yml +++ b/sdk/orbital/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/orbital/ci.mgmt.yml - sdk/orbital/Azure.ResourceManager.Orbital/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/orbital/ci.mgmt.yml + - sdk/orbital/Azure.ResourceManager.Orbital/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/orbital/ci.mgmt.yml + - sdk/orbital/Azure.ResourceManager.Orbital/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/orbital/ci.mgmt.yml + - sdk/orbital/Azure.ResourceManager.Orbital/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/paloaltonetworks.ngfw/ci.mgmt.yml b/sdk/paloaltonetworks.ngfw/ci.mgmt.yml index 77dca48de9ef..6341d4d6d982 100644 --- a/sdk/paloaltonetworks.ngfw/ci.mgmt.yml +++ b/sdk/paloaltonetworks.ngfw/ci.mgmt.yml @@ -1,4 +1,5 @@ trigger: none + pr: branches: include: @@ -11,6 +12,42 @@ pr: - sdk/paloaltonetworks.ngfw/ci.mgmt.yml - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/paloaltonetworks.ngfw/ci.mgmt.yml + - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/paloaltonetworks.ngfw/ci.mgmt.yml + - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/paloaltonetworks.ngfw/ci.mgmt.yml + - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/peering/ci.mgmt.yml b/sdk/peering/ci.mgmt.yml index 4d3d67e73949..257b8094e9c6 100644 --- a/sdk/peering/ci.mgmt.yml +++ b/sdk/peering/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/peering/ci.mgmt.yml - sdk/peering/Azure.ResourceManager.Peering/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/peering/ci.mgmt.yml + - sdk/peering/Azure.ResourceManager.Peering/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/peering/ci.mgmt.yml + - sdk/peering/Azure.ResourceManager.Peering/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/peering/ci.mgmt.yml + - sdk/peering/Azure.ResourceManager.Peering/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/api/Azure.ResourceManager.PlaywrightTesting.net8.0.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/api/Azure.ResourceManager.PlaywrightTesting.net8.0.cs index 2f7e09b19bef..8bae8011d56b 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/api/Azure.ResourceManager.PlaywrightTesting.net8.0.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/api/Azure.ResourceManager.PlaywrightTesting.net8.0.cs @@ -3,16 +3,16 @@ namespace Azure.ResourceManager.PlaywrightTesting public partial class PlaywrightTestingAccountCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected PlaywrightTestingAccountCollection() { } - public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Exists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string accountName, Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string accountName, Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } @@ -20,11 +20,7 @@ protected PlaywrightTestingAccountCollection() { } public partial class PlaywrightTestingAccountData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public PlaywrightTestingAccountData(Azure.Core.AzureLocation location) { } - public System.Uri DashboardUri { get { throw null; } } - public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? RegionalAffinity { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? Reporting { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? ScalableExecution { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountProperties Properties { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData 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) { } @@ -32,6 +28,47 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 PlaywrightTestingAccountQuotaCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected PlaywrightTestingAccountQuotaCollection() { } + public virtual Azure.Response Exists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class PlaywrightTestingAccountQuotaData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingAccountQuotaData() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaData 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.PlaywrightTesting.PlaywrightTestingAccountQuotaData 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 PlaywrightTestingAccountQuotaResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected PlaywrightTestingAccountQuotaResource() { } + public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaData 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.PlaywrightTesting.PlaywrightTestingAccountQuotaData 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 PlaywrightTestingAccountResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public static readonly Azure.Core.ResourceType ResourceType; @@ -40,11 +77,14 @@ protected PlaywrightTestingAccountResource() { } public virtual bool HasData { get { throw null; } } public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { throw null; } public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaCollection GetAllPlaywrightTestingAccountQuota() { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPlaywrightTestingAccountQuota(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPlaywrightTestingAccountQuotaAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -59,37 +99,39 @@ protected PlaywrightTestingAccountResource() { } } public static partial class PlaywrightTestingExtensions { - public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location) { throw null; } - public static Azure.Response GetPlaywrightTestingAccount(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetPlaywrightTestingAccountAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response CheckPlaywrightTestingNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CheckPlaywrightTestingNameAvailabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location) { throw null; } + public static Azure.Response GetPlaywrightTestingAccount(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetPlaywrightTestingAccountAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaResource GetPlaywrightTestingAccountQuotaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountResource GetPlaywrightTestingAccountResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountCollection GetPlaywrightTestingAccounts(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetPlaywrightTestingAccounts(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetPlaywrightTestingAccountsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetPlaywrightTestingQuota(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetPlaywrightTestingQuotaAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetPlaywrightTestingQuota(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetPlaywrightTestingQuotaAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaResource GetPlaywrightTestingQuotaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } public partial class PlaywrightTestingQuotaCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected PlaywrightTestingQuotaCollection() { } - public virtual Azure.Response Exists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } } public partial class PlaywrightTestingQuotaData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public PlaywrightTestingQuotaData() { } - public Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialProperties FreeTrial { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } + internal PlaywrightTestingQuotaData() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties Properties { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData 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) { } @@ -103,7 +145,7 @@ public partial class PlaywrightTestingQuotaResource : Azure.ResourceManager.ArmR protected PlaywrightTestingQuotaResource() { } public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -118,99 +160,224 @@ namespace Azure.ResourceManager.PlaywrightTesting.Mocking public partial class MockablePlaywrightTestingArmClient : Azure.ResourceManager.ArmResource { protected MockablePlaywrightTestingArmClient() { } + public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaResource GetPlaywrightTestingAccountQuotaResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountResource GetPlaywrightTestingAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaResource GetPlaywrightTestingQuotaResource(Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MockablePlaywrightTestingResourceGroupResource : Azure.ResourceManager.ArmResource { protected MockablePlaywrightTestingResourceGroupResource() { } - public virtual Azure.Response GetPlaywrightTestingAccount(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetPlaywrightTestingAccountAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPlaywrightTestingAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPlaywrightTestingAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountCollection GetPlaywrightTestingAccounts() { throw null; } } public partial class MockablePlaywrightTestingSubscriptionResource : Azure.ResourceManager.ArmResource { protected MockablePlaywrightTestingSubscriptionResource() { } - public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response CheckPlaywrightTestingNameAvailability(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPlaywrightTestingNameAvailabilityAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(string location) { throw null; } public virtual Azure.Pageable GetPlaywrightTestingAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetPlaywrightTestingAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetPlaywrightTestingQuota(Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetPlaywrightTestingQuotaAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPlaywrightTestingQuota(string location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPlaywrightTestingQuotaAsync(string location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.PlaywrightTesting.Models { + public partial class AccountUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AccountUpdateProperties() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? LocalAuth { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? RegionalAffinity { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? Reporting { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? ScalableExecution { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.AccountUpdateProperties 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.PlaywrightTesting.Models.AccountUpdateProperties 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 ArmPlaywrightTestingModelFactory { - public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData PlaywrightTestingAccountData(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), System.Uri dashboardUri = null, Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? regionalAffinity = default(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? scalableExecution = default(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? reporting = default(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } - public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData PlaywrightTestingQuotaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialProperties freeTrial = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData PlaywrightTestingAccountData(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.PlaywrightTesting.Models.PlaywrightTestingAccountProperties properties = null) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties PlaywrightTestingAccountFreeTrialProperties(System.DateTimeOffset createdOn = default(System.DateTimeOffset), System.DateTimeOffset expiryOn = default(System.DateTimeOffset), int allocatedValue = 0, int usedValue = 0, float percentageUsed = 0f) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountProperties PlaywrightTestingAccountProperties(System.Uri dashboardUri = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? regionalAffinity = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? scalableExecution = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? reporting = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? localAuth = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaData PlaywrightTestingAccountQuotaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties properties = null) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties PlaywrightTestingAccountQuotaProperties(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties freeTrial = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties PlaywrightTestingFreeTrialProperties(string accountId = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState state = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityResult PlaywrightTestingNameAvailabilityResult(bool? isNameAvailable = default(bool?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason? reason = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason?), string message = null) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData PlaywrightTestingQuotaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties properties = null) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties PlaywrightTestingQuotaProperties(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties freeTrial = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType? offeringType = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } + } + public partial class PlaywrightTestingAccountFreeTrialProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingAccountFreeTrialProperties() { } + public int AllocatedValue { get { throw null; } } + public System.DateTimeOffset CreatedOn { get { throw null; } } + public System.DateTimeOffset ExpiryOn { get { throw null; } } + public float PercentageUsed { get { throw null; } } + public int UsedValue { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties 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.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties 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 PlaywrightTestingAccountPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PlaywrightTestingAccountPatch() { } + public Azure.ResourceManager.PlaywrightTesting.Models.AccountUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountPatch 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.PlaywrightTesting.Models.PlaywrightTestingAccountPatch 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 PlaywrightTestingAccountProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PlaywrightTestingAccountProperties() { } + public System.Uri DashboardUri { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? LocalAuth { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? RegionalAffinity { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? Reporting { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? ScalableExecution { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountProperties 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.PlaywrightTesting.Models.PlaywrightTestingAccountProperties 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 PlaywrightTestingAccountQuotaProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingAccountQuotaProperties() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties FreeTrial { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties 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.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties 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 EnablementStatus : System.IEquatable + public readonly partial struct PlaywrightTestingEnablementStatus : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public EnablementStatus(string value) { throw null; } - public static Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus Disabled { get { throw null; } } - public static Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus Enabled { get { throw null; } } - public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus other) { throw null; } + public PlaywrightTestingEnablementStatus(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus Disabled { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus 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.PlaywrightTesting.Models.EnablementStatus left, Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus right) { throw null; } - public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus left, Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus right) { throw null; } + public static bool operator ==(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus right) { throw null; } public override string ToString() { throw null; } } - public partial class FreeTrialProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class PlaywrightTestingFreeTrialProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public FreeTrialProperties(string accountId, System.DateTimeOffset createdOn, System.DateTimeOffset expiryOn, int allocatedValue, int usedValue, decimal percentageUsed, Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState state) { } + internal PlaywrightTestingFreeTrialProperties() { } public string AccountId { get { throw null; } } - public int AllocatedValue { get { throw null; } } - public System.DateTimeOffset CreatedOn { get { throw null; } } - public System.DateTimeOffset ExpiryOn { get { throw null; } } - public decimal PercentageUsed { get { throw null; } } - public Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState State { get { throw null; } } - public int UsedValue { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState State { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialProperties 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.PlaywrightTesting.Models.FreeTrialProperties 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; } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties 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.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties 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 FreeTrialState : System.IEquatable + public readonly partial struct PlaywrightTestingFreeTrialState : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public FreeTrialState(string value) { throw null; } - public static Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState Active { get { throw null; } } - public static Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState Expired { get { throw null; } } - public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState other) { throw null; } + public PlaywrightTestingFreeTrialState(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState Active { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState Expired { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState NotEligible { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState NotRegistered { get { throw null; } } + public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState 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.PlaywrightTesting.Models.FreeTrialState left, Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState right) { throw null; } - public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState left, Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState right) { throw null; } + public static bool operator ==(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState right) { throw null; } + public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState right) { throw null; } public override string ToString() { throw null; } } - public partial class PlaywrightTestingAccountPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class PlaywrightTestingNameAvailabilityContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public PlaywrightTestingAccountPatch() { } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? RegionalAffinity { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? Reporting { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? ScalableExecution { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public PlaywrightTestingNameAvailabilityContent() { } + public string Name { get { throw null; } set { } } + public string Type { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountPatch 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.PlaywrightTesting.Models.PlaywrightTestingAccountPatch 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; } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent 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.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent 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 PlaywrightTestingNameAvailabilityResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingNameAvailabilityResult() { } + public bool? IsNameAvailable { get { throw null; } } + public string Message { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason? Reason { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityResult 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.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityResult 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 PlaywrightTestingNameUnavailableReason : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PlaywrightTestingNameUnavailableReason(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason AlreadyExists { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason Invalid { get { throw null; } } + public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason 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.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason right) { throw null; } + public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PlaywrightTestingOfferingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PlaywrightTestingOfferingType(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType GeneralAvailability { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType NotApplicable { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType PrivatePreview { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType PublicPreview { get { throw null; } } + public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType 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.PlaywrightTesting.Models.PlaywrightTestingOfferingType left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType right) { throw null; } + public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType right) { throw null; } + public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct PlaywrightTestingProvisioningState : System.IEquatable @@ -220,6 +387,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public PlaywrightTestingProvisioningState(string value) { throw null; } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Accepted { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Creating { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Deleting { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Failed { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Succeeded { get { throw null; } } @@ -239,6 +407,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer private readonly object _dummy; private readonly int _dummyPrimitive; public PlaywrightTestingQuotaName(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName Reporting { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName ScalableExecution { get { throw null; } } public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -250,4 +419,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName right) { throw null; } public override string ToString() { throw null; } } + public partial class PlaywrightTestingQuotaProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingQuotaProperties() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties FreeTrial { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType? OfferingType { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties 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.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties 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/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/api/Azure.ResourceManager.PlaywrightTesting.netstandard2.0.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/api/Azure.ResourceManager.PlaywrightTesting.netstandard2.0.cs index 2f7e09b19bef..8bae8011d56b 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/api/Azure.ResourceManager.PlaywrightTesting.netstandard2.0.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/api/Azure.ResourceManager.PlaywrightTesting.netstandard2.0.cs @@ -3,16 +3,16 @@ namespace Azure.ResourceManager.PlaywrightTesting public partial class PlaywrightTestingAccountCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected PlaywrightTestingAccountCollection() { } - public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Exists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string accountName, Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string accountName, Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } @@ -20,11 +20,7 @@ protected PlaywrightTestingAccountCollection() { } public partial class PlaywrightTestingAccountData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public PlaywrightTestingAccountData(Azure.Core.AzureLocation location) { } - public System.Uri DashboardUri { get { throw null; } } - public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? RegionalAffinity { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? Reporting { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? ScalableExecution { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountProperties Properties { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData 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) { } @@ -32,6 +28,47 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write 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 PlaywrightTestingAccountQuotaCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected PlaywrightTestingAccountQuotaCollection() { } + public virtual Azure.Response Exists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class PlaywrightTestingAccountQuotaData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingAccountQuotaData() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaData 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.PlaywrightTesting.PlaywrightTestingAccountQuotaData 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 PlaywrightTestingAccountQuotaResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected PlaywrightTestingAccountQuotaResource() { } + public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaData 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.PlaywrightTesting.PlaywrightTestingAccountQuotaData 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 PlaywrightTestingAccountResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public static readonly Azure.Core.ResourceType ResourceType; @@ -40,11 +77,14 @@ protected PlaywrightTestingAccountResource() { } public virtual bool HasData { get { throw null; } } public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { throw null; } public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaCollection GetAllPlaywrightTestingAccountQuota() { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPlaywrightTestingAccountQuota(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPlaywrightTestingAccountQuotaAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -59,37 +99,39 @@ protected PlaywrightTestingAccountResource() { } } public static partial class PlaywrightTestingExtensions { - public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location) { throw null; } - public static Azure.Response GetPlaywrightTestingAccount(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetPlaywrightTestingAccountAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response CheckPlaywrightTestingNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CheckPlaywrightTestingNameAvailabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location) { throw null; } + public static Azure.Response GetPlaywrightTestingAccount(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetPlaywrightTestingAccountAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaResource GetPlaywrightTestingAccountQuotaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountResource GetPlaywrightTestingAccountResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountCollection GetPlaywrightTestingAccounts(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetPlaywrightTestingAccounts(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetPlaywrightTestingAccountsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetPlaywrightTestingQuota(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetPlaywrightTestingQuotaAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetPlaywrightTestingQuota(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetPlaywrightTestingQuotaAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaResource GetPlaywrightTestingQuotaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } public partial class PlaywrightTestingQuotaCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected PlaywrightTestingQuotaCollection() { } - public virtual Azure.Response Exists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } } public partial class PlaywrightTestingQuotaData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public PlaywrightTestingQuotaData() { } - public Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialProperties FreeTrial { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } + internal PlaywrightTestingQuotaData() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties Properties { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData 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) { } @@ -103,7 +145,7 @@ public partial class PlaywrightTestingQuotaResource : Azure.ResourceManager.ArmR protected PlaywrightTestingQuotaResource() { } public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -118,99 +160,224 @@ namespace Azure.ResourceManager.PlaywrightTesting.Mocking public partial class MockablePlaywrightTestingArmClient : Azure.ResourceManager.ArmResource { protected MockablePlaywrightTestingArmClient() { } + public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaResource GetPlaywrightTestingAccountQuotaResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountResource GetPlaywrightTestingAccountResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaResource GetPlaywrightTestingQuotaResource(Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MockablePlaywrightTestingResourceGroupResource : Azure.ResourceManager.ArmResource { protected MockablePlaywrightTestingResourceGroupResource() { } - public virtual Azure.Response GetPlaywrightTestingAccount(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetPlaywrightTestingAccountAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPlaywrightTestingAccount(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPlaywrightTestingAccountAsync(string accountName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountCollection GetPlaywrightTestingAccounts() { throw null; } } public partial class MockablePlaywrightTestingSubscriptionResource : Azure.ResourceManager.ArmResource { protected MockablePlaywrightTestingSubscriptionResource() { } - public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(Azure.Core.AzureLocation location) { throw null; } + public virtual Azure.Response CheckPlaywrightTestingNameAvailability(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckPlaywrightTestingNameAvailabilityAsync(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(string location) { throw null; } public virtual Azure.Pageable GetPlaywrightTestingAccounts(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetPlaywrightTestingAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetPlaywrightTestingQuota(Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetPlaywrightTestingQuotaAsync(Azure.Core.AzureLocation location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetPlaywrightTestingQuota(string location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetPlaywrightTestingQuotaAsync(string location, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName quotaName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.PlaywrightTesting.Models { + public partial class AccountUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AccountUpdateProperties() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? LocalAuth { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? RegionalAffinity { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? Reporting { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? ScalableExecution { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.AccountUpdateProperties 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.PlaywrightTesting.Models.AccountUpdateProperties 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 ArmPlaywrightTestingModelFactory { - public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData PlaywrightTestingAccountData(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), System.Uri dashboardUri = null, Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? regionalAffinity = default(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? scalableExecution = default(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? reporting = default(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } - public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData PlaywrightTestingQuotaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialProperties freeTrial = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountData PlaywrightTestingAccountData(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.PlaywrightTesting.Models.PlaywrightTestingAccountProperties properties = null) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties PlaywrightTestingAccountFreeTrialProperties(System.DateTimeOffset createdOn = default(System.DateTimeOffset), System.DateTimeOffset expiryOn = default(System.DateTimeOffset), int allocatedValue = 0, int usedValue = 0, float percentageUsed = 0f) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountProperties PlaywrightTestingAccountProperties(System.Uri dashboardUri = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? regionalAffinity = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? scalableExecution = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? reporting = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? localAuth = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingAccountQuotaData PlaywrightTestingAccountQuotaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties properties = null) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties PlaywrightTestingAccountQuotaProperties(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties freeTrial = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties PlaywrightTestingFreeTrialProperties(string accountId = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState state = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState)) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityResult PlaywrightTestingNameAvailabilityResult(bool? isNameAvailable = default(bool?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason? reason = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason?), string message = null) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.PlaywrightTestingQuotaData PlaywrightTestingQuotaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties properties = null) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties PlaywrightTestingQuotaProperties(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties freeTrial = null, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType? offeringType = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType?), Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? provisioningState = default(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState?)) { throw null; } + } + public partial class PlaywrightTestingAccountFreeTrialProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingAccountFreeTrialProperties() { } + public int AllocatedValue { get { throw null; } } + public System.DateTimeOffset CreatedOn { get { throw null; } } + public System.DateTimeOffset ExpiryOn { get { throw null; } } + public float PercentageUsed { get { throw null; } } + public int UsedValue { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties 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.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties 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 PlaywrightTestingAccountPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PlaywrightTestingAccountPatch() { } + public Azure.ResourceManager.PlaywrightTesting.Models.AccountUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountPatch 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.PlaywrightTesting.Models.PlaywrightTestingAccountPatch 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 PlaywrightTestingAccountProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PlaywrightTestingAccountProperties() { } + public System.Uri DashboardUri { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? LocalAuth { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? RegionalAffinity { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? Reporting { get { throw null; } set { } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus? ScalableExecution { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountProperties 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.PlaywrightTesting.Models.PlaywrightTestingAccountProperties 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 PlaywrightTestingAccountQuotaProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingAccountQuotaProperties() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountFreeTrialProperties FreeTrial { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties 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.PlaywrightTesting.Models.PlaywrightTestingAccountQuotaProperties 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 EnablementStatus : System.IEquatable + public readonly partial struct PlaywrightTestingEnablementStatus : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public EnablementStatus(string value) { throw null; } - public static Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus Disabled { get { throw null; } } - public static Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus Enabled { get { throw null; } } - public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus other) { throw null; } + public PlaywrightTestingEnablementStatus(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus Disabled { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus 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.PlaywrightTesting.Models.EnablementStatus left, Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus right) { throw null; } - public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus left, Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus right) { throw null; } + public static bool operator ==(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingEnablementStatus right) { throw null; } public override string ToString() { throw null; } } - public partial class FreeTrialProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class PlaywrightTestingFreeTrialProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public FreeTrialProperties(string accountId, System.DateTimeOffset createdOn, System.DateTimeOffset expiryOn, int allocatedValue, int usedValue, decimal percentageUsed, Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState state) { } + internal PlaywrightTestingFreeTrialProperties() { } public string AccountId { get { throw null; } } - public int AllocatedValue { get { throw null; } } - public System.DateTimeOffset CreatedOn { get { throw null; } } - public System.DateTimeOffset ExpiryOn { get { throw null; } } - public decimal PercentageUsed { get { throw null; } } - public Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState State { get { throw null; } } - public int UsedValue { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState State { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialProperties 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.PlaywrightTesting.Models.FreeTrialProperties 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; } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties 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.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties 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 FreeTrialState : System.IEquatable + public readonly partial struct PlaywrightTestingFreeTrialState : System.IEquatable { private readonly object _dummy; private readonly int _dummyPrimitive; - public FreeTrialState(string value) { throw null; } - public static Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState Active { get { throw null; } } - public static Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState Expired { get { throw null; } } - public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState other) { throw null; } + public PlaywrightTestingFreeTrialState(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState Active { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState Expired { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState NotEligible { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState NotRegistered { get { throw null; } } + public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState 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.PlaywrightTesting.Models.FreeTrialState left, Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState right) { throw null; } - public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState left, Azure.ResourceManager.PlaywrightTesting.Models.FreeTrialState right) { throw null; } + public static bool operator ==(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState right) { throw null; } + public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialState right) { throw null; } public override string ToString() { throw null; } } - public partial class PlaywrightTestingAccountPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class PlaywrightTestingNameAvailabilityContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public PlaywrightTestingAccountPatch() { } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? RegionalAffinity { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? Reporting { get { throw null; } set { } } - public Azure.ResourceManager.PlaywrightTesting.Models.EnablementStatus? ScalableExecution { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public PlaywrightTestingNameAvailabilityContent() { } + public string Name { get { throw null; } set { } } + public string Type { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingAccountPatch 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.PlaywrightTesting.Models.PlaywrightTestingAccountPatch 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; } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent 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.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityContent 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 PlaywrightTestingNameAvailabilityResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingNameAvailabilityResult() { } + public bool? IsNameAvailable { get { throw null; } } + public string Message { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason? Reason { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityResult 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.PlaywrightTesting.Models.PlaywrightTestingNameAvailabilityResult 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 PlaywrightTestingNameUnavailableReason : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PlaywrightTestingNameUnavailableReason(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason AlreadyExists { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason Invalid { get { throw null; } } + public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason 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.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason right) { throw null; } + public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingNameUnavailableReason right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PlaywrightTestingOfferingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PlaywrightTestingOfferingType(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType GeneralAvailability { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType NotApplicable { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType PrivatePreview { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType PublicPreview { get { throw null; } } + public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType 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.PlaywrightTesting.Models.PlaywrightTestingOfferingType left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType right) { throw null; } + public static implicit operator Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType right) { throw null; } + public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct PlaywrightTestingProvisioningState : System.IEquatable @@ -220,6 +387,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public PlaywrightTestingProvisioningState(string value) { throw null; } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Accepted { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Creating { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Deleting { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Failed { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState Succeeded { get { throw null; } } @@ -239,6 +407,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer private readonly object _dummy; private readonly int _dummyPrimitive; public PlaywrightTestingQuotaName(string value) { throw null; } + public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName Reporting { get { throw null; } } public static Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName ScalableExecution { get { throw null; } } public bool Equals(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] @@ -250,4 +419,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName left, Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaName right) { throw null; } public override string ToString() { throw null; } } + public partial class PlaywrightTestingQuotaProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PlaywrightTestingQuotaProperties() { } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingFreeTrialProperties FreeTrial { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingOfferingType? OfferingType { get { throw null; } } + public Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties 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.PlaywrightTesting.Models.PlaywrightTestingQuotaProperties 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/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountCollection.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountCollection.cs index b8d39fa59011..aebbdedd932e 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountCollection.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountCollection.cs @@ -21,8 +21,8 @@ public partial class Sample_PlaywrightTestingAccountCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_AccountsCreateOrUpdate() { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_CreateOrUpdate.json - // this example is just showing the usage of "Accounts_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-12-01/Accounts_CreateOrUpdate.json + // this example is just showing the usage of "Account_CreateOrUpdate" 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(); @@ -40,16 +40,19 @@ public async Task CreateOrUpdate_AccountsCreateOrUpdate() PlaywrightTestingAccountCollection collection = resourceGroupResource.GetPlaywrightTestingAccounts(); // invoke the operation - string name = "myPlaywrightAccount"; + string accountName = "myPlaywrightAccount"; PlaywrightTestingAccountData data = new PlaywrightTestingAccountData(new AzureLocation("westus")) { - RegionalAffinity = EnablementStatus.Enabled, + Properties = new PlaywrightTestingAccountProperties + { + RegionalAffinity = PlaywrightTestingEnablementStatus.Enabled, + }, Tags = { ["Team"] = "Dev Exp" }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, data); PlaywrightTestingAccountResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well @@ -58,143 +61,5 @@ public async Task CreateOrUpdate_AccountsCreateOrUpdate() // 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_AccountsGet() - { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json - // this example is just showing the usage of "Accounts_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 = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "dummyrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this PlaywrightTestingAccountResource - PlaywrightTestingAccountCollection collection = resourceGroupResource.GetPlaywrightTestingAccounts(); - - // invoke the operation - string name = "myPlaywrightAccount"; - PlaywrightTestingAccountResource result = await collection.GetAsync(name); - - // 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 - PlaywrightTestingAccountData 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_AccountsListByResourceGroup() - { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListByResourceGroup.json - // this example is just showing the usage of "Accounts_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "dummyrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this PlaywrightTestingAccountResource - PlaywrightTestingAccountCollection collection = resourceGroupResource.GetPlaywrightTestingAccounts(); - - // invoke the operation and iterate over the result - await foreach (PlaywrightTestingAccountResource 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 - PlaywrightTestingAccountData 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_AccountsGet() - { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json - // this example is just showing the usage of "Accounts_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 = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "dummyrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this PlaywrightTestingAccountResource - PlaywrightTestingAccountCollection collection = resourceGroupResource.GetPlaywrightTestingAccounts(); - - // invoke the operation - string name = "myPlaywrightAccount"; - bool result = await collection.ExistsAsync(name); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_AccountsGet() - { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json - // this example is just showing the usage of "Accounts_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 = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "dummyrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this PlaywrightTestingAccountResource - PlaywrightTestingAccountCollection collection = resourceGroupResource.GetPlaywrightTestingAccounts(); - - // invoke the operation - string name = "myPlaywrightAccount"; - NullableResponse response = await collection.GetIfExistsAsync(name); - PlaywrightTestingAccountResource 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 - PlaywrightTestingAccountData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountQuotaCollection.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountQuotaCollection.cs new file mode 100644 index 000000000000..48997baf2881 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountQuotaCollection.cs @@ -0,0 +1,161 @@ +// 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.PlaywrightTesting.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.PlaywrightTesting.Samples +{ + public partial class Sample_PlaywrightTestingAccountQuotaCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AccountQuotasGet() + { + // Generated from example definition: 2024-12-01/AccountQuotas_Get.json + // this example is just showing the usage of "AccountQuota_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 PlaywrightTestingAccountResource created on azure + // for more information of creating PlaywrightTestingAccountResource, please refer to the document of PlaywrightTestingAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "dummyrg"; + string accountName = "myPlaywrightAccount"; + ResourceIdentifier playwrightTestingAccountResourceId = PlaywrightTestingAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + PlaywrightTestingAccountResource playwrightTestingAccount = client.GetPlaywrightTestingAccountResource(playwrightTestingAccountResourceId); + + // get the collection of this PlaywrightTestingAccountQuotaResource + PlaywrightTestingAccountQuotaCollection collection = playwrightTestingAccount.GetAllPlaywrightTestingAccountQuota(); + + // invoke the operation + PlaywrightTestingQuotaName quotaName = PlaywrightTestingQuotaName.ScalableExecution; + PlaywrightTestingAccountQuotaResource result = await collection.GetAsync(quotaName); + + // 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 + PlaywrightTestingAccountQuotaData 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_AccountQuotasListByAccount() + { + // Generated from example definition: 2024-12-01/AccountQuotas_ListByAccount.json + // this example is just showing the usage of "AccountQuota_ListByAccount" 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 PlaywrightTestingAccountResource created on azure + // for more information of creating PlaywrightTestingAccountResource, please refer to the document of PlaywrightTestingAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "dummyrg"; + string accountName = "myPlaywrightAccount"; + ResourceIdentifier playwrightTestingAccountResourceId = PlaywrightTestingAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + PlaywrightTestingAccountResource playwrightTestingAccount = client.GetPlaywrightTestingAccountResource(playwrightTestingAccountResourceId); + + // get the collection of this PlaywrightTestingAccountQuotaResource + PlaywrightTestingAccountQuotaCollection collection = playwrightTestingAccount.GetAllPlaywrightTestingAccountQuota(); + + // invoke the operation and iterate over the result + await foreach (PlaywrightTestingAccountQuotaResource 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 + PlaywrightTestingAccountQuotaData 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_AccountQuotasGet() + { + // Generated from example definition: 2024-12-01/AccountQuotas_Get.json + // this example is just showing the usage of "AccountQuota_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 PlaywrightTestingAccountResource created on azure + // for more information of creating PlaywrightTestingAccountResource, please refer to the document of PlaywrightTestingAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "dummyrg"; + string accountName = "myPlaywrightAccount"; + ResourceIdentifier playwrightTestingAccountResourceId = PlaywrightTestingAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + PlaywrightTestingAccountResource playwrightTestingAccount = client.GetPlaywrightTestingAccountResource(playwrightTestingAccountResourceId); + + // get the collection of this PlaywrightTestingAccountQuotaResource + PlaywrightTestingAccountQuotaCollection collection = playwrightTestingAccount.GetAllPlaywrightTestingAccountQuota(); + + // invoke the operation + PlaywrightTestingQuotaName quotaName = PlaywrightTestingQuotaName.ScalableExecution; + bool result = await collection.ExistsAsync(quotaName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AccountQuotasGet() + { + // Generated from example definition: 2024-12-01/AccountQuotas_Get.json + // this example is just showing the usage of "AccountQuota_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 PlaywrightTestingAccountResource created on azure + // for more information of creating PlaywrightTestingAccountResource, please refer to the document of PlaywrightTestingAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "dummyrg"; + string accountName = "myPlaywrightAccount"; + ResourceIdentifier playwrightTestingAccountResourceId = PlaywrightTestingAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + PlaywrightTestingAccountResource playwrightTestingAccount = client.GetPlaywrightTestingAccountResource(playwrightTestingAccountResourceId); + + // get the collection of this PlaywrightTestingAccountQuotaResource + PlaywrightTestingAccountQuotaCollection collection = playwrightTestingAccount.GetAllPlaywrightTestingAccountQuota(); + + // invoke the operation + PlaywrightTestingQuotaName quotaName = PlaywrightTestingQuotaName.ScalableExecution; + NullableResponse response = await collection.GetIfExistsAsync(quotaName); + PlaywrightTestingAccountQuotaResource 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 + PlaywrightTestingAccountQuotaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountQuotaResource.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountQuotaResource.cs new file mode 100644 index 000000000000..3588cf362776 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountQuotaResource.cs @@ -0,0 +1,50 @@ +// 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.PlaywrightTesting.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.PlaywrightTesting.Samples +{ + public partial class Sample_PlaywrightTestingAccountQuotaResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AccountQuotasGet() + { + // Generated from example definition: 2024-12-01/AccountQuotas_Get.json + // this example is just showing the usage of "AccountQuota_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 PlaywrightTestingAccountQuotaResource created on azure + // for more information of creating PlaywrightTestingAccountQuotaResource, please refer to the document of PlaywrightTestingAccountQuotaResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "dummyrg"; + string accountName = "myPlaywrightAccount"; + PlaywrightTestingQuotaName quotaName = PlaywrightTestingQuotaName.ScalableExecution; + ResourceIdentifier playwrightTestingAccountQuotaResourceId = PlaywrightTestingAccountQuotaResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, quotaName); + PlaywrightTestingAccountQuotaResource playwrightTestingAccountQuota = client.GetPlaywrightTestingAccountQuotaResource(playwrightTestingAccountQuotaResourceId); + + // invoke the operation + PlaywrightTestingAccountQuotaResource result = await playwrightTestingAccountQuota.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 + PlaywrightTestingAccountQuotaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountResource.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountResource.cs index 7f4a0091fd0d..e5b6390a3ead 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountResource.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingAccountResource.cs @@ -16,42 +16,12 @@ namespace Azure.ResourceManager.PlaywrightTesting.Samples { public partial class Sample_PlaywrightTestingAccountResource { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_AccountsGet() - { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json - // this example is just showing the usage of "Accounts_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 PlaywrightTestingAccountResource created on azure - // for more information of creating PlaywrightTestingAccountResource, please refer to the document of PlaywrightTestingAccountResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "dummyrg"; - string name = "myPlaywrightAccount"; - ResourceIdentifier playwrightTestingAccountResourceId = PlaywrightTestingAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - PlaywrightTestingAccountResource playwrightTestingAccount = client.GetPlaywrightTestingAccountResource(playwrightTestingAccountResourceId); - - // invoke the operation - PlaywrightTestingAccountResource result = await playwrightTestingAccount.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 - PlaywrightTestingAccountData 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_AccountsDelete() { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Delete.json - // this example is just showing the usage of "Accounts_Delete" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-12-01/Accounts_Delete.json + // this example is just showing the usage of "Account_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(); @@ -62,8 +32,8 @@ public async Task Delete_AccountsDelete() // for more information of creating PlaywrightTestingAccountResource, please refer to the document of PlaywrightTestingAccountResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "dummyrg"; - string name = "myPlaywrightAccount"; - ResourceIdentifier playwrightTestingAccountResourceId = PlaywrightTestingAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + string accountName = "myPlaywrightAccount"; + ResourceIdentifier playwrightTestingAccountResourceId = PlaywrightTestingAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); PlaywrightTestingAccountResource playwrightTestingAccount = client.GetPlaywrightTestingAccountResource(playwrightTestingAccountResourceId); // invoke the operation @@ -76,8 +46,8 @@ public async Task Delete_AccountsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_AccountsUpdate() { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Update.json - // this example is just showing the usage of "Accounts_Update" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-12-01/Accounts_Update.json + // this example is just showing the usage of "Account_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(); @@ -88,8 +58,8 @@ public async Task Update_AccountsUpdate() // for more information of creating PlaywrightTestingAccountResource, please refer to the document of PlaywrightTestingAccountResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "dummyrg"; - string name = "myPlaywrightAccount"; - ResourceIdentifier playwrightTestingAccountResourceId = PlaywrightTestingAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + string accountName = "myPlaywrightAccount"; + ResourceIdentifier playwrightTestingAccountResourceId = PlaywrightTestingAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); PlaywrightTestingAccountResource playwrightTestingAccount = client.GetPlaywrightTestingAccountResource(playwrightTestingAccountResourceId); // invoke the operation @@ -97,10 +67,13 @@ public async Task Update_AccountsUpdate() { Tags = { -["Division"] = "LT", -["Team"] = "Dev Exp" +["Team"] = "Dev Exp", +["Division"] = "LT" }, - RegionalAffinity = EnablementStatus.Enabled, + Properties = new AccountUpdateProperties + { + RegionalAffinity = PlaywrightTestingEnablementStatus.Enabled, + }, }; PlaywrightTestingAccountResource result = await playwrightTestingAccount.UpdateAsync(patch); diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingQuotaCollection.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingQuotaCollection.cs index f17ae04b5e1c..185013c36333 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingQuotaCollection.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingQuotaCollection.cs @@ -21,8 +21,8 @@ public partial class Sample_PlaywrightTestingQuotaCollection [Ignore("Only validating compilation of examples")] public async Task Get_QuotasGet() { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json - // this example is just showing the usage of "Quotas_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-12-01/Quotas_Get.json + // this example is just showing the usage of "Quota_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(); @@ -36,12 +36,12 @@ public async Task Get_QuotasGet() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // get the collection of this PlaywrightTestingQuotaResource - AzureLocation location = new AzureLocation("eastus"); + string location = "eastus"; PlaywrightTestingQuotaCollection collection = subscriptionResource.GetAllPlaywrightTestingQuota(location); // invoke the operation - PlaywrightTestingQuotaName name = PlaywrightTestingQuotaName.ScalableExecution; - PlaywrightTestingQuotaResource result = await collection.GetAsync(name); + PlaywrightTestingQuotaName quotaName = PlaywrightTestingQuotaName.ScalableExecution; + PlaywrightTestingQuotaResource result = await collection.GetAsync(quotaName); // 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 @@ -54,8 +54,8 @@ public async Task Get_QuotasGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_QuotasListBySubscription() { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_ListBySubscription.json - // this example is just showing the usage of "Quotas_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-12-01/Quotas_ListBySubscription.json + // this example is just showing the usage of "Quota_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(); @@ -69,7 +69,7 @@ public async Task GetAll_QuotasListBySubscription() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // get the collection of this PlaywrightTestingQuotaResource - AzureLocation location = new AzureLocation("eastus"); + string location = "eastus"; PlaywrightTestingQuotaCollection collection = subscriptionResource.GetAllPlaywrightTestingQuota(location); // invoke the operation and iterate over the result @@ -89,8 +89,8 @@ public async Task GetAll_QuotasListBySubscription() [Ignore("Only validating compilation of examples")] public async Task Exists_QuotasGet() { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json - // this example is just showing the usage of "Quotas_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-12-01/Quotas_Get.json + // this example is just showing the usage of "Quota_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(); @@ -104,12 +104,12 @@ public async Task Exists_QuotasGet() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // get the collection of this PlaywrightTestingQuotaResource - AzureLocation location = new AzureLocation("eastus"); + string location = "eastus"; PlaywrightTestingQuotaCollection collection = subscriptionResource.GetAllPlaywrightTestingQuota(location); // invoke the operation - PlaywrightTestingQuotaName name = PlaywrightTestingQuotaName.ScalableExecution; - bool result = await collection.ExistsAsync(name); + PlaywrightTestingQuotaName quotaName = PlaywrightTestingQuotaName.ScalableExecution; + bool result = await collection.ExistsAsync(quotaName); Console.WriteLine($"Succeeded: {result}"); } @@ -118,8 +118,8 @@ public async Task Exists_QuotasGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_QuotasGet() { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json - // this example is just showing the usage of "Quotas_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-12-01/Quotas_Get.json + // this example is just showing the usage of "Quota_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(); @@ -133,12 +133,12 @@ public async Task GetIfExists_QuotasGet() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // get the collection of this PlaywrightTestingQuotaResource - AzureLocation location = new AzureLocation("eastus"); + string location = "eastus"; PlaywrightTestingQuotaCollection collection = subscriptionResource.GetAllPlaywrightTestingQuota(location); // invoke the operation - PlaywrightTestingQuotaName name = PlaywrightTestingQuotaName.ScalableExecution; - NullableResponse response = await collection.GetIfExistsAsync(name); + PlaywrightTestingQuotaName quotaName = PlaywrightTestingQuotaName.ScalableExecution; + NullableResponse response = await collection.GetIfExistsAsync(quotaName); PlaywrightTestingQuotaResource result = response.HasValue ? response.Value : null; if (result == null) diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingQuotaResource.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingQuotaResource.cs index 2268453872cb..22387c22061f 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingQuotaResource.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_PlaywrightTestingQuotaResource.cs @@ -20,8 +20,8 @@ public partial class Sample_PlaywrightTestingQuotaResource [Ignore("Only validating compilation of examples")] public async Task Get_QuotasGet() { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json - // this example is just showing the usage of "Quotas_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-12-01/Quotas_Get.json + // this example is just showing the usage of "Quota_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(); @@ -31,9 +31,9 @@ public async Task Get_QuotasGet() // this example assumes you already have this PlaywrightTestingQuotaResource created on azure // for more information of creating PlaywrightTestingQuotaResource, please refer to the document of PlaywrightTestingQuotaResource string subscriptionId = "00000000-0000-0000-0000-000000000000"; - AzureLocation location = new AzureLocation("eastus"); - PlaywrightTestingQuotaName name = PlaywrightTestingQuotaName.ScalableExecution; - ResourceIdentifier playwrightTestingQuotaResourceId = PlaywrightTestingQuotaResource.CreateResourceIdentifier(subscriptionId, location, name); + string location = "eastus"; + PlaywrightTestingQuotaName quotaName = PlaywrightTestingQuotaName.ScalableExecution; + ResourceIdentifier playwrightTestingQuotaResourceId = PlaywrightTestingQuotaResource.CreateResourceIdentifier(subscriptionId, location, quotaName); PlaywrightTestingQuotaResource playwrightTestingQuota = client.GetPlaywrightTestingQuotaResource(playwrightTestingQuotaResourceId); // invoke the operation diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index d3357cd6bd93..766aee6e99a3 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.ResourceManager.PlaywrightTesting.Models; using Azure.ResourceManager.Resources; using NUnit.Framework; @@ -18,10 +19,10 @@ public partial class Sample_SubscriptionResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task GetPlaywrightTestingAccounts_AccountsListBySubscription() + public async Task CheckPlaywrightTestingNameAvailability_AccountsCheckNameAvailability() { - // Generated from example definition: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListBySubscription.json - // this example is just showing the usage of "Accounts_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2024-12-01/Accounts_CheckNameAvailability.json + // this example is just showing the usage of "Accounts_CheckPlaywrightTestingNameAvailability" 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(); @@ -34,17 +35,15 @@ public async Task GetPlaywrightTestingAccounts_AccountsListBySubscription() ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - // invoke the operation and iterate over the result - await foreach (PlaywrightTestingAccountResource item in subscriptionResource.GetPlaywrightTestingAccountsAsync()) + // invoke the operation + PlaywrightTestingNameAvailabilityContent content = new PlaywrightTestingNameAvailabilityContent { - // 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 - PlaywrightTestingAccountData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine("Succeeded"); + Name = "dummyName", + Type = "Microsoft.AzurePlaywrightService/Accounts", + }; + PlaywrightTestingNameAvailabilityResult result = await subscriptionResource.CheckPlaywrightTestingNameAvailabilityAsync(content); + + Console.WriteLine($"Succeeded: {result}"); } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/ArmPlaywrightTestingModelFactory.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/ArmPlaywrightTestingModelFactory.cs index e4799441a662..6ab3815727d2 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/ArmPlaywrightTestingModelFactory.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/ArmPlaywrightTestingModelFactory.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Azure.Core; using Azure.ResourceManager.Models; @@ -15,6 +16,88 @@ namespace Azure.ResourceManager.PlaywrightTesting.Models /// Model factory for models. public static partial class ArmPlaywrightTestingModelFactory { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static PlaywrightTestingAccountQuotaData PlaywrightTestingAccountQuotaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PlaywrightTestingAccountQuotaProperties properties = null) + { + return new PlaywrightTestingAccountQuotaData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The Playwright service account quota resource free-trial properties. + /// The status of the last operation. + /// A new instance for mocking. + public static PlaywrightTestingAccountQuotaProperties PlaywrightTestingAccountQuotaProperties(PlaywrightTestingAccountFreeTrialProperties freeTrial = null, PlaywrightTestingProvisioningState? provisioningState = null) + { + return new PlaywrightTestingAccountQuotaProperties(freeTrial, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The free-trial createdAt utcDateTime. + /// The free-trial expiryAt utcDateTime. + /// The free-trial allocated limit value eg. allocated free minutes. + /// The free-trial used value eg. used free minutes. + /// The free-trial percentage used. + /// A new instance for mocking. + public static PlaywrightTestingAccountFreeTrialProperties PlaywrightTestingAccountFreeTrialProperties(DateTimeOffset createdOn = default, DateTimeOffset expiryOn = default, int allocatedValue = default, int usedValue = default, float percentageUsed = default) + { + return new PlaywrightTestingAccountFreeTrialProperties( + createdOn, + expiryOn, + allocatedValue, + usedValue, + percentageUsed, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static PlaywrightTestingQuotaData PlaywrightTestingQuotaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PlaywrightTestingQuotaProperties properties = null) + { + return new PlaywrightTestingQuotaData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The subscription quota resource free-trial properties. + /// Indicates the offering type for the subscription. + /// The status of the last operation. + /// A new instance for mocking. + public static PlaywrightTestingQuotaProperties PlaywrightTestingQuotaProperties(PlaywrightTestingFreeTrialProperties freeTrial = null, PlaywrightTestingOfferingType? offeringType = null, PlaywrightTestingProvisioningState? provisioningState = null) + { + return new PlaywrightTestingQuotaProperties(freeTrial, offeringType, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The Playwright service account id. + /// The free-trial state. + /// A new instance for mocking. + public static PlaywrightTestingFreeTrialProperties PlaywrightTestingFreeTrialProperties(string accountId = null, PlaywrightTestingFreeTrialState state = default) + { + return new PlaywrightTestingFreeTrialProperties(accountId, state, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -22,13 +105,9 @@ public static partial class ArmPlaywrightTestingModelFactory /// The systemData. /// The tags. /// The location. - /// The Playwright testing dashboard URI for the account resource. - /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. - /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. - /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. - /// The status of the last operation. + /// The resource-specific properties for this resource. /// A new instance for mocking. - public static PlaywrightTestingAccountData PlaywrightTestingAccountData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, Uri dashboardUri = null, EnablementStatus? regionalAffinity = null, EnablementStatus? scalableExecution = null, EnablementStatus? reporting = null, PlaywrightTestingProvisioningState? provisioningState = null) + public static PlaywrightTestingAccountData PlaywrightTestingAccountData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, PlaywrightTestingAccountProperties properties = null) { tags ??= new Dictionary(); @@ -39,32 +118,38 @@ public static PlaywrightTestingAccountData PlaywrightTestingAccountData(Resource systemData, tags, location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The Playwright testing dashboard URI for the account resource. + /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. + /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + /// When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs. + /// The status of the last operation. + /// A new instance for mocking. + public static PlaywrightTestingAccountProperties PlaywrightTestingAccountProperties(Uri dashboardUri = null, PlaywrightTestingEnablementStatus? regionalAffinity = null, PlaywrightTestingEnablementStatus? scalableExecution = null, PlaywrightTestingEnablementStatus? reporting = null, PlaywrightTestingEnablementStatus? localAuth = null, PlaywrightTestingProvisioningState? provisioningState = null) + { + return new PlaywrightTestingAccountProperties( dashboardUri, regionalAffinity, scalableExecution, reporting, + localAuth, provisioningState, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The free-trial quota. - /// The status of the last operation. - /// A new instance for mocking. - public static PlaywrightTestingQuotaData PlaywrightTestingQuotaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, FreeTrialProperties freeTrial = null, PlaywrightTestingProvisioningState? provisioningState = null) + /// Initializes a new instance of . + /// Indicates if the resource name is available. + /// The reason why the given name is not available. + /// Detailed reason why the given name is not available. + /// A new instance for mocking. + public static PlaywrightTestingNameAvailabilityResult PlaywrightTestingNameAvailabilityResult(bool? isNameAvailable = null, PlaywrightTestingNameUnavailableReason? reason = null, string message = null) { - return new PlaywrightTestingQuotaData( - id, - name, - resourceType, - systemData, - freeTrial, - provisioningState, - serializedAdditionalRawData: null); + return new PlaywrightTestingNameAvailabilityResult(isNameAvailable, reason, message, serializedAdditionalRawData: null); } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingArmClient.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingArmClient.cs index da51ea045653..b1963f3e762b 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingArmClient.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingArmClient.cs @@ -57,5 +57,17 @@ public virtual PlaywrightTestingQuotaResource GetPlaywrightTestingQuotaResource( PlaywrightTestingQuotaResource.ValidateResourceId(id); return new PlaywrightTestingQuotaResource(Client, id); } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual PlaywrightTestingAccountQuotaResource GetPlaywrightTestingAccountQuotaResource(ResourceIdentifier id) + { + PlaywrightTestingAccountQuotaResource.ValidateResourceId(id); + return new PlaywrightTestingAccountQuotaResource(Client, id); + } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingResourceGroupResource.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingResourceGroupResource.cs index d57acf34df24..4da148cf71e2 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingResourceGroupResource.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingResourceGroupResource.cs @@ -45,15 +45,15 @@ public virtual PlaywrightTestingAccountCollection GetPlaywrightTestingAccounts() /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -61,14 +61,14 @@ public virtual PlaywrightTestingAccountCollection GetPlaywrightTestingAccounts() /// /// /// - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetPlaywrightTestingAccountAsync(string name, CancellationToken cancellationToken = default) + public virtual async Task> GetPlaywrightTestingAccountAsync(string accountName, CancellationToken cancellationToken = default) { - return await GetPlaywrightTestingAccounts().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetPlaywrightTestingAccounts().GetAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -76,15 +76,15 @@ public virtual async Task> GetPlaywri /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -92,14 +92,14 @@ public virtual async Task> GetPlaywri /// /// /// - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetPlaywrightTestingAccount(string name, CancellationToken cancellationToken = default) + public virtual Response GetPlaywrightTestingAccount(string accountName, CancellationToken cancellationToken = default) { - return GetPlaywrightTestingAccounts().Get(name, cancellationToken); + return GetPlaywrightTestingAccounts().Get(accountName, cancellationToken); } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingSubscriptionResource.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingSubscriptionResource.cs index ad2be21afbb6..0d7eb6e75f11 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingSubscriptionResource.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/MockablePlaywrightTestingSubscriptionResource.cs @@ -5,6 +5,7 @@ #nullable disable +using System; using System.Threading; using System.Threading.Tasks; using Autorest.CSharp.Core; @@ -43,26 +44,28 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// Gets a collection of PlaywrightTestingQuotaResources in the SubscriptionResource. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. + /// is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of PlaywrightTestingQuotaResources and their operations over a PlaywrightTestingQuotaResource. - public virtual PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(AzureLocation location) + public virtual PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(string location) { return new PlaywrightTestingQuotaCollection(Client, Id, location); } /// - /// Get quota by name. + /// Get subscription quota by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -71,28 +74,30 @@ public virtual PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(Azu /// /// /// The location of quota in ARM Normalized format like eastus, southeastasia etc. - /// The quota name. + /// The quota name. /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetPlaywrightTestingQuotaAsync(AzureLocation location, PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public virtual async Task> GetPlaywrightTestingQuotaAsync(string location, PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { - return await GetAllPlaywrightTestingQuota(location).GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetAllPlaywrightTestingQuota(location).GetAsync(quotaName, cancellationToken).ConfigureAwait(false); } /// - /// Get quota by name. + /// Get subscription quota by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -101,12 +106,14 @@ public virtual async Task> GetPlaywrigh /// /// /// The location of quota in ARM Normalized format like eastus, southeastasia etc. - /// The quota name. + /// The quota name. /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetPlaywrightTestingQuota(AzureLocation location, PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public virtual Response GetPlaywrightTestingQuota(string location, PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { - return GetAllPlaywrightTestingQuota(location).Get(name, cancellationToken); + return GetAllPlaywrightTestingQuota(location).Get(quotaName, cancellationToken); } /// @@ -118,11 +125,11 @@ public virtual Response GetPlaywrightTestingQuot /// /// /// Operation Id - /// Accounts_ListBySubscription + /// Account_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -148,11 +155,11 @@ public virtual AsyncPageable GetPlaywrightTest /// /// /// Operation Id - /// Accounts_ListBySubscription + /// Account_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -168,5 +175,89 @@ public virtual Pageable GetPlaywrightTestingAc HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => PlaywrightTestingAccountAccountsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PlaywrightTestingAccountResource(Client, PlaywrightTestingAccountData.DeserializePlaywrightTestingAccountData(e)), PlaywrightTestingAccountAccountsClientDiagnostics, Pipeline, "MockablePlaywrightTestingSubscriptionResource.GetPlaywrightTestingAccounts", "value", "nextLink", cancellationToken); } + + /// + /// Adds check global name availability operation, normally used if a resource name must be globally unique. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckPlaywrightTestingNameAvailability + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The CheckAvailability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckPlaywrightTestingNameAvailabilityAsync(PlaywrightTestingNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PlaywrightTestingAccountAccountsClientDiagnostics.CreateScope("MockablePlaywrightTestingSubscriptionResource.CheckPlaywrightTestingNameAvailability"); + scope.Start(); + try + { + var response = await PlaywrightTestingAccountAccountsRestClient.CheckPlaywrightTestingNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds check global name availability operation, normally used if a resource name must be globally unique. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckPlaywrightTestingNameAvailability + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The CheckAvailability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckPlaywrightTestingNameAvailability(PlaywrightTestingNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = PlaywrightTestingAccountAccountsClientDiagnostics.CreateScope("MockablePlaywrightTestingSubscriptionResource.CheckPlaywrightTestingNameAvailability"); + scope.Start(); + try + { + var response = PlaywrightTestingAccountAccountsRestClient.CheckPlaywrightTestingNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/PlaywrightTestingExtensions.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/PlaywrightTestingExtensions.cs index dbf82f7e308d..8ac39d8a7c03 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/PlaywrightTestingExtensions.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Extensions/PlaywrightTestingExtensions.cs @@ -71,6 +71,25 @@ public static PlaywrightTestingQuotaResource GetPlaywrightTestingQuotaResource(t return GetMockablePlaywrightTestingArmClient(client).GetPlaywrightTestingQuotaResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static PlaywrightTestingAccountQuotaResource GetPlaywrightTestingAccountQuotaResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockablePlaywrightTestingArmClient(client).GetPlaywrightTestingAccountQuotaResource(id); + } + /// /// Gets a collection of PlaywrightTestingAccountResources in the ResourceGroupResource. /// @@ -93,15 +112,15 @@ public static PlaywrightTestingAccountCollection GetPlaywrightTestingAccounts(th /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -114,16 +133,16 @@ public static PlaywrightTestingAccountCollection GetPlaywrightTestingAccounts(th /// /// /// The instance the method will execute against. - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// or is null. - /// 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. [ForwardsClientCalls] - public static async Task> GetPlaywrightTestingAccountAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) + public static async Task> GetPlaywrightTestingAccountAsync(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockablePlaywrightTestingResourceGroupResource(resourceGroupResource).GetPlaywrightTestingAccountAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockablePlaywrightTestingResourceGroupResource(resourceGroupResource).GetPlaywrightTestingAccountAsync(accountName, cancellationToken).ConfigureAwait(false); } /// @@ -131,15 +150,15 @@ public static async Task> GetPlaywrig /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -152,30 +171,31 @@ public static async Task> GetPlaywrig /// /// /// The instance the method will execute against. - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// or is null. - /// 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. [ForwardsClientCalls] - public static Response GetPlaywrightTestingAccount(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) + public static Response GetPlaywrightTestingAccount(this ResourceGroupResource resourceGroupResource, string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockablePlaywrightTestingResourceGroupResource(resourceGroupResource).GetPlaywrightTestingAccount(name, cancellationToken); + return GetMockablePlaywrightTestingResourceGroupResource(resourceGroupResource).GetPlaywrightTestingAccount(accountName, cancellationToken); } /// /// Gets a collection of PlaywrightTestingQuotaResources in the SubscriptionResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. - /// is null. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// An object representing collection of PlaywrightTestingQuotaResources and their operations over a PlaywrightTestingQuotaResource. - public static PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(this SubscriptionResource subscriptionResource, AzureLocation location) + public static PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(this SubscriptionResource subscriptionResource, string location) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); @@ -183,19 +203,19 @@ public static PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(this } /// - /// Get quota by name. + /// Get subscription quota by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -204,36 +224,37 @@ public static PlaywrightTestingQuotaCollection GetAllPlaywrightTestingQuota(this /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. - /// The quota name. + /// The quota name. /// The cancellation token to use. - /// is null. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetPlaywrightTestingQuotaAsync(this SubscriptionResource subscriptionResource, AzureLocation location, PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public static async Task> GetPlaywrightTestingQuotaAsync(this SubscriptionResource subscriptionResource, string location, PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockablePlaywrightTestingSubscriptionResource(subscriptionResource).GetPlaywrightTestingQuotaAsync(location, name, cancellationToken).ConfigureAwait(false); + return await GetMockablePlaywrightTestingSubscriptionResource(subscriptionResource).GetPlaywrightTestingQuotaAsync(location, quotaName, cancellationToken).ConfigureAwait(false); } /// - /// Get quota by name. + /// Get subscription quota by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -242,20 +263,21 @@ public static async Task> GetPlaywright /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. - /// The quota name. + /// The quota name. /// The cancellation token to use. - /// is null. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetPlaywrightTestingQuota(this SubscriptionResource subscriptionResource, AzureLocation location, PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public static Response GetPlaywrightTestingQuota(this SubscriptionResource subscriptionResource, string location, PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockablePlaywrightTestingSubscriptionResource(subscriptionResource).GetPlaywrightTestingQuota(location, name, cancellationToken); + return GetMockablePlaywrightTestingSubscriptionResource(subscriptionResource).GetPlaywrightTestingQuota(location, quotaName, cancellationToken); } /// @@ -267,11 +289,11 @@ public static Response GetPlaywrightTestingQuota /// /// /// Operation Id - /// Accounts_ListBySubscription + /// Account_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -303,11 +325,11 @@ public static AsyncPageable GetPlaywrightTesti /// /// /// Operation Id - /// Accounts_ListBySubscription + /// Account_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -329,5 +351,77 @@ public static Pageable GetPlaywrightTestingAcc return GetMockablePlaywrightTestingSubscriptionResource(subscriptionResource).GetPlaywrightTestingAccounts(cancellationToken); } + + /// + /// Adds check global name availability operation, normally used if a resource name must be globally unique. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckPlaywrightTestingNameAvailability + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + public static async Task> CheckPlaywrightTestingNameAvailabilityAsync(this SubscriptionResource subscriptionResource, PlaywrightTestingNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockablePlaywrightTestingSubscriptionResource(subscriptionResource).CheckPlaywrightTestingNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + } + + /// + /// Adds check global name availability operation, normally used if a resource name must be globally unique. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability + /// + /// + /// Operation Id + /// Accounts_CheckPlaywrightTestingNameAvailability + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + public static Response CheckPlaywrightTestingNameAvailability(this SubscriptionResource subscriptionResource, PlaywrightTestingNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockablePlaywrightTestingSubscriptionResource(subscriptionResource).CheckPlaywrightTestingNameAvailability(content, cancellationToken); + } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountQuotaListResult.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountQuotaListResult.Serialization.cs new file mode 100644 index 000000000000..bf117c5dc69c --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountQuotaListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + internal partial class AccountQuotaListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccountQuotaListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AccountQuotaListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccountQuotaListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAccountQuotaListResult(document.RootElement, options); + } + + internal static AccountQuotaListResult DeserializeAccountQuotaListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PlaywrightTestingAccountQuotaData.DeserializePlaywrightTestingAccountQuotaData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AccountQuotaListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AccountQuotaListResult)} does not support writing '{options.Format}' format."); + } + } + + AccountQuotaListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAccountQuotaListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AccountQuotaListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountQuotaListResult.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountQuotaListResult.cs new file mode 100644 index 000000000000..8c0efeb7c87e --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountQuotaListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// The response of a AccountQuota list operation. + internal partial class AccountQuotaListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The AccountQuota items on this page. + /// is null. + internal AccountQuotaListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The AccountQuota items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal AccountQuotaListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AccountQuotaListResult() + { + } + + /// The AccountQuota items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountUpdateProperties.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..c0d4db76371a --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountUpdateProperties.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.Core; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + public partial class AccountUpdateProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccountUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(RegionalAffinity)) + { + writer.WritePropertyName("regionalAffinity"u8); + writer.WriteStringValue(RegionalAffinity.Value.ToString()); + } + if (Optional.IsDefined(ScalableExecution)) + { + writer.WritePropertyName("scalableExecution"u8); + writer.WriteStringValue(ScalableExecution.Value.ToString()); + } + if (Optional.IsDefined(Reporting)) + { + writer.WritePropertyName("reporting"u8); + writer.WriteStringValue(Reporting.Value.ToString()); + } + if (Optional.IsDefined(LocalAuth)) + { + writer.WritePropertyName("localAuth"u8); + writer.WriteStringValue(LocalAuth.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AccountUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccountUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAccountUpdateProperties(document.RootElement, options); + } + + internal static AccountUpdateProperties DeserializeAccountUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlaywrightTestingEnablementStatus? regionalAffinity = default; + PlaywrightTestingEnablementStatus? scalableExecution = default; + PlaywrightTestingEnablementStatus? reporting = default; + PlaywrightTestingEnablementStatus? localAuth = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("regionalAffinity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + regionalAffinity = new PlaywrightTestingEnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("scalableExecution"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scalableExecution = new PlaywrightTestingEnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("reporting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reporting = new PlaywrightTestingEnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("localAuth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + localAuth = new PlaywrightTestingEnablementStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AccountUpdateProperties(regionalAffinity, scalableExecution, reporting, localAuth, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AccountUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + AccountUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAccountUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AccountUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountUpdateProperties.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountUpdateProperties.cs new file mode 100644 index 000000000000..82c651dd1481 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/AccountUpdateProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// The updatable properties of the Account. + public partial class AccountUpdateProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AccountUpdateProperties() + { + } + + /// Initializes a new instance of . + /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. + /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + /// When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs. + /// Keeps track of any properties unknown to the library. + internal AccountUpdateProperties(PlaywrightTestingEnablementStatus? regionalAffinity, PlaywrightTestingEnablementStatus? scalableExecution, PlaywrightTestingEnablementStatus? reporting, PlaywrightTestingEnablementStatus? localAuth, IDictionary serializedAdditionalRawData) + { + RegionalAffinity = regionalAffinity; + ScalableExecution = scalableExecution; + Reporting = reporting; + LocalAuth = localAuth; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + public PlaywrightTestingEnablementStatus? RegionalAffinity { get; set; } + /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. + public PlaywrightTestingEnablementStatus? ScalableExecution { get; set; } + /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + public PlaywrightTestingEnablementStatus? Reporting { get; set; } + /// When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs. + public PlaywrightTestingEnablementStatus? LocalAuth { get; set; } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/EnablementStatus.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/EnablementStatus.cs deleted file mode 100644 index 21f9490d4a2a..000000000000 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/EnablementStatus.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.PlaywrightTesting.Models -{ - /// The enablement status of a feature. - public readonly partial struct EnablementStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public EnablementStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// The feature is Enabled. - public static EnablementStatus Enabled { get; } = new EnablementStatus(EnabledValue); - /// The feature is Disabled. - public static EnablementStatus Disabled { get; } = new EnablementStatus(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(EnablementStatus left, EnablementStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(EnablementStatus left, EnablementStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator EnablementStatus(string value) => new EnablementStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is EnablementStatus other && Equals(other); - /// - public bool Equals(EnablementStatus 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/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialState.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialState.cs deleted file mode 100644 index 135eddf8d678..000000000000 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialState.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.PlaywrightTesting.Models -{ - /// The free-trial state. - public readonly partial struct FreeTrialState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public FreeTrialState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ActiveValue = "Active"; - private const string ExpiredValue = "Expired"; - - /// The free-trial is Active. - public static FreeTrialState Active { get; } = new FreeTrialState(ActiveValue); - /// The free-trial is Expired. - public static FreeTrialState Expired { get; } = new FreeTrialState(ExpiredValue); - /// Determines if two values are the same. - public static bool operator ==(FreeTrialState left, FreeTrialState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(FreeTrialState left, FreeTrialState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator FreeTrialState(string value) => new FreeTrialState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is FreeTrialState other && Equals(other); - /// - public bool Equals(FreeTrialState 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/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialProperties.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountFreeTrialProperties.Serialization.cs similarity index 65% rename from sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialProperties.Serialization.cs rename to sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountFreeTrialProperties.Serialization.cs index ab625ed5e7db..59ab7447dbca 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialProperties.Serialization.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountFreeTrialProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.PlaywrightTesting.Models { - public partial class FreeTrialProperties : IUtf8JsonSerializable, IJsonModel + public partial class PlaywrightTestingAccountFreeTrialProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,17 +28,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(FreeTrialProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PlaywrightTestingAccountFreeTrialProperties)} does not support writing '{format}' format."); } - if (options.Format != "W") - { - writer.WritePropertyName("accountId"u8); - writer.WriteStringValue(AccountId); - } if (options.Format != "W") { writer.WritePropertyName("createdAt"u8); @@ -64,11 +59,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("percentageUsed"u8); writer.WriteNumberValue(PercentageUsed); } - if (options.Format != "W") - { - writer.WritePropertyName("state"u8); - writer.WriteStringValue(State.ToString()); - } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -86,19 +76,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - FreeTrialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PlaywrightTestingAccountFreeTrialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(FreeTrialProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PlaywrightTestingAccountFreeTrialProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeFreeTrialProperties(document.RootElement, options); + return DeserializePlaywrightTestingAccountFreeTrialProperties(document.RootElement, options); } - internal static FreeTrialProperties DeserializeFreeTrialProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static PlaywrightTestingAccountFreeTrialProperties DeserializePlaywrightTestingAccountFreeTrialProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -106,22 +96,15 @@ internal static FreeTrialProperties DeserializeFreeTrialProperties(JsonElement e { return null; } - string accountId = default; DateTimeOffset createdAt = default; DateTimeOffset expiryAt = default; int allocatedValue = default; int usedValue = default; - decimal percentageUsed = default; - FreeTrialState state = default; + float percentageUsed = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("accountId"u8)) - { - accountId = property.Value.GetString(); - continue; - } if (property.NameEquals("createdAt"u8)) { createdAt = property.Value.GetDateTimeOffset("O"); @@ -144,12 +127,7 @@ internal static FreeTrialProperties DeserializeFreeTrialProperties(JsonElement e } if (property.NameEquals("percentageUsed"u8)) { - percentageUsed = property.Value.GetDecimal(); - continue; - } - if (property.NameEquals("state"u8)) - { - state = new FreeTrialState(property.Value.GetString()); + percentageUsed = property.Value.GetSingle(); continue; } if (options.Format != "W") @@ -158,46 +136,44 @@ internal static FreeTrialProperties DeserializeFreeTrialProperties(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new FreeTrialProperties( - accountId, + return new PlaywrightTestingAccountFreeTrialProperties( createdAt, expiryAt, allocatedValue, usedValue, percentageUsed, - state, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(FreeTrialProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PlaywrightTestingAccountFreeTrialProperties)} does not support writing '{options.Format}' format."); } } - FreeTrialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PlaywrightTestingAccountFreeTrialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeFreeTrialProperties(document.RootElement, options); + return DeserializePlaywrightTestingAccountFreeTrialProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(FreeTrialProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PlaywrightTestingAccountFreeTrialProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialProperties.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountFreeTrialProperties.cs similarity index 71% rename from sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialProperties.cs rename to sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountFreeTrialProperties.cs index 6c4070247ce3..86f31d0312b2 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/FreeTrialProperties.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountFreeTrialProperties.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.PlaywrightTesting.Models { - /// The free-trial properties. - public partial class FreeTrialProperties + /// The Playwright service account quota resource free-trial properties. + public partial class PlaywrightTestingAccountFreeTrialProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,53 +45,43 @@ public partial class FreeTrialProperties /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The playwright account id. + /// Initializes a new instance of . /// The free-trial createdAt utcDateTime. /// The free-trial expiryAt utcDateTime. /// The free-trial allocated limit value eg. allocated free minutes. /// The free-trial used value eg. used free minutes. /// The free-trial percentage used. - /// The free-trial state. - public FreeTrialProperties(string accountId, DateTimeOffset createdOn, DateTimeOffset expiryOn, int allocatedValue, int usedValue, decimal percentageUsed, FreeTrialState state) + internal PlaywrightTestingAccountFreeTrialProperties(DateTimeOffset createdOn, DateTimeOffset expiryOn, int allocatedValue, int usedValue, float percentageUsed) { - AccountId = accountId; CreatedOn = createdOn; ExpiryOn = expiryOn; AllocatedValue = allocatedValue; UsedValue = usedValue; PercentageUsed = percentageUsed; - State = state; } - /// Initializes a new instance of . - /// The playwright account id. + /// Initializes a new instance of . /// The free-trial createdAt utcDateTime. /// The free-trial expiryAt utcDateTime. /// The free-trial allocated limit value eg. allocated free minutes. /// The free-trial used value eg. used free minutes. /// The free-trial percentage used. - /// The free-trial state. /// Keeps track of any properties unknown to the library. - internal FreeTrialProperties(string accountId, DateTimeOffset createdOn, DateTimeOffset expiryOn, int allocatedValue, int usedValue, decimal percentageUsed, FreeTrialState state, IDictionary serializedAdditionalRawData) + internal PlaywrightTestingAccountFreeTrialProperties(DateTimeOffset createdOn, DateTimeOffset expiryOn, int allocatedValue, int usedValue, float percentageUsed, IDictionary serializedAdditionalRawData) { - AccountId = accountId; CreatedOn = createdOn; ExpiryOn = expiryOn; AllocatedValue = allocatedValue; UsedValue = usedValue; PercentageUsed = percentageUsed; - State = state; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal FreeTrialProperties() + /// Initializes a new instance of for deserialization. + internal PlaywrightTestingAccountFreeTrialProperties() { } - /// The playwright account id. - public string AccountId { get; } /// The free-trial createdAt utcDateTime. public DateTimeOffset CreatedOn { get; } /// The free-trial expiryAt utcDateTime. @@ -101,8 +91,6 @@ internal FreeTrialProperties() /// The free-trial used value eg. used free minutes. public int UsedValue { get; } /// The free-trial percentage used. - public decimal PercentageUsed { get; } - /// The free-trial state. - public FreeTrialState State { get; } + public float PercentageUsed { get; } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountPatch.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountPatch.Serialization.cs index 9b3d510ee3ae..3ed69cd86a57 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountPatch.Serialization.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountPatch.Serialization.cs @@ -45,24 +45,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndObject(); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(RegionalAffinity)) - { - writer.WritePropertyName("regionalAffinity"u8); - writer.WriteStringValue(RegionalAffinity.Value.ToString()); - } - if (Optional.IsDefined(ScalableExecution)) - { - writer.WritePropertyName("scalableExecution"u8); - writer.WriteStringValue(ScalableExecution.Value.ToString()); - } - if (Optional.IsDefined(Reporting)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("reporting"u8); - writer.WriteStringValue(Reporting.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -101,9 +88,7 @@ internal static PlaywrightTestingAccountPatch DeserializePlaywrightTestingAccoun return null; } IDictionary tags = default; - EnablementStatus? regionalAffinity = default; - EnablementStatus? scalableExecution = default; - EnablementStatus? reporting = default; + AccountUpdateProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -126,39 +111,9 @@ internal static PlaywrightTestingAccountPatch DeserializePlaywrightTestingAccoun { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("regionalAffinity"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - regionalAffinity = new EnablementStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("scalableExecution"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scalableExecution = new EnablementStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("reporting"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - reporting = new EnablementStatus(property0.Value.GetString()); - continue; - } - } + properties = AccountUpdateProperties.DeserializeAccountUpdateProperties(property.Value, options); continue; } if (options.Format != "W") @@ -167,7 +122,7 @@ internal static PlaywrightTestingAccountPatch DeserializePlaywrightTestingAccoun } } serializedAdditionalRawData = rawDataDictionary; - return new PlaywrightTestingAccountPatch(tags ?? new ChangeTrackingDictionary(), regionalAffinity, scalableExecution, reporting, serializedAdditionalRawData); + return new PlaywrightTestingAccountPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountPatch.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountPatch.cs index 246cd663a0fc..50d60ecf3d4b 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountPatch.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountPatch.cs @@ -53,26 +53,18 @@ public PlaywrightTestingAccountPatch() /// Initializes a new instance of . /// Resource tags. - /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. - /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. - /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal PlaywrightTestingAccountPatch(IDictionary tags, EnablementStatus? regionalAffinity, EnablementStatus? scalableExecution, EnablementStatus? reporting, IDictionary serializedAdditionalRawData) + internal PlaywrightTestingAccountPatch(IDictionary tags, AccountUpdateProperties properties, IDictionary serializedAdditionalRawData) { Tags = tags; - RegionalAffinity = regionalAffinity; - ScalableExecution = scalableExecution; - Reporting = reporting; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource tags. public IDictionary Tags { get; } - /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. - public EnablementStatus? RegionalAffinity { get; set; } - /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. - public EnablementStatus? ScalableExecution { get; set; } - /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. - public EnablementStatus? Reporting { get; set; } + /// The resource-specific properties for this resource. + public AccountUpdateProperties Properties { get; set; } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountProperties.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountProperties.Serialization.cs new file mode 100644 index 000000000000..d059ece6f846 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountProperties.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + public partial class PlaywrightTestingAccountProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingAccountProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(DashboardUri)) + { + writer.WritePropertyName("dashboardUri"u8); + writer.WriteStringValue(DashboardUri.AbsoluteUri); + } + if (Optional.IsDefined(RegionalAffinity)) + { + writer.WritePropertyName("regionalAffinity"u8); + writer.WriteStringValue(RegionalAffinity.Value.ToString()); + } + if (Optional.IsDefined(ScalableExecution)) + { + writer.WritePropertyName("scalableExecution"u8); + writer.WriteStringValue(ScalableExecution.Value.ToString()); + } + if (Optional.IsDefined(Reporting)) + { + writer.WritePropertyName("reporting"u8); + writer.WriteStringValue(Reporting.Value.ToString()); + } + if (Optional.IsDefined(LocalAuth)) + { + writer.WritePropertyName("localAuth"u8); + writer.WriteStringValue(LocalAuth.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PlaywrightTestingAccountProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingAccountProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlaywrightTestingAccountProperties(document.RootElement, options); + } + + internal static PlaywrightTestingAccountProperties DeserializePlaywrightTestingAccountProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri dashboardUri = default; + PlaywrightTestingEnablementStatus? regionalAffinity = default; + PlaywrightTestingEnablementStatus? scalableExecution = default; + PlaywrightTestingEnablementStatus? reporting = default; + PlaywrightTestingEnablementStatus? localAuth = default; + PlaywrightTestingProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dashboardUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dashboardUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("regionalAffinity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + regionalAffinity = new PlaywrightTestingEnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("scalableExecution"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scalableExecution = new PlaywrightTestingEnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("reporting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reporting = new PlaywrightTestingEnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("localAuth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + localAuth = new PlaywrightTestingEnablementStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new PlaywrightTestingProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PlaywrightTestingAccountProperties( + dashboardUri, + regionalAffinity, + scalableExecution, + reporting, + localAuth, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PlaywrightTestingAccountProperties)} does not support writing '{options.Format}' format."); + } + } + + PlaywrightTestingAccountProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePlaywrightTestingAccountProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PlaywrightTestingAccountProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountProperties.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountProperties.cs new file mode 100644 index 000000000000..99305964ef65 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountProperties.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; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// Account resource properties. + public partial class PlaywrightTestingAccountProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PlaywrightTestingAccountProperties() + { + } + + /// Initializes a new instance of . + /// The Playwright testing dashboard URI for the account resource. + /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. + /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + /// When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal PlaywrightTestingAccountProperties(Uri dashboardUri, PlaywrightTestingEnablementStatus? regionalAffinity, PlaywrightTestingEnablementStatus? scalableExecution, PlaywrightTestingEnablementStatus? reporting, PlaywrightTestingEnablementStatus? localAuth, PlaywrightTestingProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + DashboardUri = dashboardUri; + RegionalAffinity = regionalAffinity; + ScalableExecution = scalableExecution; + Reporting = reporting; + LocalAuth = localAuth; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The Playwright testing dashboard URI for the account resource. + public Uri DashboardUri { get; } + /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. + public PlaywrightTestingEnablementStatus? RegionalAffinity { get; set; } + /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. + public PlaywrightTestingEnablementStatus? ScalableExecution { get; set; } + /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + public PlaywrightTestingEnablementStatus? Reporting { get; set; } + /// When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs. + public PlaywrightTestingEnablementStatus? LocalAuth { get; set; } + /// The status of the last operation. + public PlaywrightTestingProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountQuotaProperties.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountQuotaProperties.Serialization.cs new file mode 100644 index 000000000000..fb121f4a271b --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountQuotaProperties.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + public partial class PlaywrightTestingAccountQuotaProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingAccountQuotaProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FreeTrial)) + { + writer.WritePropertyName("freeTrial"u8); + writer.WriteObjectValue(FreeTrial, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PlaywrightTestingAccountQuotaProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingAccountQuotaProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlaywrightTestingAccountQuotaProperties(document.RootElement, options); + } + + internal static PlaywrightTestingAccountQuotaProperties DeserializePlaywrightTestingAccountQuotaProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlaywrightTestingAccountFreeTrialProperties freeTrial = default; + PlaywrightTestingProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("freeTrial"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + freeTrial = PlaywrightTestingAccountFreeTrialProperties.DeserializePlaywrightTestingAccountFreeTrialProperties(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new PlaywrightTestingProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PlaywrightTestingAccountQuotaProperties(freeTrial, provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PlaywrightTestingAccountQuotaProperties)} does not support writing '{options.Format}' format."); + } + } + + PlaywrightTestingAccountQuotaProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePlaywrightTestingAccountQuotaProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PlaywrightTestingAccountQuotaProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountQuotaProperties.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountQuotaProperties.cs new file mode 100644 index 000000000000..2b878b0053c4 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingAccountQuotaProperties.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// The Playwright service account quota resource properties. + public partial class PlaywrightTestingAccountQuotaProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal PlaywrightTestingAccountQuotaProperties() + { + } + + /// Initializes a new instance of . + /// The Playwright service account quota resource free-trial properties. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal PlaywrightTestingAccountQuotaProperties(PlaywrightTestingAccountFreeTrialProperties freeTrial, PlaywrightTestingProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + FreeTrial = freeTrial; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The Playwright service account quota resource free-trial properties. + public PlaywrightTestingAccountFreeTrialProperties FreeTrial { get; } + /// The status of the last operation. + public PlaywrightTestingProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingEnablementStatus.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingEnablementStatus.cs new file mode 100644 index 000000000000..e64fdbd20d67 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingEnablementStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// The enablement status of a feature. + public readonly partial struct PlaywrightTestingEnablementStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PlaywrightTestingEnablementStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// The feature is Enabled. + public static PlaywrightTestingEnablementStatus Enabled { get; } = new PlaywrightTestingEnablementStatus(EnabledValue); + /// The feature is Disabled. + public static PlaywrightTestingEnablementStatus Disabled { get; } = new PlaywrightTestingEnablementStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(PlaywrightTestingEnablementStatus left, PlaywrightTestingEnablementStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PlaywrightTestingEnablementStatus left, PlaywrightTestingEnablementStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PlaywrightTestingEnablementStatus(string value) => new PlaywrightTestingEnablementStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PlaywrightTestingEnablementStatus other && Equals(other); + /// + public bool Equals(PlaywrightTestingEnablementStatus 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/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialProperties.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialProperties.Serialization.cs new file mode 100644 index 000000000000..3bccc11baac6 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialProperties.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + public partial class PlaywrightTestingFreeTrialProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingFreeTrialProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("accountId"u8); + writer.WriteStringValue(AccountId); + } + if (options.Format != "W") + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PlaywrightTestingFreeTrialProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingFreeTrialProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlaywrightTestingFreeTrialProperties(document.RootElement, options); + } + + internal static PlaywrightTestingFreeTrialProperties DeserializePlaywrightTestingFreeTrialProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string accountId = default; + PlaywrightTestingFreeTrialState state = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("accountId"u8)) + { + accountId = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + state = new PlaywrightTestingFreeTrialState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PlaywrightTestingFreeTrialProperties(accountId, state, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PlaywrightTestingFreeTrialProperties)} does not support writing '{options.Format}' format."); + } + } + + PlaywrightTestingFreeTrialProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePlaywrightTestingFreeTrialProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PlaywrightTestingFreeTrialProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialProperties.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialProperties.cs new file mode 100644 index 000000000000..1ab4dc9bc3a3 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialProperties.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// The subscription quota resource free-trial properties. + public partial class PlaywrightTestingFreeTrialProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The Playwright service account id. + /// The free-trial state. + internal PlaywrightTestingFreeTrialProperties(string accountId, PlaywrightTestingFreeTrialState state) + { + AccountId = accountId; + State = state; + } + + /// Initializes a new instance of . + /// The Playwright service account id. + /// The free-trial state. + /// Keeps track of any properties unknown to the library. + internal PlaywrightTestingFreeTrialProperties(string accountId, PlaywrightTestingFreeTrialState state, IDictionary serializedAdditionalRawData) + { + AccountId = accountId; + State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PlaywrightTestingFreeTrialProperties() + { + } + + /// The Playwright service account id. + public string AccountId { get; } + /// The free-trial state. + public PlaywrightTestingFreeTrialState State { get; } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialState.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialState.cs new file mode 100644 index 000000000000..237ecd45f2bc --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingFreeTrialState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// The free-trial state. + public readonly partial struct PlaywrightTestingFreeTrialState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PlaywrightTestingFreeTrialState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string ExpiredValue = "Expired"; + private const string NotEligibleValue = "NotEligible"; + private const string NotRegisteredValue = "NotRegistered"; + + /// The free-trial is Active. + public static PlaywrightTestingFreeTrialState Active { get; } = new PlaywrightTestingFreeTrialState(ActiveValue); + /// The free-trial is Expired. + public static PlaywrightTestingFreeTrialState Expired { get; } = new PlaywrightTestingFreeTrialState(ExpiredValue); + /// The free-trial is Not Eligible. + public static PlaywrightTestingFreeTrialState NotEligible { get; } = new PlaywrightTestingFreeTrialState(NotEligibleValue); + /// The free-trial is Not Registered. + public static PlaywrightTestingFreeTrialState NotRegistered { get; } = new PlaywrightTestingFreeTrialState(NotRegisteredValue); + /// Determines if two values are the same. + public static bool operator ==(PlaywrightTestingFreeTrialState left, PlaywrightTestingFreeTrialState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PlaywrightTestingFreeTrialState left, PlaywrightTestingFreeTrialState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PlaywrightTestingFreeTrialState(string value) => new PlaywrightTestingFreeTrialState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PlaywrightTestingFreeTrialState other && Equals(other); + /// + public bool Equals(PlaywrightTestingFreeTrialState 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/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityContent.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityContent.Serialization.cs new file mode 100644 index 000000000000..3f935bfd926f --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityContent.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + public partial class PlaywrightTestingNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingNameAvailabilityContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PlaywrightTestingNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingNameAvailabilityContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlaywrightTestingNameAvailabilityContent(document.RootElement, options); + } + + internal static PlaywrightTestingNameAvailabilityContent DeserializePlaywrightTestingNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PlaywrightTestingNameAvailabilityContent(name, type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PlaywrightTestingNameAvailabilityContent)} does not support writing '{options.Format}' format."); + } + } + + PlaywrightTestingNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePlaywrightTestingNameAvailabilityContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PlaywrightTestingNameAvailabilityContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityContent.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityContent.cs new file mode 100644 index 000000000000..ef3463181fe1 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityContent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// The check availability request body. + public partial class PlaywrightTestingNameAvailabilityContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PlaywrightTestingNameAvailabilityContent() + { + } + + /// Initializes a new instance of . + /// The name of the resource for which availability needs to be checked. + /// The resource type. + /// Keeps track of any properties unknown to the library. + internal PlaywrightTestingNameAvailabilityContent(string name, string type, IDictionary serializedAdditionalRawData) + { + Name = name; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the resource for which availability needs to be checked. + public string Name { get; set; } + /// The resource type. + public string Type { get; set; } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityResult.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityResult.Serialization.cs new file mode 100644 index 000000000000..5a1f16cbc1bf --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityResult.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + public partial class PlaywrightTestingNameAvailabilityResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingNameAvailabilityResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(IsNameAvailable)) + { + writer.WritePropertyName("nameAvailable"u8); + writer.WriteBooleanValue(IsNameAvailable.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.Value.ToString()); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PlaywrightTestingNameAvailabilityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingNameAvailabilityResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlaywrightTestingNameAvailabilityResult(document.RootElement, options); + } + + internal static PlaywrightTestingNameAvailabilityResult DeserializePlaywrightTestingNameAvailabilityResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? nameAvailable = default; + PlaywrightTestingNameUnavailableReason? reason = default; + string message = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nameAvailable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nameAvailable = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("reason"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reason = new PlaywrightTestingNameUnavailableReason(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PlaywrightTestingNameAvailabilityResult(nameAvailable, reason, message, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PlaywrightTestingNameAvailabilityResult)} does not support writing '{options.Format}' format."); + } + } + + PlaywrightTestingNameAvailabilityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePlaywrightTestingNameAvailabilityResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PlaywrightTestingNameAvailabilityResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityResult.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityResult.cs new file mode 100644 index 000000000000..8e825a386490 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameAvailabilityResult.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// The check availability result. + public partial class PlaywrightTestingNameAvailabilityResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal PlaywrightTestingNameAvailabilityResult() + { + } + + /// Initializes a new instance of . + /// Indicates if the resource name is available. + /// The reason why the given name is not available. + /// Detailed reason why the given name is not available. + /// Keeps track of any properties unknown to the library. + internal PlaywrightTestingNameAvailabilityResult(bool? isNameAvailable, PlaywrightTestingNameUnavailableReason? reason, string message, IDictionary serializedAdditionalRawData) + { + IsNameAvailable = isNameAvailable; + Reason = reason; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates if the resource name is available. + public bool? IsNameAvailable { get; } + /// The reason why the given name is not available. + public PlaywrightTestingNameUnavailableReason? Reason { get; } + /// Detailed reason why the given name is not available. + public string Message { get; } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameUnavailableReason.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameUnavailableReason.cs new file mode 100644 index 000000000000..26b72b8497cb --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingNameUnavailableReason.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// Possible reasons for a name not being available. + public readonly partial struct PlaywrightTestingNameUnavailableReason : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PlaywrightTestingNameUnavailableReason(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidValue = "Invalid"; + private const string AlreadyExistsValue = "AlreadyExists"; + + /// Name is invalid. + public static PlaywrightTestingNameUnavailableReason Invalid { get; } = new PlaywrightTestingNameUnavailableReason(InvalidValue); + /// Name already exists. + public static PlaywrightTestingNameUnavailableReason AlreadyExists { get; } = new PlaywrightTestingNameUnavailableReason(AlreadyExistsValue); + /// Determines if two values are the same. + public static bool operator ==(PlaywrightTestingNameUnavailableReason left, PlaywrightTestingNameUnavailableReason right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PlaywrightTestingNameUnavailableReason left, PlaywrightTestingNameUnavailableReason right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PlaywrightTestingNameUnavailableReason(string value) => new PlaywrightTestingNameUnavailableReason(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PlaywrightTestingNameUnavailableReason other && Equals(other); + /// + public bool Equals(PlaywrightTestingNameUnavailableReason 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/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingOfferingType.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingOfferingType.cs new file mode 100644 index 000000000000..fa2c55e8dcec --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingOfferingType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// Offering type state. + public readonly partial struct PlaywrightTestingOfferingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PlaywrightTestingOfferingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotApplicableValue = "NotApplicable"; + private const string PrivatePreviewValue = "PrivatePreview"; + private const string PublicPreviewValue = "PublicPreview"; + private const string GeneralAvailabilityValue = "GeneralAvailability"; + + /// The offeringType is NotApplicable. + public static PlaywrightTestingOfferingType NotApplicable { get; } = new PlaywrightTestingOfferingType(NotApplicableValue); + /// The offeringType is PrivatePreview. + public static PlaywrightTestingOfferingType PrivatePreview { get; } = new PlaywrightTestingOfferingType(PrivatePreviewValue); + /// The offeringType is PublicPreview. + public static PlaywrightTestingOfferingType PublicPreview { get; } = new PlaywrightTestingOfferingType(PublicPreviewValue); + /// The offeringType is GeneralAvailability. + public static PlaywrightTestingOfferingType GeneralAvailability { get; } = new PlaywrightTestingOfferingType(GeneralAvailabilityValue); + /// Determines if two values are the same. + public static bool operator ==(PlaywrightTestingOfferingType left, PlaywrightTestingOfferingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PlaywrightTestingOfferingType left, PlaywrightTestingOfferingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PlaywrightTestingOfferingType(string value) => new PlaywrightTestingOfferingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PlaywrightTestingOfferingType other && Equals(other); + /// + public bool Equals(PlaywrightTestingOfferingType 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/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingProvisioningState.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingProvisioningState.cs index 2e47e5a29821..ef32459a5c55 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingProvisioningState.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingProvisioningState.cs @@ -25,6 +25,7 @@ public PlaywrightTestingProvisioningState(string value) private const string SucceededValue = "Succeeded"; private const string FailedValue = "Failed"; private const string CanceledValue = "Canceled"; + private const string CreatingValue = "Creating"; private const string DeletingValue = "Deleting"; private const string AcceptedValue = "Accepted"; @@ -34,9 +35,11 @@ public PlaywrightTestingProvisioningState(string value) public static PlaywrightTestingProvisioningState Failed { get; } = new PlaywrightTestingProvisioningState(FailedValue); /// Resource creation was canceled. public static PlaywrightTestingProvisioningState Canceled { get; } = new PlaywrightTestingProvisioningState(CanceledValue); - /// Deletion in progress. + /// Creation in progress.. + public static PlaywrightTestingProvisioningState Creating { get; } = new PlaywrightTestingProvisioningState(CreatingValue); + /// Deletion in progress.. public static PlaywrightTestingProvisioningState Deleting { get; } = new PlaywrightTestingProvisioningState(DeletingValue); - /// Change accepted for processing. + /// Change accepted for processing.. public static PlaywrightTestingProvisioningState Accepted { get; } = new PlaywrightTestingProvisioningState(AcceptedValue); /// Determines if two values are the same. public static bool operator ==(PlaywrightTestingProvisioningState left, PlaywrightTestingProvisioningState right) => left.Equals(right); diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaName.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaName.cs index ec70470da0d0..6c80598cdb8a 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaName.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaName.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.PlaywrightTesting.Models { - /// The PlaywrightTestingQuotaName. + /// The enum for quota name. public readonly partial struct PlaywrightTestingQuotaName : IEquatable { private readonly string _value; @@ -23,9 +23,12 @@ public PlaywrightTestingQuotaName(string value) } private const string ScalableExecutionValue = "ScalableExecution"; + private const string ReportingValue = "Reporting"; /// The quota details for scalable execution feature. When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. public static PlaywrightTestingQuotaName ScalableExecution { get; } = new PlaywrightTestingQuotaName(ScalableExecutionValue); + /// The quota details for reporting feature. When enabled, Playwright client will be able to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + public static PlaywrightTestingQuotaName Reporting { get; } = new PlaywrightTestingQuotaName(ReportingValue); /// Determines if two values are the same. public static bool operator ==(PlaywrightTestingQuotaName left, PlaywrightTestingQuotaName right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaProperties.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaProperties.Serialization.cs new file mode 100644 index 000000000000..a48fbf1ed9f4 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaProperties.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + public partial class PlaywrightTestingQuotaProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingQuotaProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FreeTrial)) + { + writer.WritePropertyName("freeTrial"u8); + writer.WriteObjectValue(FreeTrial, options); + } + if (options.Format != "W" && Optional.IsDefined(OfferingType)) + { + writer.WritePropertyName("offeringType"u8); + writer.WriteStringValue(OfferingType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PlaywrightTestingQuotaProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingQuotaProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlaywrightTestingQuotaProperties(document.RootElement, options); + } + + internal static PlaywrightTestingQuotaProperties DeserializePlaywrightTestingQuotaProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlaywrightTestingFreeTrialProperties freeTrial = default; + PlaywrightTestingOfferingType? offeringType = default; + PlaywrightTestingProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("freeTrial"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + freeTrial = PlaywrightTestingFreeTrialProperties.DeserializePlaywrightTestingFreeTrialProperties(property.Value, options); + continue; + } + if (property.NameEquals("offeringType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offeringType = new PlaywrightTestingOfferingType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new PlaywrightTestingProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PlaywrightTestingQuotaProperties(freeTrial, offeringType, provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PlaywrightTestingQuotaProperties)} does not support writing '{options.Format}' format."); + } + } + + PlaywrightTestingQuotaProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePlaywrightTestingQuotaProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PlaywrightTestingQuotaProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaProperties.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaProperties.cs new file mode 100644 index 000000000000..79c32aa77660 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/Models/PlaywrightTestingQuotaProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.PlaywrightTesting.Models +{ + /// The subscription quota resource properties. + public partial class PlaywrightTestingQuotaProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal PlaywrightTestingQuotaProperties() + { + } + + /// Initializes a new instance of . + /// The subscription quota resource free-trial properties. + /// Indicates the offering type for the subscription. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal PlaywrightTestingQuotaProperties(PlaywrightTestingFreeTrialProperties freeTrial, PlaywrightTestingOfferingType? offeringType, PlaywrightTestingProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + FreeTrial = freeTrial; + OfferingType = offeringType; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The subscription quota resource free-trial properties. + public PlaywrightTestingFreeTrialProperties FreeTrial { get; } + /// Indicates the offering type for the subscription. + public PlaywrightTestingOfferingType? OfferingType { get; } + /// The status of the last operation. + public PlaywrightTestingProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountCollection.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountCollection.cs index a8972bf5fbf5..0f30335e26c2 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountCollection.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountCollection.cs @@ -57,15 +57,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_CreateOrUpdate + /// Account_CreateOrUpdate /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -74,22 +74,22 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Name of account. + /// Name of account. /// Resource create parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string name, PlaywrightTestingAccountData data, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string accountName, PlaywrightTestingAccountData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _playwrightTestingAccountAccountsClientDiagnostics.CreateScope("PlaywrightTestingAccountCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _playwrightTestingAccountAccountsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken).ConfigureAwait(false); - var operation = new PlaywrightTestingArmOperation(new PlaywrightTestingAccountOperationSource(Client), _playwrightTestingAccountAccountsClientDiagnostics, Pipeline, _playwrightTestingAccountAccountsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _playwrightTestingAccountAccountsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, data, cancellationToken).ConfigureAwait(false); + var operation = new PlaywrightTestingArmOperation(new PlaywrightTestingAccountOperationSource(Client), _playwrightTestingAccountAccountsClientDiagnostics, Pipeline, _playwrightTestingAccountAccountsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, accountName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -106,15 +106,15 @@ public virtual async Task> Create /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_CreateOrUpdate + /// Account_CreateOrUpdate /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -123,22 +123,22 @@ public virtual async Task> Create /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Name of account. + /// Name of account. /// Resource create parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string name, PlaywrightTestingAccountData data, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string accountName, PlaywrightTestingAccountData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); Argument.AssertNotNull(data, nameof(data)); using var scope = _playwrightTestingAccountAccountsClientDiagnostics.CreateScope("PlaywrightTestingAccountCollection.CreateOrUpdate"); scope.Start(); try { - var response = _playwrightTestingAccountAccountsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken); - var operation = new PlaywrightTestingArmOperation(new PlaywrightTestingAccountOperationSource(Client), _playwrightTestingAccountAccountsClientDiagnostics, Pipeline, _playwrightTestingAccountAccountsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _playwrightTestingAccountAccountsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, accountName, data, cancellationToken); + var operation = new PlaywrightTestingArmOperation(new PlaywrightTestingAccountOperationSource(Client), _playwrightTestingAccountAccountsClientDiagnostics, Pipeline, _playwrightTestingAccountAccountsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, accountName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -155,15 +155,15 @@ public virtual ArmOperation CreateOrUpdate(Wai /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -171,19 +171,19 @@ public virtual ArmOperation CreateOrUpdate(Wai /// /// /// - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string name, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string accountName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); using var scope = _playwrightTestingAccountAccountsClientDiagnostics.CreateScope("PlaywrightTestingAccountCollection.Get"); scope.Start(); try { - var response = await _playwrightTestingAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false); + var response = await _playwrightTestingAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingAccountResource(Client, response.Value), response.GetRawResponse()); @@ -200,15 +200,15 @@ public virtual async Task> GetAsync(s /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -216,19 +216,19 @@ public virtual async Task> GetAsync(s /// /// /// - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string name, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string accountName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); using var scope = _playwrightTestingAccountAccountsClientDiagnostics.CreateScope("PlaywrightTestingAccountCollection.Get"); scope.Start(); try { - var response = _playwrightTestingAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken); + var response = _playwrightTestingAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingAccountResource(Client, response.Value), response.GetRawResponse()); @@ -249,11 +249,11 @@ public virtual Response Get(string name, Cance /// /// /// Operation Id - /// Accounts_ListByResourceGroup + /// Account_ListByResourceGroup /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -279,11 +279,11 @@ public virtual AsyncPageable GetAllAsync(Cance /// /// /// Operation Id - /// Accounts_ListByResourceGroup + /// Account_ListByResourceGroup /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -305,15 +305,15 @@ public virtual Pageable GetAll(CancellationTok /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -321,19 +321,19 @@ public virtual Pageable GetAll(CancellationTok /// /// /// - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string name, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string accountName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); using var scope = _playwrightTestingAccountAccountsClientDiagnostics.CreateScope("PlaywrightTestingAccountCollection.Exists"); scope.Start(); try { - var response = await _playwrightTestingAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _playwrightTestingAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -348,15 +348,15 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -364,19 +364,19 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string name, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string accountName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); using var scope = _playwrightTestingAccountAccountsClientDiagnostics.CreateScope("PlaywrightTestingAccountCollection.Exists"); scope.Start(); try { - var response = _playwrightTestingAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + var response = _playwrightTestingAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -391,15 +391,15 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -407,19 +407,19 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string name, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string accountName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); using var scope = _playwrightTestingAccountAccountsClientDiagnostics.CreateScope("PlaywrightTestingAccountCollection.GetIfExists"); scope.Start(); try { - var response = await _playwrightTestingAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _playwrightTestingAccountAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingAccountResource(Client, response.Value), response.GetRawResponse()); @@ -436,15 +436,15 @@ public virtual async Task> Ge /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -452,19 +452,19 @@ public virtual async Task> Ge /// /// /// - /// Name of account. + /// Name of account. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string name, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accountName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); using var scope = _playwrightTestingAccountAccountsClientDiagnostics.CreateScope("PlaywrightTestingAccountCollection.GetIfExists"); scope.Start(); try { - var response = _playwrightTestingAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + var response = _playwrightTestingAccountAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, accountName, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingAccountResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountData.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountData.Serialization.cs index 060b4ff212bc..5aa13413d2e7 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountData.Serialization.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountData.Serialization.cs @@ -37,34 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(DashboardUri)) - { - writer.WritePropertyName("dashboardUri"u8); - writer.WriteStringValue(DashboardUri.AbsoluteUri); - } - if (Optional.IsDefined(RegionalAffinity)) - { - writer.WritePropertyName("regionalAffinity"u8); - writer.WriteStringValue(RegionalAffinity.Value.ToString()); - } - if (Optional.IsDefined(ScalableExecution)) - { - writer.WritePropertyName("scalableExecution"u8); - writer.WriteStringValue(ScalableExecution.Value.ToString()); - } - if (Optional.IsDefined(Reporting)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("reporting"u8); - writer.WriteStringValue(Reporting.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - writer.WriteEndObject(); } PlaywrightTestingAccountData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -87,21 +64,26 @@ internal static PlaywrightTestingAccountData DeserializePlaywrightTestingAccount { return null; } + PlaywrightTestingAccountProperties properties = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - Uri dashboardUri = default; - EnablementStatus? regionalAffinity = default; - EnablementStatus? scalableExecution = default; - EnablementStatus? reporting = default; - PlaywrightTestingProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PlaywrightTestingAccountProperties.DeserializePlaywrightTestingAccountProperties(property.Value, options); + continue; + } if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -145,63 +127,6 @@ internal static PlaywrightTestingAccountData DeserializePlaywrightTestingAccount systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("dashboardUri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dashboardUri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("regionalAffinity"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - regionalAffinity = new EnablementStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("scalableExecution"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scalableExecution = new EnablementStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("reporting"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - reporting = new EnablementStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new PlaywrightTestingProvisioningState(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -215,11 +140,7 @@ internal static PlaywrightTestingAccountData DeserializePlaywrightTestingAccount systemData, tags ?? new ChangeTrackingDictionary(), location, - dashboardUri, - regionalAffinity, - scalableExecution, - reporting, - provisioningState, + properties, serializedAdditionalRawData); } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountData.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountData.cs index a52fd81e34f6..599008a12c6a 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountData.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountData.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.PlaywrightTesting { /// /// A class representing the PlaywrightTestingAccount data model. - /// An account resource + /// A Playwright service account resource. /// public partial class PlaywrightTestingAccountData : TrackedResourceData { @@ -64,19 +64,11 @@ public PlaywrightTestingAccountData(AzureLocation location) : base(location) /// The systemData. /// The tags. /// The location. - /// The Playwright testing dashboard URI for the account resource. - /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. - /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. - /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. - /// The status of the last operation. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal PlaywrightTestingAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, Uri dashboardUri, EnablementStatus? regionalAffinity, EnablementStatus? scalableExecution, EnablementStatus? reporting, PlaywrightTestingProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal PlaywrightTestingAccountData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PlaywrightTestingAccountProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { - DashboardUri = dashboardUri; - RegionalAffinity = regionalAffinity; - ScalableExecution = scalableExecution; - Reporting = reporting; - ProvisioningState = provisioningState; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,15 +77,7 @@ internal PlaywrightTestingAccountData() { } - /// The Playwright testing dashboard URI for the account resource. - public Uri DashboardUri { get; } - /// This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. - public EnablementStatus? RegionalAffinity { get; set; } - /// When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. - public EnablementStatus? ScalableExecution { get; set; } - /// When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. - public EnablementStatus? Reporting { get; set; } - /// The status of the last operation. - public PlaywrightTestingProvisioningState? ProvisioningState { get; } + /// The resource-specific properties for this resource. + public PlaywrightTestingAccountProperties Properties { get; set; } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaCollection.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaCollection.cs new file mode 100644 index 000000000000..2f561bc56cbd --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaCollection.cs @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.PlaywrightTesting.Models; + +namespace Azure.ResourceManager.PlaywrightTesting +{ + /// + /// 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 GetPlaywrightTestingAccountQuotas method from an instance of . + /// + public partial class PlaywrightTestingAccountQuotaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics; + private readonly AccountQuotasRestOperations _playwrightTestingAccountQuotaAccountQuotasRestClient; + + /// Initializes a new instance of the class for mocking. + protected PlaywrightTestingAccountQuotaCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal PlaywrightTestingAccountQuotaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.PlaywrightTesting", PlaywrightTestingAccountQuotaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PlaywrightTestingAccountQuotaResource.ResourceType, out string playwrightTestingAccountQuotaAccountQuotasApiVersion); + _playwrightTestingAccountQuotaAccountQuotasRestClient = new AccountQuotasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, playwrightTestingAccountQuotaAccountQuotasApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PlaywrightTestingAccountResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PlaywrightTestingAccountResource.ResourceType), nameof(id)); + } + + /// + /// Get quota by name for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Playwright service account quota name. + /// The cancellation token to use. + public virtual async Task> GetAsync(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + using var scope = _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics.CreateScope("PlaywrightTestingAccountQuotaCollection.Get"); + scope.Start(); + try + { + var response = await _playwrightTestingAccountQuotaAccountQuotasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, quotaName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PlaywrightTestingAccountQuotaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get quota by name for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Playwright service account quota name. + /// The cancellation token to use. + public virtual Response Get(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + using var scope = _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics.CreateScope("PlaywrightTestingAccountQuotaCollection.Get"); + scope.Start(); + try + { + var response = _playwrightTestingAccountQuotaAccountQuotasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, quotaName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PlaywrightTestingAccountQuotaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List quotas for a given account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas + /// + /// + /// Operation Id + /// AccountQuota_ListByAccount + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _playwrightTestingAccountQuotaAccountQuotasRestClient.CreateListByAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _playwrightTestingAccountQuotaAccountQuotasRestClient.CreateListByAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PlaywrightTestingAccountQuotaResource(Client, PlaywrightTestingAccountQuotaData.DeserializePlaywrightTestingAccountQuotaData(e)), _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics, Pipeline, "PlaywrightTestingAccountQuotaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List quotas for a given account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas + /// + /// + /// Operation Id + /// AccountQuota_ListByAccount + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _playwrightTestingAccountQuotaAccountQuotasRestClient.CreateListByAccountRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _playwrightTestingAccountQuotaAccountQuotasRestClient.CreateListByAccountNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PlaywrightTestingAccountQuotaResource(Client, PlaywrightTestingAccountQuotaData.DeserializePlaywrightTestingAccountQuotaData(e)), _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics, Pipeline, "PlaywrightTestingAccountQuotaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Playwright service account quota name. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + using var scope = _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics.CreateScope("PlaywrightTestingAccountQuotaCollection.Exists"); + scope.Start(); + try + { + var response = await _playwrightTestingAccountQuotaAccountQuotasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, quotaName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Playwright service account quota name. + /// The cancellation token to use. + public virtual Response Exists(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + using var scope = _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics.CreateScope("PlaywrightTestingAccountQuotaCollection.Exists"); + scope.Start(); + try + { + var response = _playwrightTestingAccountQuotaAccountQuotasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, quotaName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Playwright service account quota name. + /// The cancellation token to use. + public virtual async Task> GetIfExistsAsync(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + using var scope = _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics.CreateScope("PlaywrightTestingAccountQuotaCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _playwrightTestingAccountQuotaAccountQuotasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, quotaName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PlaywrightTestingAccountQuotaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Playwright service account quota name. + /// The cancellation token to use. + public virtual NullableResponse GetIfExists(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + using var scope = _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics.CreateScope("PlaywrightTestingAccountQuotaCollection.GetIfExists"); + scope.Start(); + try + { + var response = _playwrightTestingAccountQuotaAccountQuotasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, quotaName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new PlaywrightTestingAccountQuotaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaData.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaData.Serialization.cs new file mode 100644 index 000000000000..1413bf1aa4d3 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.PlaywrightTesting.Models; + +namespace Azure.ResourceManager.PlaywrightTesting +{ + public partial class PlaywrightTestingAccountQuotaData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingAccountQuotaData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + PlaywrightTestingAccountQuotaData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PlaywrightTestingAccountQuotaData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePlaywrightTestingAccountQuotaData(document.RootElement, options); + } + + internal static PlaywrightTestingAccountQuotaData DeserializePlaywrightTestingAccountQuotaData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlaywrightTestingAccountQuotaProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PlaywrightTestingAccountQuotaProperties.DeserializePlaywrightTestingAccountQuotaProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PlaywrightTestingAccountQuotaData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PlaywrightTestingAccountQuotaData)} does not support writing '{options.Format}' format."); + } + } + + PlaywrightTestingAccountQuotaData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePlaywrightTestingAccountQuotaData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PlaywrightTestingAccountQuotaData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaData.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaData.cs new file mode 100644 index 000000000000..2c978269e3d3 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.PlaywrightTesting.Models; + +namespace Azure.ResourceManager.PlaywrightTesting +{ + /// + /// A class representing the PlaywrightTestingAccountQuota data model. + /// A quota resource for a Playwright service account. + /// + public partial class PlaywrightTestingAccountQuotaData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal PlaywrightTestingAccountQuotaData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal PlaywrightTestingAccountQuotaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PlaywrightTestingAccountQuotaProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public PlaywrightTestingAccountQuotaProperties Properties { get; } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaResource.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaResource.Serialization.cs new file mode 100644 index 000000000000..82d6080bcc56 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.PlaywrightTesting +{ + public partial class PlaywrightTestingAccountQuotaResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + PlaywrightTestingAccountQuotaData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + PlaywrightTestingAccountQuotaData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaResource.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaResource.cs new file mode 100644 index 000000000000..122f15bb738b --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountQuotaResource.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.PlaywrightTesting.Models; + +namespace Azure.ResourceManager.PlaywrightTesting +{ + /// + /// A Class representing a PlaywrightTestingAccountQuota 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 GetPlaywrightTestingAccountQuotaResource method. + /// Otherwise you can get one from its parent resource using the GetPlaywrightTestingAccountQuota method. + /// + public partial class PlaywrightTestingAccountQuotaResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The quotaName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingQuotaName quotaName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics; + private readonly AccountQuotasRestOperations _playwrightTestingAccountQuotaAccountQuotasRestClient; + private readonly PlaywrightTestingAccountQuotaData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AzurePlaywrightService/accounts/quotas"; + + /// Initializes a new instance of the class for mocking. + protected PlaywrightTestingAccountQuotaResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PlaywrightTestingAccountQuotaResource(ArmClient client, PlaywrightTestingAccountQuotaData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal PlaywrightTestingAccountQuotaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.PlaywrightTesting", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string playwrightTestingAccountQuotaAccountQuotasApiVersion); + _playwrightTestingAccountQuotaAccountQuotasRestClient = new AccountQuotasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, playwrightTestingAccountQuotaAccountQuotasApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PlaywrightTestingAccountQuotaData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get quota by name for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics.CreateScope("PlaywrightTestingAccountQuotaResource.Get"); + scope.Start(); + try + { + var response = await _playwrightTestingAccountQuotaAccountQuotasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PlaywrightTestingAccountQuotaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get quota by name for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _playwrightTestingAccountQuotaAccountQuotasClientDiagnostics.CreateScope("PlaywrightTestingAccountQuotaResource.Get"); + scope.Start(); + try + { + var response = _playwrightTestingAccountQuotaAccountQuotasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PlaywrightTestingAccountQuotaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountResource.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountResource.cs index c0142b77e95d..0b9bdec6c3ad 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountResource.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingAccountResource.cs @@ -28,10 +28,10 @@ public partial class PlaywrightTestingAccountResource : ArmResource /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) + /// The accountName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName) { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}"; + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}"; return new ResourceIdentifier(resourceId); } @@ -90,20 +90,85 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } + /// Gets a collection of PlaywrightTestingAccountQuotaResources in the PlaywrightTestingAccount. + /// An object representing collection of PlaywrightTestingAccountQuotaResources and their operations over a PlaywrightTestingAccountQuotaResource. + public virtual PlaywrightTestingAccountQuotaCollection GetAllPlaywrightTestingAccountQuota() + { + return GetCachedClient(client => new PlaywrightTestingAccountQuotaCollection(client, Id)); + } + + /// + /// Get quota by name for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Playwright service account quota name. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual async Task> GetPlaywrightTestingAccountQuotaAsync(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + return await GetAllPlaywrightTestingAccountQuota().GetAsync(quotaName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get quota by name for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName} + /// + /// + /// Operation Id + /// AccountQuota_Get + /// + /// + /// Default Api Version + /// 2024-12-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Playwright service account quota name. + /// The cancellation token to use. + [ForwardsClientCalls] + public virtual Response GetPlaywrightTestingAccountQuota(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + return GetAllPlaywrightTestingAccountQuota().Get(quotaName, cancellationToken); + } + /// /// Get a Account /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -135,15 +200,15 @@ public virtual async Task> GetAsync(C /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -175,15 +240,15 @@ public virtual Response Get(CancellationToken /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Delete + /// Account_Delete /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -217,15 +282,15 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Delete + /// Account_Delete /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -259,15 +324,15 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Update + /// Account_Update /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -301,15 +366,15 @@ public virtual async Task> UpdateAsyn /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Update + /// Account_Update /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -343,15 +408,15 @@ public virtual Response Update(PlaywrightTesti /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -405,15 +470,15 @@ public virtual async Task> AddTagAsyn /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -467,15 +532,15 @@ public virtual Response AddTag(string key, str /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -524,15 +589,15 @@ public virtual async Task> SetTagsAsy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -581,15 +646,15 @@ public virtual Response SetTags(IDictionary /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -641,15 +706,15 @@ public virtual async Task> RemoveTagA /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName} /// /// /// Operation Id - /// Accounts_Get + /// Account_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaCollection.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaCollection.cs index 46c3f62e9537..85292fdfd9f4 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaCollection.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaCollection.cs @@ -28,7 +28,7 @@ public partial class PlaywrightTestingQuotaCollection : ArmCollection, IEnumerab { private readonly ClientDiagnostics _playwrightTestingQuotaQuotasClientDiagnostics; private readonly QuotasRestOperations _playwrightTestingQuotaQuotasRestClient; - private readonly AzureLocation _location; + private readonly string _location; /// Initializes a new instance of the class for mocking. protected PlaywrightTestingQuotaCollection() @@ -39,7 +39,9 @@ protected PlaywrightTestingQuotaCollection() /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. - internal PlaywrightTestingQuotaCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) + /// is null. + /// is an empty string, and was expected to be non-empty. + internal PlaywrightTestingQuotaCollection(ArmClient client, ResourceIdentifier id, string location) : base(client, id) { _location = location; _playwrightTestingQuotaQuotasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.PlaywrightTesting", PlaywrightTestingQuotaResource.ResourceType.Namespace, Diagnostics); @@ -57,19 +59,19 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Get quota by name. + /// Get subscription quota by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -77,15 +79,15 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// - /// The quota name. + /// The quota name. /// The cancellation token to use. - public virtual async Task> GetAsync(PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { using var scope = _playwrightTestingQuotaQuotasClientDiagnostics.CreateScope("PlaywrightTestingQuotaCollection.Get"); scope.Start(); try { - var response = await _playwrightTestingQuotaQuotasRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), name, cancellationToken).ConfigureAwait(false); + var response = await _playwrightTestingQuotaQuotasRestClient.GetAsync(Id.SubscriptionId, _location, quotaName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingQuotaResource(Client, response.Value), response.GetRawResponse()); @@ -98,19 +100,19 @@ public virtual async Task> GetAsync(Pla } /// - /// Get quota by name. + /// Get subscription quota by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -118,15 +120,15 @@ public virtual async Task> GetAsync(Pla /// /// /// - /// The quota name. + /// The quota name. /// The cancellation token to use. - public virtual Response Get(PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public virtual Response Get(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { using var scope = _playwrightTestingQuotaQuotasClientDiagnostics.CreateScope("PlaywrightTestingQuotaCollection.Get"); scope.Start(); try { - var response = _playwrightTestingQuotaQuotasRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), name, cancellationToken); + var response = _playwrightTestingQuotaQuotasRestClient.Get(Id.SubscriptionId, _location, quotaName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingQuotaResource(Client, response.Value), response.GetRawResponse()); @@ -147,11 +149,11 @@ public virtual Response Get(PlaywrightTestingQuo /// /// /// Operation Id - /// Quotas_ListBySubscription + /// Quota_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -163,8 +165,8 @@ public virtual Response Get(PlaywrightTestingQuo /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _playwrightTestingQuotaQuotasRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, new AzureLocation(_location)); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _playwrightTestingQuotaQuotasRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); + HttpMessage FirstPageRequest(int? pageSizeHint) => _playwrightTestingQuotaQuotasRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, _location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _playwrightTestingQuotaQuotasRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, _location); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new PlaywrightTestingQuotaResource(Client, PlaywrightTestingQuotaData.DeserializePlaywrightTestingQuotaData(e)), _playwrightTestingQuotaQuotasClientDiagnostics, Pipeline, "PlaywrightTestingQuotaCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -177,11 +179,11 @@ public virtual AsyncPageable GetAllAsync(Cancell /// /// /// Operation Id - /// Quotas_ListBySubscription + /// Quota_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -193,8 +195,8 @@ public virtual AsyncPageable GetAllAsync(Cancell /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _playwrightTestingQuotaQuotasRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, new AzureLocation(_location)); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _playwrightTestingQuotaQuotasRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); + HttpMessage FirstPageRequest(int? pageSizeHint) => _playwrightTestingQuotaQuotasRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, _location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _playwrightTestingQuotaQuotasRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, _location); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new PlaywrightTestingQuotaResource(Client, PlaywrightTestingQuotaData.DeserializePlaywrightTestingQuotaData(e)), _playwrightTestingQuotaQuotasClientDiagnostics, Pipeline, "PlaywrightTestingQuotaCollection.GetAll", "value", "nextLink", cancellationToken); } @@ -203,15 +205,15 @@ public virtual Pageable GetAll(CancellationToken /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -219,15 +221,15 @@ public virtual Pageable GetAll(CancellationToken /// /// /// - /// The quota name. + /// The quota name. /// The cancellation token to use. - public virtual async Task> ExistsAsync(PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public virtual async Task> ExistsAsync(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { using var scope = _playwrightTestingQuotaQuotasClientDiagnostics.CreateScope("PlaywrightTestingQuotaCollection.Exists"); scope.Start(); try { - var response = await _playwrightTestingQuotaQuotasRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _playwrightTestingQuotaQuotasRestClient.GetAsync(Id.SubscriptionId, _location, quotaName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -242,15 +244,15 @@ public virtual async Task> ExistsAsync(PlaywrightTestingQuotaName /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -258,15 +260,15 @@ public virtual async Task> ExistsAsync(PlaywrightTestingQuotaName /// /// /// - /// The quota name. + /// The quota name. /// The cancellation token to use. - public virtual Response Exists(PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public virtual Response Exists(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { using var scope = _playwrightTestingQuotaQuotasClientDiagnostics.CreateScope("PlaywrightTestingQuotaCollection.Exists"); scope.Start(); try { - var response = _playwrightTestingQuotaQuotasRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), name, cancellationToken: cancellationToken); + var response = _playwrightTestingQuotaQuotasRestClient.Get(Id.SubscriptionId, _location, quotaName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -281,15 +283,15 @@ public virtual Response Exists(PlaywrightTestingQuotaName name, Cancellati /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -297,15 +299,15 @@ public virtual Response Exists(PlaywrightTestingQuotaName name, Cancellati /// /// /// - /// The quota name. + /// The quota name. /// The cancellation token to use. - public virtual async Task> GetIfExistsAsync(PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { using var scope = _playwrightTestingQuotaQuotasClientDiagnostics.CreateScope("PlaywrightTestingQuotaCollection.GetIfExists"); scope.Start(); try { - var response = await _playwrightTestingQuotaQuotasRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _playwrightTestingQuotaQuotasRestClient.GetAsync(Id.SubscriptionId, _location, quotaName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingQuotaResource(Client, response.Value), response.GetRawResponse()); @@ -322,15 +324,15 @@ public virtual async Task> GetI /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -338,15 +340,15 @@ public virtual async Task> GetI /// /// /// - /// The quota name. + /// The quota name. /// The cancellation token to use. - public virtual NullableResponse GetIfExists(PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { using var scope = _playwrightTestingQuotaQuotasClientDiagnostics.CreateScope("PlaywrightTestingQuotaCollection.GetIfExists"); scope.Start(); try { - var response = _playwrightTestingQuotaQuotasRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), name, cancellationToken: cancellationToken); + var response = _playwrightTestingQuotaQuotasRestClient.Get(Id.SubscriptionId, _location, quotaName, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingQuotaResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaData.Serialization.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaData.Serialization.cs index 88de95a31d92..fcb4a96dfe0f 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaData.Serialization.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaData.Serialization.cs @@ -37,19 +37,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(FreeTrial)) - { - writer.WritePropertyName("freeTrial"u8); - writer.WriteObjectValue(FreeTrial, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + if (Optional.IsDefined(Properties)) { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - writer.WriteEndObject(); } PlaywrightTestingQuotaData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -72,16 +64,24 @@ internal static PlaywrightTestingQuotaData DeserializePlaywrightTestingQuotaData { return null; } + PlaywrightTestingQuotaProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - FreeTrialProperties freeTrial = default; - PlaywrightTestingProvisioningState? provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = PlaywrightTestingQuotaProperties.DeserializePlaywrightTestingQuotaProperties(property.Value, options); + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -106,36 +106,6 @@ internal static PlaywrightTestingQuotaData DeserializePlaywrightTestingQuotaData systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("freeTrial"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - freeTrial = FreeTrialProperties.DeserializeFreeTrialProperties(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new PlaywrightTestingProvisioningState(property0.Value.GetString()); - continue; - } - } - continue; - } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -147,8 +117,7 @@ internal static PlaywrightTestingQuotaData DeserializePlaywrightTestingQuotaData name, type, systemData, - freeTrial, - provisioningState, + properties, serializedAdditionalRawData); } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaData.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaData.cs index 3fa5e8103e20..055e48773351 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaData.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaData.cs @@ -15,7 +15,7 @@ namespace Azure.ResourceManager.PlaywrightTesting { /// /// A class representing the PlaywrightTestingQuota data model. - /// A quota resource + /// A subscription quota resource. /// public partial class PlaywrightTestingQuotaData : ResourceData { @@ -52,7 +52,7 @@ public partial class PlaywrightTestingQuotaData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public PlaywrightTestingQuotaData() + internal PlaywrightTestingQuotaData() { } @@ -61,19 +61,15 @@ public PlaywrightTestingQuotaData() /// The name. /// The resourceType. /// The systemData. - /// The free-trial quota. - /// The status of the last operation. + /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal PlaywrightTestingQuotaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, FreeTrialProperties freeTrial, PlaywrightTestingProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal PlaywrightTestingQuotaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PlaywrightTestingQuotaProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - FreeTrial = freeTrial; - ProvisioningState = provisioningState; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The free-trial quota. - public FreeTrialProperties FreeTrial { get; set; } - /// The status of the last operation. - public PlaywrightTestingProvisioningState? ProvisioningState { get; } + /// The resource-specific properties for this resource. + public PlaywrightTestingQuotaProperties Properties { get; } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaResource.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaResource.cs index 9e0df63a1688..520475a00b75 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaResource.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/PlaywrightTestingQuotaResource.cs @@ -27,10 +27,10 @@ public partial class PlaywrightTestingQuotaResource : ArmResource /// Generate the resource identifier of a instance. /// The subscriptionId. /// The location. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, PlaywrightTestingQuotaName name) + /// The quotaName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, PlaywrightTestingQuotaName quotaName) { - var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name}"; + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}"; return new ResourceIdentifier(resourceId); } @@ -90,19 +90,19 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Get quota by name. + /// Get subscription quota by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -117,7 +117,7 @@ public virtual async Task> GetAsync(Can scope.Start(); try { - var response = await _playwrightTestingQuotaQuotasRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _playwrightTestingQuotaQuotasRestClient.GetAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingQuotaResource(Client, response.Value), response.GetRawResponse()); @@ -130,19 +130,19 @@ public virtual async Task> GetAsync(Can } /// - /// Get quota by name. + /// Get subscription quota by name. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name} + /// /subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName} /// /// /// Operation Id - /// Quotas_Get + /// Quota_Get /// /// /// Default Api Version - /// 2023-10-01-preview + /// 2024-12-01 /// /// /// Resource @@ -157,7 +157,7 @@ public virtual Response Get(CancellationToken ca scope.Start(); try { - var response = _playwrightTestingQuotaQuotasRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + var response = _playwrightTestingQuotaQuotasRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new PlaywrightTestingQuotaResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/AccountQuotasRestOperations.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/AccountQuotasRestOperations.cs new file mode 100644 index 000000000000..a81831f6b1ba --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/AccountQuotasRestOperations.cs @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.PlaywrightTesting.Models; + +namespace Azure.ResourceManager.PlaywrightTesting +{ + internal partial class AccountQuotasRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AccountQuotasRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public AccountQuotasRestOperations(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 ?? "2024-12-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingQuotaName quotaName) + { + 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.AzurePlaywrightService/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/quotas/", false); + uri.AppendPath(quotaName.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingQuotaName quotaName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/quotas/", false); + uri.AppendPath(quotaName.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get quota by name for an account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of account. + /// The Playwright service account quota name. + /// 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 accountName, PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, quotaName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PlaywrightTestingAccountQuotaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PlaywrightTestingAccountQuotaData.DeserializePlaywrightTestingAccountQuotaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PlaywrightTestingAccountQuotaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get quota by name for an account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of account. + /// The Playwright service account quota name. + /// 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 accountName, PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, quotaName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PlaywrightTestingAccountQuotaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PlaywrightTestingAccountQuotaData.DeserializePlaywrightTestingAccountQuotaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PlaywrightTestingAccountQuotaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByAccountRequestUri(string subscriptionId, string resourceGroupName, string accountName) + { + 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.AzurePlaywrightService/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/quotas", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByAccountRequest(string subscriptionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/quotas", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List quotas for a given account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of account. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByAccountAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListByAccountRequest(subscriptionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AccountQuotaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AccountQuotaListResult.DeserializeAccountQuotaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List quotas for a given account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of account. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByAccount(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListByAccountRequest(subscriptionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AccountQuotaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AccountQuotaListResult.DeserializeAccountQuotaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByAccountNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByAccountNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List quotas for a given account. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of account. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByAccountNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListByAccountNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AccountQuotaListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AccountQuotaListResult.DeserializeAccountQuotaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List quotas for a given account. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of account. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByAccountNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListByAccountNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AccountQuotaListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AccountQuotaListResult.DeserializeAccountQuotaListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/AccountsRestOperations.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/AccountsRestOperations.cs index 3a09ccf89ae7..c5c311d28ceb 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/AccountsRestOperations.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/AccountsRestOperations.cs @@ -25,29 +25,32 @@ internal partial class AccountsRestOperations /// Initializes a new instance of AccountsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public AccountsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01-preview"; + _apiVersion = apiVersion ?? "2024-12-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); + uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -56,7 +59,10 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); + uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -64,57 +70,69 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) return message; } - /// List Account resources by subscription ID. - /// The ID of the target subscription. + /// Get a Account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of account. /// 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var message = CreateListBySubscriptionRequest(subscriptionId); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - AccountListResult value = default; + PlaywrightTestingAccountData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AccountListResult.DeserializeAccountListResult(document.RootElement); + value = PlaywrightTestingAccountData.DeserializePlaywrightTestingAccountData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((PlaywrightTestingAccountData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// List Account resources by subscription ID. - /// The ID of the target subscription. + /// Get a Account. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of account. /// 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var message = CreateListBySubscriptionRequest(subscriptionId); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - AccountListResult value = default; + PlaywrightTestingAccountData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AccountListResult.DeserializeAccountListResult(document.RootElement); + value = PlaywrightTestingAccountData.DeserializePlaywrightTestingAccountData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((PlaywrightTestingAccountData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingAccountData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -122,85 +140,91 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts", false); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); + uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingAccountData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + 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.AzurePlaywrightService/accounts", false); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); + uri.AppendPath(accountName, 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; } - /// List Account resources by resource group. - /// The ID of the target subscription. + /// Create a Account. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// Name of account. + /// Resource create parameters. /// 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingAccountData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - AccountListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AccountListResult.DeserializeAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 201: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// List Account resources by resource group. - /// The ID of the target subscription. + /// Create a Account. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// Name of account. + /// Resource create parameters. /// 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingAccountData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - AccountListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AccountListResult.DeserializeAccountListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 201: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingAccountPatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -209,16 +233,16 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); - uri.AppendPath(name, true); + uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingAccountPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -226,28 +250,34 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); - uri.AppendPath(name, true); + uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Get a Account. - /// The ID of the target subscription. + /// Update a Account. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Name of account. + /// Name of account. + /// The resource properties to be updated. /// 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 name, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingAccountPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -258,27 +288,27 @@ public async Task> GetAsync(string subscr value = PlaywrightTestingAccountData.DeserializePlaywrightTestingAccountData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((PlaywrightTestingAccountData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a Account. - /// The ID of the target subscription. + /// Update a Account. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Name of account. + /// Name of account. + /// The resource properties to be updated. /// 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 name, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string accountName, PlaywrightTestingAccountPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -289,14 +319,12 @@ public Response Get(string subscriptionId, string value = PlaywrightTestingAccountData.DeserializePlaywrightTestingAccountData(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((PlaywrightTestingAccountData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, PlaywrightTestingAccountData data) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -305,16 +333,16 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); - uri.AppendPath(name, true); + uri.AppendPath(accountName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, PlaywrightTestingAccountData data) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -322,73 +350,65 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); - uri.AppendPath(name, true); + uri.AppendPath(accountName, 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; } - /// Create a Account. - /// The ID of the target subscription. + /// Delete a Account. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Name of account. - /// Resource create parameters. + /// Name of account. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string name, PlaywrightTestingAccountData data, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: - case 201: + case 202: + case 204: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Create a Account. - /// The ID of the target subscription. + /// Delete a Account. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Name of account. - /// Resource create parameters. + /// Name of account. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string name, PlaywrightTestingAccountData data, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: - case 201: + case 202: + case 204: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, PlaywrightTestingAccountPatch patch) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -396,60 +416,50 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); - uri.AppendPath(name, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, PlaywrightTestingAccountPatch patch) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); - uri.AppendPath(name, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Update a Account. - /// The ID of the target subscription. + /// List Account resources by resource group. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Name of account. - /// The resource properties to be updated. /// 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 name, PlaywrightTestingAccountPatch patch, CancellationToken cancellationToken = default) + /// 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)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, patch); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - PlaywrightTestingAccountData value = default; + AccountListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = PlaywrightTestingAccountData.DeserializePlaywrightTestingAccountData(document.RootElement); + value = AccountListResult.DeserializeAccountListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -457,30 +467,26 @@ public async Task> UpdateAsync(string sub } } - /// Update a Account. - /// The ID of the target subscription. + /// List Account resources by resource group. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// Name of account. - /// The resource properties to be updated. /// 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 name, PlaywrightTestingAccountPatch patch, CancellationToken cancellationToken = default) + /// 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) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, patch); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - PlaywrightTestingAccountData value = default; + AccountListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = PlaywrightTestingAccountData.DeserializePlaywrightTestingAccountData(document.RootElement); + value = AccountListResult.DeserializeAccountListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -488,33 +494,27 @@ public Response Update(string subscriptionId, stri } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name) + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) { 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.AzurePlaywrightService/accounts/", false); - uri.AppendPath(name, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts/", false); - uri.AppendPath(name, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/accounts", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -522,100 +522,108 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Delete a Account. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of account. + /// List Account resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. /// 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 name, CancellationToken cancellationToken = default) + /// 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)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name); + using var message = CreateListBySubscriptionRequest(subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - case 204: - return message.Response; + { + AccountListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AccountListResult.DeserializeAccountListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Delete a Account. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// Name of account. + /// List Account resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. /// 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 name, CancellationToken cancellationToken = default) + /// 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)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name); + using var message = CreateListBySubscriptionRequest(subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - case 204: - return message.Response; + { + AccountListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AccountListResult.DeserializeAccountListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + internal RequestUriBuilder CreateCheckPlaywrightTestingNameAvailabilityRequestUri(string subscriptionId, PlaywrightTestingNameAvailabilityContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + internal HttpMessage CreateCheckPlaywrightTestingNameAvailabilityRequest(string subscriptionId, PlaywrightTestingNameAvailabilityContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; _userAgent.Apply(message); return message; } - /// List Account resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. + /// Adds check global name availability operation, normally used if a resource name must be globally unique. + /// The ID of the target subscription. The value must be an UUID. + /// The CheckAvailability request. /// The cancellation token to use. - /// or is null. + /// 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) + public async Task> CheckPlaywrightTestingNameAvailabilityAsync(string subscriptionId, PlaywrightTestingNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateCheckPlaywrightTestingNameAvailabilityRequest(subscriptionId, content); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - AccountListResult value = default; + PlaywrightTestingNameAvailabilityResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AccountListResult.DeserializeAccountListResult(document.RootElement); + value = PlaywrightTestingNameAvailabilityResult.DeserializePlaywrightTestingNameAvailabilityResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -623,26 +631,26 @@ public async Task> ListBySubscriptionNextPageAsync(s } } - /// List Account resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. + /// Adds check global name availability operation, normally used if a resource name must be globally unique. + /// The ID of the target subscription. The value must be an UUID. + /// The CheckAvailability request. /// The cancellation token to use. - /// or is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + public Response CheckPlaywrightTestingNameAvailability(string subscriptionId, PlaywrightTestingNameAvailabilityContent content, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + using var message = CreateCheckPlaywrightTestingNameAvailabilityRequest(subscriptionId, content); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - AccountListResult value = default; + PlaywrightTestingNameAvailabilityResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AccountListResult.DeserializeAccountListResult(document.RootElement); + value = PlaywrightTestingNameAvailabilityResult.DeserializePlaywrightTestingNameAvailabilityResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -674,7 +682,7 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// List Account resources by resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -703,7 +711,7 @@ public async Task> ListByResourceGroupNextPageAsync( /// List Account resources by resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -729,5 +737,81 @@ public Response ListByResourceGroupNextPage(string nextLink, 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(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Account resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + AccountListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AccountListResult.DeserializeAccountListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Account resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// 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: + { + AccountListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AccountListResult.DeserializeAccountListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/QuotasRestOperations.cs b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/QuotasRestOperations.cs index 847b5ddbfa83..5a2d9a8afbd4 100644 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/QuotasRestOperations.cs +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/Generated/RestOperations/QuotasRestOperations.cs @@ -25,18 +25,18 @@ internal partial class QuotasRestOperations /// Initializes a new instance of QuotasRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public QuotasRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-10-01-preview"; + _apiVersion = apiVersion ?? "2024-12-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, AzureLocation location) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string location, PlaywrightTestingQuotaName quotaName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -44,12 +44,13 @@ internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptio uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/quotas", false); + uri.AppendPath("/quotas/", false); + uri.AppendPath(quotaName.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, AzureLocation location) + internal HttpMessage CreateGetRequest(string subscriptionId, string location, PlaywrightTestingQuotaName quotaName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -60,7 +61,8 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, Azur uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/quotas", false); + uri.AppendPath("/quotas/", false); + uri.AppendPath(quotaName.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -68,59 +70,67 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, Azur return message; } - /// List quotas for a given subscription Id. - /// The ID of the target subscription. + /// Get subscription quota by name. + /// The ID of the target subscription. The value must be an UUID. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. + /// The quota name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string location, PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var message = CreateListBySubscriptionRequest(subscriptionId, location); + using var message = CreateGetRequest(subscriptionId, location, quotaName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - QuotaListResult value = default; + PlaywrightTestingQuotaData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = QuotaListResult.DeserializeQuotaListResult(document.RootElement); + value = PlaywrightTestingQuotaData.DeserializePlaywrightTestingQuotaData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((PlaywrightTestingQuotaData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// List quotas for a given subscription Id. - /// The ID of the target subscription. + /// Get subscription quota by name. + /// The ID of the target subscription. The value must be an UUID. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. + /// The quota name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string location, PlaywrightTestingQuotaName quotaName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var message = CreateListBySubscriptionRequest(subscriptionId, location); + using var message = CreateGetRequest(subscriptionId, location, quotaName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - QuotaListResult value = default; + PlaywrightTestingQuotaData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = QuotaListResult.DeserializeQuotaListResult(document.RootElement); + value = PlaywrightTestingQuotaData.DeserializePlaywrightTestingQuotaData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((PlaywrightTestingQuotaData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, AzureLocation location, PlaywrightTestingQuotaName name) + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string location) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -128,13 +138,12 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, AzureLocat uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/quotas/", false); - uri.AppendPath(name.ToString(), true); + uri.AppendPath("/quotas", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation location, PlaywrightTestingQuotaName name) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string location) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -145,8 +154,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation locat uri.AppendPath(subscriptionId, true); uri.AppendPath("/providers/Microsoft.AzurePlaywrightService/locations/", false); uri.AppendPath(location, true); - uri.AppendPath("/quotas/", false); - uri.AppendPath(name.ToString(), true); + uri.AppendPath("/quotas", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -154,65 +162,61 @@ internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation locat return message; } - /// Get quota by name. - /// The ID of the target subscription. + /// List quotas for a given subscription Id. + /// The ID of the target subscription. The value must be an UUID. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. - /// The quota name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, AzureLocation location, PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var message = CreateGetRequest(subscriptionId, location, name); + using var message = CreateListBySubscriptionRequest(subscriptionId, location); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - PlaywrightTestingQuotaData value = default; + QuotaListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = PlaywrightTestingQuotaData.DeserializePlaywrightTestingQuotaData(document.RootElement); + value = QuotaListResult.DeserializeQuotaListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((PlaywrightTestingQuotaData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get quota by name. - /// The ID of the target subscription. + /// List quotas for a given subscription Id. + /// The ID of the target subscription. The value must be an UUID. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. - /// The quota name. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, AzureLocation location, PlaywrightTestingQuotaName name, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); - using var message = CreateGetRequest(subscriptionId, location, name); + using var message = CreateListBySubscriptionRequest(subscriptionId, location); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - PlaywrightTestingQuotaData value = default; + QuotaListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = PlaywrightTestingQuotaData.DeserializePlaywrightTestingQuotaData(document.RootElement); + value = QuotaListResult.DeserializeQuotaListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((PlaywrightTestingQuotaData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string location) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -220,7 +224,7 @@ internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nex return uri; } - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, AzureLocation location) + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string location) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -236,15 +240,16 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// List quotas for a given subscription Id. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. /// 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, AzureLocation location, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, location); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); @@ -264,15 +269,16 @@ public async Task> ListBySubscriptionNextPageAsync(str /// List quotas for a given subscription Id. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The location of quota in ARM Normalized format like eastus, southeastasia etc. /// 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, AzureLocation location, CancellationToken cancellationToken = default) + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string location, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, location); _pipeline.Send(message, cancellationToken); diff --git a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/autorest.md b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/autorest.md deleted file mode 100644 index 88a3b30b223e..000000000000 --- a/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/src/autorest.md +++ /dev/null @@ -1,63 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml -azure-arm: true -csharp: true -library-name: PlaywrightTesting -namespace: Azure.ResourceManager.PlaywrightTesting -require: https://github.com/Azure/azure-rest-api-specs/blob/1285ef63d84c4bf3dfe42b514451822e1dd6e8fc/specification/playwrighttesting/resource-manager/readme.md -#tag: package-2023-10-01-preview -output-folder: $(this-folder)/Generated -clear-output-folder: true -sample-gen: - output-folder: $(this-folder)/../samples/Generated - clear-output-folder: true -skip-csproj: true -modelerfour: - flatten-payloads: false -use-model-reader-writer: true - -#mgmt-debug: -# show-serialized-names: true - -rename-mapping: - Quota: PlaywrightTestingQuotas - -prepend-rp-prefix: - - QuotaNames - - Account - - ProvisioningState - -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/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/tsp-location.yaml b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/tsp-location.yaml new file mode 100644 index 000000000000..d6575f253299 --- /dev/null +++ b/sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/playwrighttesting/PlaywrightTesting.Management +commit: 1eb05b957a92bd56ef0ae770335b5813338984c2 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/playwrighttesting/ci.mgmt.yml b/sdk/playwrighttesting/ci.mgmt.yml index 79addf69162c..b0d82f689cd1 100644 --- a/sdk/playwrighttesting/ci.mgmt.yml +++ b/sdk/playwrighttesting/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/playwrighttesting/ci.mgmt.yml - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/playwrighttesting/ci.mgmt.yml + - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/playwrighttesting/ci.mgmt.yml + - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/playwrighttesting/ci.mgmt.yml + - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/policyinsights/ci.mgmt.yml b/sdk/policyinsights/ci.mgmt.yml index 56fa5c3ead85..71cca9c78d3c 100644 --- a/sdk/policyinsights/ci.mgmt.yml +++ b/sdk/policyinsights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/policyinsights/ci.mgmt.yml - sdk/policyinsights/Azure.ResourceManager.PolicyInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/policyinsights/ci.mgmt.yml + - sdk/policyinsights/Azure.ResourceManager.PolicyInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/policyinsights/ci.mgmt.yml + - sdk/policyinsights/Azure.ResourceManager.PolicyInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/policyinsights/ci.mgmt.yml + - sdk/policyinsights/Azure.ResourceManager.PolicyInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/postgresql/ci.mgmt.yml b/sdk/postgresql/ci.mgmt.yml index 77dbaed301ba..9a0e71898467 100644 --- a/sdk/postgresql/ci.mgmt.yml +++ b/sdk/postgresql/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/postgresql/ci.mgmt.yml - sdk/postgresql/Azure.ResourceManager.PostgreSql/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/postgresql/ci.mgmt.yml + - sdk/postgresql/Azure.ResourceManager.PostgreSql/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/postgresql/ci.mgmt.yml + - sdk/postgresql/Azure.ResourceManager.PostgreSql/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/postgresql/ci.mgmt.yml + - sdk/postgresql/Azure.ResourceManager.PostgreSql/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/powerbidedicated/ci.mgmt.yml b/sdk/powerbidedicated/ci.mgmt.yml index 414f2b8ef0a9..ed1885993756 100644 --- a/sdk/powerbidedicated/ci.mgmt.yml +++ b/sdk/powerbidedicated/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/powerbidedicated/ci.mgmt.yml - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/powerbidedicated/ci.mgmt.yml + - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/powerbidedicated/ci.mgmt.yml + - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/powerbidedicated/ci.mgmt.yml + - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/privatedns/ci.mgmt.yml b/sdk/privatedns/ci.mgmt.yml index 86401f2f9675..ce734fb7e4a8 100644 --- a/sdk/privatedns/ci.mgmt.yml +++ b/sdk/privatedns/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/privatedns/ci.mgmt.yml - sdk/privatedns/Azure.ResourceManager.PrivateDns/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/privatedns/ci.mgmt.yml + - sdk/privatedns/Azure.ResourceManager.PrivateDns/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/privatedns/ci.mgmt.yml + - sdk/privatedns/Azure.ResourceManager.PrivateDns/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/privatedns/ci.mgmt.yml + - sdk/privatedns/Azure.ResourceManager.PrivateDns/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/providerhub/ci.mgmt.yml b/sdk/providerhub/ci.mgmt.yml index 2c7f6ca61d3f..b32bd789ac32 100644 --- a/sdk/providerhub/ci.mgmt.yml +++ b/sdk/providerhub/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/providerhub/ci.mgmt.yml - sdk/providerhub/Azure.ResourceManager.ProviderHub/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/providerhub/ci.mgmt.yml + - sdk/providerhub/Azure.ResourceManager.ProviderHub/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/providerhub/ci.mgmt.yml + - sdk/providerhub/Azure.ResourceManager.ProviderHub/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/providerhub/ci.mgmt.yml + - sdk/providerhub/Azure.ResourceManager.ProviderHub/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/purview/ci.mgmt.yml b/sdk/purview/ci.mgmt.yml index 226718ca583c..7f225e0d66b8 100644 --- a/sdk/purview/ci.mgmt.yml +++ b/sdk/purview/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,42 @@ pr: - sdk/purview/ci.mgmt.yml - sdk/purview/Azure.ResourceManager.Purview/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/purview/ci.mgmt.yml + - sdk/purview/Azure.ResourceManager.Purview/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/purview/ci.mgmt.yml + - sdk/purview/Azure.ResourceManager.Purview/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/purview/ci.mgmt.yml + - sdk/purview/Azure.ResourceManager.Purview/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/quantum/ci.mgmt.yml b/sdk/quantum/ci.mgmt.yml index 8562320fa7c7..3a8da0312601 100644 --- a/sdk/quantum/ci.mgmt.yml +++ b/sdk/quantum/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/quantum/ci.mgmt.yml - sdk/quantum/Azure.ResourceManager.Quantum/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/quantum/ci.mgmt.yml + - sdk/quantum/Azure.ResourceManager.Quantum/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/quantum/ci.mgmt.yml + - sdk/quantum/Azure.ResourceManager.Quantum/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/quantum/ci.mgmt.yml + - sdk/quantum/Azure.ResourceManager.Quantum/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/qumulo/ci.mgmt.yml b/sdk/qumulo/ci.mgmt.yml index e89c4bea0e70..8f675330e766 100644 --- a/sdk/qumulo/ci.mgmt.yml +++ b/sdk/qumulo/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/qumulo/ci.mgmt.yml - sdk/qumulo/Azure.ResourceManager.Qumulo/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/qumulo/ci.mgmt.yml + - sdk/qumulo/Azure.ResourceManager.Qumulo/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/qumulo/ci.mgmt.yml + - sdk/qumulo/Azure.ResourceManager.Qumulo/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/qumulo/ci.mgmt.yml + - sdk/qumulo/Azure.ResourceManager.Qumulo/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/quota/ci.mgmt.yml b/sdk/quota/ci.mgmt.yml index f1f545ad13f1..880a702cbc72 100644 --- a/sdk/quota/ci.mgmt.yml +++ b/sdk/quota/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/quota/ci.mgmt.yml - sdk/quota/Azure.ResourceManager.Quota/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/quota/ci.mgmt.yml + - sdk/quota/Azure.ResourceManager.Quota/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/quota/ci.mgmt.yml + - sdk/quota/Azure.ResourceManager.Quota/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/quota/ci.mgmt.yml + - sdk/quota/Azure.ResourceManager.Quota/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/recoveryservices-backup/ci.mgmt.yml b/sdk/recoveryservices-backup/ci.mgmt.yml index 5edfd823e3c0..9b1409f339ba 100644 --- a/sdk/recoveryservices-backup/ci.mgmt.yml +++ b/sdk/recoveryservices-backup/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/recoveryservices-backup/ci.mgmt.yml - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-backup/ci.mgmt.yml + - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-backup/ci.mgmt.yml + - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-backup/ci.mgmt.yml + - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/recoveryservices-datareplication/ci.mgmt.yml b/sdk/recoveryservices-datareplication/ci.mgmt.yml index 2e3966d67a88..0c49c35b92d5 100644 --- a/sdk/recoveryservices-datareplication/ci.mgmt.yml +++ b/sdk/recoveryservices-datareplication/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/recoveryservices-datareplication/ci.mgmt.yml - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-datareplication/ci.mgmt.yml + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-datareplication/ci.mgmt.yml + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-datareplication/ci.mgmt.yml + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/recoveryservices-siterecovery/ci.mgmt.yml b/sdk/recoveryservices-siterecovery/ci.mgmt.yml index bded800f3ee2..a1d3ce405b6c 100644 --- a/sdk/recoveryservices-siterecovery/ci.mgmt.yml +++ b/sdk/recoveryservices-siterecovery/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/recoveryservices-siterecovery/ci.mgmt.yml - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-siterecovery/ci.mgmt.yml + - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-siterecovery/ci.mgmt.yml + - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-siterecovery/ci.mgmt.yml + - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/recoveryservices/ci.mgmt.yml b/sdk/recoveryservices/ci.mgmt.yml index 0e7e6985f21c..cc91b5a0bf41 100644 --- a/sdk/recoveryservices/ci.mgmt.yml +++ b/sdk/recoveryservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/recoveryservices/ci.mgmt.yml - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices/ci.mgmt.yml + - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices/ci.mgmt.yml + - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices/ci.mgmt.yml + - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/redis/ci.mgmt.yml b/sdk/redis/ci.mgmt.yml index 9e6845322580..5f6af59177bd 100644 --- a/sdk/redis/ci.mgmt.yml +++ b/sdk/redis/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/redis/ci.mgmt.yml - sdk/redis/Azure.ResourceManager.Redis/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/redis/ci.mgmt.yml + - sdk/redis/Azure.ResourceManager.Redis/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/redis/ci.mgmt.yml + - sdk/redis/Azure.ResourceManager.Redis/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/redis/ci.mgmt.yml + - sdk/redis/Azure.ResourceManager.Redis/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/redisenterprise/ci.mgmt.yml b/sdk/redisenterprise/ci.mgmt.yml index 93641cfe3983..fd53292bfb60 100644 --- a/sdk/redisenterprise/ci.mgmt.yml +++ b/sdk/redisenterprise/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/redisenterprise/ci.mgmt.yml - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/redisenterprise/ci.mgmt.yml + - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/redisenterprise/ci.mgmt.yml + - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/redisenterprise/ci.mgmt.yml + - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/relay/ci.mgmt.yml b/sdk/relay/ci.mgmt.yml index b69a1efbd0f9..473864553ffa 100644 --- a/sdk/relay/ci.mgmt.yml +++ b/sdk/relay/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/relay/ci.mgmt.yml - sdk/relay/Azure.ResourceManager.Relay/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/relay/ci.mgmt.yml + - sdk/relay/Azure.ResourceManager.Relay/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/relay/ci.mgmt.yml + - sdk/relay/Azure.ResourceManager.Relay/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/relay/ci.mgmt.yml + - sdk/relay/Azure.ResourceManager.Relay/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/reservations/ci.mgmt.yml b/sdk/reservations/ci.mgmt.yml index c46c8c69cd2e..1722075a8266 100644 --- a/sdk/reservations/ci.mgmt.yml +++ b/sdk/reservations/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/reservations/ci.mgmt.yml - sdk/reservations/Azure.ResourceManager.Reservations/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/reservations/ci.mgmt.yml + - sdk/reservations/Azure.ResourceManager.Reservations/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/reservations/ci.mgmt.yml + - sdk/reservations/Azure.ResourceManager.Reservations/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/reservations/ci.mgmt.yml + - sdk/reservations/Azure.ResourceManager.Reservations/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resourceconnector/ci.mgmt.yml b/sdk/resourceconnector/ci.mgmt.yml index 81269b9113c7..19fee07cecf9 100644 --- a/sdk/resourceconnector/ci.mgmt.yml +++ b/sdk/resourceconnector/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/resourceconnector/ci.mgmt.yml - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourceconnector/ci.mgmt.yml + - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourceconnector/ci.mgmt.yml + - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourceconnector/ci.mgmt.yml + - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resourcegraph/ci.mgmt.yml b/sdk/resourcegraph/ci.mgmt.yml index 5abe050f7709..633c0ddd7401 100644 --- a/sdk/resourcegraph/ci.mgmt.yml +++ b/sdk/resourcegraph/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/resourcegraph/ci.mgmt.yml - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcegraph/ci.mgmt.yml + - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcegraph/ci.mgmt.yml + - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcegraph/ci.mgmt.yml + - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resourcehealth/ci.mgmt.yml b/sdk/resourcehealth/ci.mgmt.yml index fb0a27171a69..dacdd2cc80f9 100644 --- a/sdk/resourcehealth/ci.mgmt.yml +++ b/sdk/resourcehealth/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/resourcehealth/ci.mgmt.yml - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcehealth/ci.mgmt.yml + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcehealth/ci.mgmt.yml + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcehealth/ci.mgmt.yml + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 960151044171..e5cb940befe0 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -77,6 +77,7 @@ trigger: - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins - sdk/dns/Azure.ResourceManager.Dns - sdk/dnsresolver/Azure.ResourceManager.DnsResolver + - sdk/durabletask/Azure.ResourceManager.DurableTask - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - sdk/edgezones/Azure.ResourceManager.EdgeZones @@ -107,6 +108,7 @@ trigger: - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub + - sdk/iotoperations/Azure.ResourceManager.IoTOperations - sdk/keyvault/Azure.ResourceManager.KeyVault - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - sdk/kusto/Azure.ResourceManager.Kusto @@ -282,6 +284,7 @@ pr: - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins - sdk/dns/Azure.ResourceManager.Dns - sdk/dnsresolver/Azure.ResourceManager.DnsResolver + - sdk/durabletask/Azure.ResourceManager.DurableTask - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - sdk/edgezones/Azure.ResourceManager.EdgeZones @@ -312,6 +315,7 @@ pr: - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub + - sdk/iotoperations/Azure.ResourceManager.IoTOperations - sdk/keyvault/Azure.ResourceManager.KeyVault - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - sdk/kusto/Azure.ResourceManager.Kusto diff --git a/sdk/resourcemover/ci.mgmt.yml b/sdk/resourcemover/ci.mgmt.yml index 519b8a431926..cc4f0dc8f1b9 100644 --- a/sdk/resourcemover/ci.mgmt.yml +++ b/sdk/resourcemover/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/resourcemover/ci.mgmt.yml - sdk/resourcemover/Azure.ResourceManager.ResourceMover/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemover/ci.mgmt.yml + - sdk/resourcemover/Azure.ResourceManager.ResourceMover/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemover/ci.mgmt.yml + - sdk/resourcemover/Azure.ResourceManager.ResourceMover/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemover/ci.mgmt.yml + - sdk/resourcemover/Azure.ResourceManager.ResourceMover/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resources/ci.mgmt.yml b/sdk/resources/ci.mgmt.yml index 3fefd5254c85..705a03d3914b 100644 --- a/sdk/resources/ci.mgmt.yml +++ b/sdk/resources/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/resources/ci.mgmt.yml - sdk/resources/Azure.ResourceManager.Resources/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resources/ci.mgmt.yml + - sdk/resources/Azure.ResourceManager.Resources/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resources/ci.mgmt.yml + - sdk/resources/Azure.ResourceManager.Resources/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resources/ci.mgmt.yml + - sdk/resources/Azure.ResourceManager.Resources/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/search/ci.mgmt.yml b/sdk/search/ci.mgmt.yml index a8c2a632c1c8..f373f6ef855c 100644 --- a/sdk/search/ci.mgmt.yml +++ b/sdk/search/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/search/ci.mgmt.yml - sdk/search/Azure.ResourceManager.Search/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/search/ci.mgmt.yml + - sdk/search/Azure.ResourceManager.Search/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/search/ci.mgmt.yml + - sdk/search/Azure.ResourceManager.Search/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/search/ci.mgmt.yml + - sdk/search/Azure.ResourceManager.Search/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/securitycenter/ci.mgmt.yml b/sdk/securitycenter/ci.mgmt.yml index c728522efab2..c711a5aa9214 100644 --- a/sdk/securitycenter/ci.mgmt.yml +++ b/sdk/securitycenter/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/securitycenter/ci.mgmt.yml - sdk/securitycenter/Azure.ResourceManager.SecurityCenter/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securitycenter/ci.mgmt.yml + - sdk/securitycenter/Azure.ResourceManager.SecurityCenter/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securitycenter/ci.mgmt.yml + - sdk/securitycenter/Azure.ResourceManager.SecurityCenter/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securitycenter/ci.mgmt.yml + - sdk/securitycenter/Azure.ResourceManager.SecurityCenter/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/securitydevops/ci.mgmt.yml b/sdk/securitydevops/ci.mgmt.yml index c5a54a9ad206..60df48f1cbf9 100644 --- a/sdk/securitydevops/ci.mgmt.yml +++ b/sdk/securitydevops/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/securitydevops/ci.mgmt.yml - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securitydevops/ci.mgmt.yml + - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securitydevops/ci.mgmt.yml + - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securitydevops/ci.mgmt.yml + - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/securityinsights/ci.mgmt.yml b/sdk/securityinsights/ci.mgmt.yml index f1d428ebef90..dc76d0abe427 100644 --- a/sdk/securityinsights/ci.mgmt.yml +++ b/sdk/securityinsights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/securityinsights/ci.mgmt.yml - sdk/securityinsights/Azure.ResourceManager.SecurityInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securityinsights/ci.mgmt.yml + - sdk/securityinsights/Azure.ResourceManager.SecurityInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securityinsights/ci.mgmt.yml + - sdk/securityinsights/Azure.ResourceManager.SecurityInsights/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securityinsights/ci.mgmt.yml + - sdk/securityinsights/Azure.ResourceManager.SecurityInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/selfhelp/ci.mgmt.yml b/sdk/selfhelp/ci.mgmt.yml index bb6a162210eb..6aea4e659165 100644 --- a/sdk/selfhelp/ci.mgmt.yml +++ b/sdk/selfhelp/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/selfhelp/ci.mgmt.yml - sdk/selfhelp/Azure.ResourceManager.SelfHelp/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/selfhelp/ci.mgmt.yml + - sdk/selfhelp/Azure.ResourceManager.SelfHelp/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/selfhelp/ci.mgmt.yml + - sdk/selfhelp/Azure.ResourceManager.SelfHelp/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/selfhelp/ci.mgmt.yml + - sdk/selfhelp/Azure.ResourceManager.SelfHelp/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicebus/ci.mgmt.yml b/sdk/servicebus/ci.mgmt.yml index 02c45dc88e18..c31be6aec7ce 100644 --- a/sdk/servicebus/ci.mgmt.yml +++ b/sdk/servicebus/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/servicebus/ci.mgmt.yml - sdk/servicebus/Azure.ResourceManager.ServiceBus/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicebus/ci.mgmt.yml + - sdk/servicebus/Azure.ResourceManager.ServiceBus/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicebus/ci.mgmt.yml + - sdk/servicebus/Azure.ResourceManager.ServiceBus/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicebus/ci.mgmt.yml + - sdk/servicebus/Azure.ResourceManager.ServiceBus/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicefabric/ci.mgmt.yml b/sdk/servicefabric/ci.mgmt.yml index 430f48c8c87b..85b95a1090fd 100644 --- a/sdk/servicefabric/ci.mgmt.yml +++ b/sdk/servicefabric/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/servicefabric/ci.mgmt.yml - sdk/servicefabric/Azure.ResourceManager.ServiceFabric/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabric/ci.mgmt.yml + - sdk/servicefabric/Azure.ResourceManager.ServiceFabric/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabric/ci.mgmt.yml + - sdk/servicefabric/Azure.ResourceManager.ServiceFabric/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabric/ci.mgmt.yml + - sdk/servicefabric/Azure.ResourceManager.ServiceFabric/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicefabricmanagedclusters/ci.mgmt.yml b/sdk/servicefabricmanagedclusters/ci.mgmt.yml index e73289f589f4..5cdb985f6b54 100644 --- a/sdk/servicefabricmanagedclusters/ci.mgmt.yml +++ b/sdk/servicefabricmanagedclusters/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/servicefabricmanagedclusters/ci.mgmt.yml - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabricmanagedclusters/ci.mgmt.yml + - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabricmanagedclusters/ci.mgmt.yml + - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabricmanagedclusters/ci.mgmt.yml + - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicelinker/ci.mgmt.yml b/sdk/servicelinker/ci.mgmt.yml index 77df314e977a..1f420a779133 100644 --- a/sdk/servicelinker/ci.mgmt.yml +++ b/sdk/servicelinker/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/servicelinker/ci.mgmt.yml - sdk/servicelinker/Azure.ResourceManager.ServiceLinker/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicelinker/ci.mgmt.yml + - sdk/servicelinker/Azure.ResourceManager.ServiceLinker/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicelinker/ci.mgmt.yml + - sdk/servicelinker/Azure.ResourceManager.ServiceLinker/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicelinker/ci.mgmt.yml + - sdk/servicelinker/Azure.ResourceManager.ServiceLinker/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicenetworking/ci.mgmt.yml b/sdk/servicenetworking/ci.mgmt.yml index b2332ae15224..8cf3e32f7c87 100644 --- a/sdk/servicenetworking/ci.mgmt.yml +++ b/sdk/servicenetworking/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/servicenetworking/ci.mgmt.yml - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicenetworking/ci.mgmt.yml + - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicenetworking/ci.mgmt.yml + - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicenetworking/ci.mgmt.yml + - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/signalr/ci.mgmt.yml b/sdk/signalr/ci.mgmt.yml index c934ed4314fa..c2b79e6ff2cd 100644 --- a/sdk/signalr/ci.mgmt.yml +++ b/sdk/signalr/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/signalr/ci.mgmt.yml - sdk/signalr/Azure.ResourceManager.SignalR/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/signalr/ci.mgmt.yml + - sdk/signalr/Azure.ResourceManager.SignalR/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/signalr/ci.mgmt.yml + - sdk/signalr/Azure.ResourceManager.SignalR/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/signalr/ci.mgmt.yml + - sdk/signalr/Azure.ResourceManager.SignalR/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/sphere/ci.mgmt.yml b/sdk/sphere/ci.mgmt.yml index f3f33e9d00f4..577742efdb92 100644 --- a/sdk/sphere/ci.mgmt.yml +++ b/sdk/sphere/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/sphere/ci.mgmt.yml - sdk/sphere/Azure.ResourceManager.Sphere/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sphere/ci.mgmt.yml + - sdk/sphere/Azure.ResourceManager.Sphere/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sphere/ci.mgmt.yml + - sdk/sphere/Azure.ResourceManager.Sphere/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sphere/ci.mgmt.yml + - sdk/sphere/Azure.ResourceManager.Sphere/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/springappdiscovery/ci.mgmt.yml b/sdk/springappdiscovery/ci.mgmt.yml index 7676386684df..89ff39b125df 100644 --- a/sdk/springappdiscovery/ci.mgmt.yml +++ b/sdk/springappdiscovery/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/springappdiscovery/ci.mgmt.yml - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/springappdiscovery/ci.mgmt.yml + - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/springappdiscovery/ci.mgmt.yml + - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/springappdiscovery/ci.mgmt.yml + - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/sqlmanagement/ci.mgmt.yml b/sdk/sqlmanagement/ci.mgmt.yml index da93d03f2d33..16c8cc6e25a7 100644 --- a/sdk/sqlmanagement/ci.mgmt.yml +++ b/sdk/sqlmanagement/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,42 @@ pr: - sdk/sqlmanagement/ci.mgmt.yml - sdk/sqlmanagement/Azure.ResourceManager.Sql/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sqlmanagement/ci.mgmt.yml + - sdk/sqlmanagement/Azure.ResourceManager.Sql/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sqlmanagement/ci.mgmt.yml + - sdk/sqlmanagement/Azure.ResourceManager.Sql/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sqlmanagement/ci.mgmt.yml + - sdk/sqlmanagement/Azure.ResourceManager.Sql/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/sqlvirtualmachine/ci.mgmt.yml b/sdk/sqlvirtualmachine/ci.mgmt.yml index 28c6192fa86b..1f3007f4419f 100644 --- a/sdk/sqlvirtualmachine/ci.mgmt.yml +++ b/sdk/sqlvirtualmachine/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/sqlvirtualmachine/ci.mgmt.yml - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sqlvirtualmachine/ci.mgmt.yml + - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sqlvirtualmachine/ci.mgmt.yml + - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sqlvirtualmachine/ci.mgmt.yml + - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/standbypool/ci.mgmt.yml b/sdk/standbypool/ci.mgmt.yml index 0763a516e2c1..cbdd7249d251 100644 --- a/sdk/standbypool/ci.mgmt.yml +++ b/sdk/standbypool/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/standbypool/ci.mgmt.yml - sdk/standbypool/Azure.ResourceManager.StandbyPool/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/standbypool/ci.mgmt.yml + - sdk/standbypool/Azure.ResourceManager.StandbyPool/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/standbypool/ci.mgmt.yml + - sdk/standbypool/Azure.ResourceManager.StandbyPool/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/standbypool/ci.mgmt.yml + - sdk/standbypool/Azure.ResourceManager.StandbyPool/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storage/ci.mgmt.yml b/sdk/storage/ci.mgmt.yml index 95bc19b325d5..6ca886a4b53c 100644 --- a/sdk/storage/ci.mgmt.yml +++ b/sdk/storage/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/storage/ci.mgmt.yml - sdk/storage/Azure.ResourceManager.Storage/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storage/ci.mgmt.yml + - sdk/storage/Azure.ResourceManager.Storage/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storage/ci.mgmt.yml + - sdk/storage/Azure.ResourceManager.Storage/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storage/ci.mgmt.yml + - sdk/storage/Azure.ResourceManager.Storage/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storageactions/ci.mgmt.yml b/sdk/storageactions/ci.mgmt.yml index 27062b4565a8..75af70b17204 100644 --- a/sdk/storageactions/ci.mgmt.yml +++ b/sdk/storageactions/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/storageactions/ci.mgmt.yml - sdk/storageactions/Azure.ResourceManager.StorageActions/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storageactions/ci.mgmt.yml + - sdk/storageactions/Azure.ResourceManager.StorageActions/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storageactions/ci.mgmt.yml + - sdk/storageactions/Azure.ResourceManager.StorageActions/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storageactions/ci.mgmt.yml + - sdk/storageactions/Azure.ResourceManager.StorageActions/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storagecache/ci.mgmt.yml b/sdk/storagecache/ci.mgmt.yml index c6abf63baf2c..116dc5d8880a 100644 --- a/sdk/storagecache/ci.mgmt.yml +++ b/sdk/storagecache/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/storagecache/ci.mgmt.yml - sdk/storagecache/Azure.ResourceManager.StorageCache/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagecache/ci.mgmt.yml + - sdk/storagecache/Azure.ResourceManager.StorageCache/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagecache/ci.mgmt.yml + - sdk/storagecache/Azure.ResourceManager.StorageCache/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagecache/ci.mgmt.yml + - sdk/storagecache/Azure.ResourceManager.StorageCache/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storagemover/ci.mgmt.yml b/sdk/storagemover/ci.mgmt.yml index e9055f49e1a9..3a2d4b27c6b4 100644 --- a/sdk/storagemover/ci.mgmt.yml +++ b/sdk/storagemover/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/storagemover/ci.mgmt.yml - sdk/storagemover/Azure.ResourceManager.StorageMover/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagemover/ci.mgmt.yml + - sdk/storagemover/Azure.ResourceManager.StorageMover/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagemover/ci.mgmt.yml + - sdk/storagemover/Azure.ResourceManager.StorageMover/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagemover/ci.mgmt.yml + - sdk/storagemover/Azure.ResourceManager.StorageMover/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storagepool/ci.mgmt.yml b/sdk/storagepool/ci.mgmt.yml index 2178fc390757..eca6fe8e1044 100644 --- a/sdk/storagepool/ci.mgmt.yml +++ b/sdk/storagepool/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/storagepool/ci.mgmt.yml - sdk/storagepool/Azure.ResourceManager.StoragePool/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagepool/ci.mgmt.yml + - sdk/storagepool/Azure.ResourceManager.StoragePool/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagepool/ci.mgmt.yml + - sdk/storagepool/Azure.ResourceManager.StoragePool/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagepool/ci.mgmt.yml + - sdk/storagepool/Azure.ResourceManager.StoragePool/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storagesync/ci.mgmt.yml b/sdk/storagesync/ci.mgmt.yml index a8789947c687..6e4b9d491291 100644 --- a/sdk/storagesync/ci.mgmt.yml +++ b/sdk/storagesync/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/storagesync/ci.mgmt.yml - sdk/storagesync/Azure.ResourceManager.StorageSync/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagesync/ci.mgmt.yml + - sdk/storagesync/Azure.ResourceManager.StorageSync/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagesync/ci.mgmt.yml + - sdk/storagesync/Azure.ResourceManager.StorageSync/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagesync/ci.mgmt.yml + - sdk/storagesync/Azure.ResourceManager.StorageSync/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/streamanalytics/ci.mgmt.yml b/sdk/streamanalytics/ci.mgmt.yml index 09d108a1a7d9..295b6256c68e 100644 --- a/sdk/streamanalytics/ci.mgmt.yml +++ b/sdk/streamanalytics/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/streamanalytics/ci.mgmt.yml - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/streamanalytics/ci.mgmt.yml + - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/streamanalytics/ci.mgmt.yml + - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/streamanalytics/ci.mgmt.yml + - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/subscription/ci.mgmt.yml b/sdk/subscription/ci.mgmt.yml index f9067b4c0af3..4c61a2812701 100644 --- a/sdk/subscription/ci.mgmt.yml +++ b/sdk/subscription/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/subscription/ci.mgmt.yml - sdk/subscription/Azure.ResourceManager.Subscription/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/subscription/ci.mgmt.yml + - sdk/subscription/Azure.ResourceManager.Subscription/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/subscription/ci.mgmt.yml + - sdk/subscription/Azure.ResourceManager.Subscription/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/subscription/ci.mgmt.yml + - sdk/subscription/Azure.ResourceManager.Subscription/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/support/ci.mgmt.yml b/sdk/support/ci.mgmt.yml index 5a947c4c4939..62761f22cb9a 100644 --- a/sdk/support/ci.mgmt.yml +++ b/sdk/support/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/support/ci.mgmt.yml - sdk/support/Azure.ResourceManager.Support/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/support/ci.mgmt.yml + - sdk/support/Azure.ResourceManager.Support/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/support/ci.mgmt.yml + - sdk/support/Azure.ResourceManager.Support/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/support/ci.mgmt.yml + - sdk/support/Azure.ResourceManager.Support/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/synapse/ci.mgmt.yml b/sdk/synapse/ci.mgmt.yml index 0a089a504291..b9d941a5b722 100644 --- a/sdk/synapse/ci.mgmt.yml +++ b/sdk/synapse/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/synapse/ci.mgmt.yml - sdk/synapse/Azure.ResourceManager.Synapse/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/synapse/ci.mgmt.yml + - sdk/synapse/Azure.ResourceManager.Synapse/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/synapse/ci.mgmt.yml + - sdk/synapse/Azure.ResourceManager.Synapse/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/synapse/ci.mgmt.yml + - sdk/synapse/Azure.ResourceManager.Synapse/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/terraform/ci.mgmt.yml b/sdk/terraform/ci.mgmt.yml index 82c4c1f05a4c..64d0e8ebabaa 100644 --- a/sdk/terraform/ci.mgmt.yml +++ b/sdk/terraform/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/terraform/ci.mgmt.yml - sdk/terraform/Azure.ResourceManager.Terraform/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/terraform/ci.mgmt.yml + - sdk/terraform/Azure.ResourceManager.Terraform/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/terraform/ci.mgmt.yml + - sdk/terraform/Azure.ResourceManager.Terraform/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/terraform/ci.mgmt.yml + - sdk/terraform/Azure.ResourceManager.Terraform/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/trafficmanager/ci.mgmt.yml b/sdk/trafficmanager/ci.mgmt.yml index 528f78b70b96..6bb755e2e29d 100644 --- a/sdk/trafficmanager/ci.mgmt.yml +++ b/sdk/trafficmanager/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/trafficmanager/ci.mgmt.yml - sdk/trafficmanager/Azure.ResourceManager.TrafficManager/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/trafficmanager/ci.mgmt.yml + - sdk/trafficmanager/Azure.ResourceManager.TrafficManager/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/trafficmanager/ci.mgmt.yml + - sdk/trafficmanager/Azure.ResourceManager.TrafficManager/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/trafficmanager/ci.mgmt.yml + - sdk/trafficmanager/Azure.ResourceManager.TrafficManager/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/trustedsigning/ci.mgmt.yml b/sdk/trustedsigning/ci.mgmt.yml index 5b67358a4477..6c3084495741 100644 --- a/sdk/trustedsigning/ci.mgmt.yml +++ b/sdk/trustedsigning/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/trustedsigning/ci.mgmt.yml - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/trustedsigning/ci.mgmt.yml + - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/trustedsigning/ci.mgmt.yml + - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/trustedsigning/ci.mgmt.yml + - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/voiceservices/ci.mgmt.yml b/sdk/voiceservices/ci.mgmt.yml index a914d1640296..e04fd4b936d9 100644 --- a/sdk/voiceservices/ci.mgmt.yml +++ b/sdk/voiceservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/voiceservices/ci.mgmt.yml - sdk/voiceservices/Azure.ResourceManager.VoiceServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/voiceservices/ci.mgmt.yml + - sdk/voiceservices/Azure.ResourceManager.VoiceServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/voiceservices/ci.mgmt.yml + - sdk/voiceservices/Azure.ResourceManager.VoiceServices/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/voiceservices/ci.mgmt.yml + - sdk/voiceservices/Azure.ResourceManager.VoiceServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/webpubsub/ci.mgmt.yml b/sdk/webpubsub/ci.mgmt.yml index 6bcb8439a2b0..9aad5a2670e0 100644 --- a/sdk/webpubsub/ci.mgmt.yml +++ b/sdk/webpubsub/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,42 @@ pr: - sdk/webpubsub/ci.mgmt.yml - sdk/webpubsub/Azure.ResourceManager.WebPubSub/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/webpubsub/ci.mgmt.yml + - sdk/webpubsub/Azure.ResourceManager.WebPubSub/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/webpubsub/ci.mgmt.yml + - sdk/webpubsub/Azure.ResourceManager.WebPubSub/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/webpubsub/ci.mgmt.yml + - sdk/webpubsub/Azure.ResourceManager.WebPubSub/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/websites/ci.mgmt.yml b/sdk/websites/ci.mgmt.yml index d67c580bc414..5fb769244e75 100644 --- a/sdk/websites/ci.mgmt.yml +++ b/sdk/websites/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/websites/ci.mgmt.yml - sdk/websites/Azure.ResourceManager.AppService/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/websites/ci.mgmt.yml + - sdk/websites/Azure.ResourceManager.AppService/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/websites/ci.mgmt.yml + - sdk/websites/Azure.ResourceManager.AppService/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/websites/ci.mgmt.yml + - sdk/websites/Azure.ResourceManager.AppService/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/workloadmonitor/ci.mgmt.yml b/sdk/workloadmonitor/ci.mgmt.yml index 7c6a51fbe75c..0d0658c65b29 100644 --- a/sdk/workloadmonitor/ci.mgmt.yml +++ b/sdk/workloadmonitor/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/workloadmonitor/ci.mgmt.yml - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloadmonitor/ci.mgmt.yml + - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloadmonitor/ci.mgmt.yml + - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloadmonitor/ci.mgmt.yml + - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/workloads/ci.mgmt.yml b/sdk/workloads/ci.mgmt.yml index e3457d69ceaa..891fdf59d58b 100644 --- a/sdk/workloads/ci.mgmt.yml +++ b/sdk/workloads/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,42 @@ pr: - sdk/workloads/ci.mgmt.yml - sdk/workloads/Azure.ResourceManager.Workloads/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloads/ci.mgmt.yml + - sdk/workloads/Azure.ResourceManager.Workloads/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloads/ci.mgmt.yml + - sdk/workloads/Azure.ResourceManager.Workloads/ + + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloads/ci.mgmt.yml + - sdk/workloads/Azure.ResourceManager.Workloads/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: